Page 2 of 3
Re: Good C++ Forum?
Posted: Sat Sep 18, 2010 2:41 pm
by josh
"I'm not saying you can't write a portable C++ app, because you can. But C++ was never intended to achieve "write once, run anywhere" portability. Java is the primary language where you can write code and not have to care about the platform on which the code is deployed." - paraphrased from the interwebs
I've done a small amount Visual basic, C++, and Java.. I think they are all good. C++ is more portable if you're targetting "weird" platforms (like trying to program elevator software, or software for a bank ATM). Java is more portable if you're targeting "the main 3 desktop OS" (mac, windows, linux). C++ is a lot faster, that is true as well. But how much time programming will you spend to make your app a little bit faster? It depends on what your app needs to do. For example, if you're writing an email program speed is probably not that important. If you were writing a web server, speed is a lot more important - and that would influence your language decision. Faster is not always better because it comes with more trade offs.
Re: Good C++ Forum?
Posted: Sat Sep 18, 2010 3:50 pm
by alex.barylski
"I'm not saying you can't write a portable C++ app, because you can. But C++ was never intended to achieve "write once, run anywhere" portability. Java is the primary language where you can write code and not have to care about the platform on which the code is deployed."
This is true.
Portability isnt' really an issue, IMO. Usually all that is required re-compiling under the target system, which if you don't have, you are at a disadvantage. Although most people have Windows and others can usually be obtained easily enough.
For example, if you're writing an email program speed is probably not that important. If you were writing a web server, speed is a lot more important - and that would influence your language decision. Faster is not always better because it comes with more trade offs.
True but faster is always better than slower, if that is the only factor. Java will not expedite your development time when compared to C++ so long as you use the right framework(s) and have the required experience. Pointers are about the only low-level construct that are required to be understood in building C++ applications as compared to Java.
Cheers,
Alex
Re: Good C++ Forum?
Posted: Sat Sep 18, 2010 5:08 pm
by josh
PCSpectra wrote:Portability isnt' really an issue, IMO. Usually all that is required re-compiling under the target system, which if you don't have, you are at a disadvantage. Although most people have Windows and others can usually be obtained easily enough.
First of all its not a matter of opinion, its a matter of fact. Its a fact that the systems will differ, and you're going to have to account for that in your code, frameworks, and programming languages.
Pointers are about the only low-level construct that are required to be understood in building C++ applications as compared to Java.
The advice you are giving is inaccurate, java does have pointers. Its one of the fundamental aspects of the language. It also has aspect oriented programming which kicks C++ butt any day
I would just characterize the differences like this. Java is more programmer oriented. C++ is more machine oriented.
Re: Good C++ Forum?
Posted: Sat Sep 18, 2010 6:53 pm
by alex.barylski
First of all its not a matter of opinion, its a matter of fact. Its a fact that the systems will differ, and you're going to have to account for that in your code, frameworks, and programming languages.
Yes sir, sorry sir. LOL
I was trying to be diplomatic in suggesting everyone is entitled an opinion, like bumholes.
Portability is not an issue, if you use the right framework. Qt/wxWidgets/etc provides a unified interface to working with Windows and controls under any platform, just as Java does. The difference being, C++ applications are compiled into a native binary using native OS API but these details are hidden from a client developer (just as Java) handled by the framework using pre-processing conditionals resolved at compile time. Big performance addvantage at no cost to the client developer. Never once when I built a portable app in C++ did I worry about platform specifics. I have no idea what the point is your trying to make.
The advice you are giving is inaccurate, java does have pointers. Its one of the fundamental aspects of the language.
Well you should probably write Sun/Oracle because as I always understood and the docs seem to suggest (see last bullet point) pointers were a fundemental feature drop behind Java:
http://java.sun.com/docs/white/langenv/Simple.doc2.html
It's possible that document is outdated and they added pointers to Java, where did you hear of this feature? Can you provide a link/proof to qualify your statement? Pointers and references are not the same thing, which many Java developers seem to confuse, judging by a quick Google.
http://javadude.com/articles/passbyvalue.htm wrote:On Pointers versus References...
The problem here is that the folks at Sun made a naming mistake.
In programming language design, a "pointer" is a variable that indirectly tracks the location of some piece of data. The value of a pointer is often the memory address of the data you're interested in. Some languages allow you to manipulate that address; others do not.
A "reference" is an alias to another variable. Any manipulation done to the reference variable directly changes the original variable.
Check out the second sentence of
Also
Java Link Above wrote:You no longer have dangling pointers and trashing of memory because of incorrect pointers, because there are no pointers in Java
You can actually abstract/remove much of the problems introduced with pointers by using smart pointers:
http://en.wikipedia.org/wiki/Smart_pointer
This is almost always the case in C++, it's just not a standard practice, as it should be.
It also has aspect oriented programming which kicks C++ butt any day
You can absolutely do AOP in C++ google it. You may need to add a patch to a compiler or use a compiler that supports AOP, so it requires being tech savvy and knowing how to tweak your compilation tool chain.
http://www.aspectc.org/
would just characterize the differences like this. Java is more programmer oriented. C++ is more machine oriented.
Now that is definetely personal opinion. C++ can be machine oriented or abstracted to no end, which IMO gives C++ a big advantage, allowing to be used to rapidly build enterprise applications or system code.
Cheers,
Alex
Re: Good C++ Forum?
Posted: Sat Sep 18, 2010 7:14 pm
by Jonah Bron
In terms of performance type, it will be doing a lot of file compression and image manipulation. Most of the work cycle is spent waiting while it runs in the background, so I think that will be of marginal import.
I looked up on the statistics of computers with Java installed, and it looks like about 75% of computers have it. This software will be commercial and probably be used by folks who aren't that good with computers, so they probably wouldn't want to try to figure out how to install Java. The grandma factor comes in to play here. Hey, can you distribute the JVM installer with an application?
It's funny. I had sort of set my heart on C++. But since I don't know much about either C++ or Java, I'm really trying hard to listen to both sides and not to be biased.
Let the discussion roll on!

Re: Good C++ Forum?
Posted: Sat Sep 18, 2010 7:31 pm
by alex.barylski
Hey, can you distribute the JVM installer with an application?
Probably.
It's funny. I had sort of set my heart on C++. But since I don't know much about either C++ or Java, I'm really trying hard to listen to both sides and not to be biased.
Why did you have your heart set on C++? I wouldn't stress to much about the decision, both will let you get the job done. In fact, simply because the learning curve is higher in CPP I would suggest going with Java first. If you find the JVM/performance to be an issue, port the application to CPP. Unless this program is going to be hundreds of thousands of lines of code, then the decision on which you choose is more important, obviously.
Cheers,
Alex
Re: Good C++ Forum?
Posted: Sat Sep 18, 2010 8:09 pm
by Jonah Bron
PCSpectra wrote:Why did you have your heart set on C++?
I don't know, just weird irrational brain stuff.
PCSpectra wrote:If you find the JVM/performance to be an issue, port the application to CPP
That actually sounds like a really good idea.
Another question. If I were to join a major open source software project, which language would be a more valuable asset?
Re: Good C++ Forum?
Posted: Sat Sep 18, 2010 10:13 pm
by josh
The percentage of JVM users is of relative un-importance:
C++ frameworks sometimes require additional steps, just like Java. For example ATI's Catalyst Control center won't install until Microsoft .NET is installed. Lots of C++ apps rely on frameworks like this and those apps are equally as convenient to setup as a java app in my opinion. That can be solved in either language with a good installation program. A good installer program will always be native. Even Visual Basic programs used a runtime. "Running natively" doesn't really mean much on a typical modern desktop OS.
@Alex, regarding points vs references I am probably mistaken. I was not aware of the distinction. That just goes to show, C++ is more machine oriented than person oriented. You need to understand lots of low level concepts because the features are available in the language. But those features do give you more control over the machine you're programming, which matters for some people/some types of systems.
Jonah Bro, what I would recommend is setting up some basic scripts in both languages maybe.. try to do some of the stuff you are used to doing with PHP arrays, and see which programming language "feels" more comfortable to program in. If you're not too familiar with other languages, you'll be shocked at how advanced PHP is w/ arrays (or rather, how certain other languages are lacking)
Re: Good C++ Forum?
Posted: Sat Sep 18, 2010 11:45 pm
by Jonah Bron
josh wrote:what I would recommend is setting up some basic scripts in both languages maybe..
That's a good idea also. What I could do is use that in conjunction with what Alex said. I just may find I'm more comfortable with one or the other. I have written a few lines of Java in the past in Robocode.
josh wrote:you'll be shocked at how advanced PHP is w/ arrays
Yeah, I'm past that point already... if you asked me what I thought about VB while I was learning it, I probably would have said
Me wrote:"Dude, you don't really appreciate dynamic languages until you find yourself using something else. I mean, pre-defining the size and type of the array? Who came up with that idea? How am I supposed to know how big it's going to be?"
Then I discovered Lists.
Reading
The Art of Assembly was a real eye-opener too.
Is it very difficult to make Java use native widgets?
Re: Good C++ Forum?
Posted: Sun Sep 19, 2010 2:25 pm
by alex.barylski
I don't know, just weird irrational brain stuff.
LOL I hear ya. Many C/C++ developers have a God complex that stems from the ultimate control and flexibility of the technology. They advertise this to the world and it unfortunately influences some people into thinking C/C++ is the best solution for everything and that simply isn't the case.
Java is a full scale enterprise application programming language, so don't be fooled into thinking you will learn it as fast as you did PHP. The learning curve will be less than C/C++ but you will (nature of the beast) limit yourself to some degree in not learning C/C++.
Another question. If I were to join a major open source software project, which language would be a more valuable asset?
Define asset? What are your goals and/or career objectives? If you intend to work for Google or Microsoft, than C/C++ is a good investment. Do you want to learn a language that will lets you develop system code, device drivers, video games, daemons? In those cases, C/C++ are the obvious winners. If you plan on only ever working in enterprise applications and don't even have the slightest desire to learn more low level programming, than IMO, Java or C++ are equally good investments.
Another option, which I would recommed to you (knowing more of your background) is possible building these apps as two distinct units of functionality:
1. A simple GUI interface
2. A service/daemon
You can build a Windows version quickly in VB and simply call the service/daemon/CLI.
You can implement the service using PHP and compile it to native binaries for various platforms, possibly using RoadSend or HipHop (Google HipHop):
http://www.roadsend.com/home/index.php?pageID=compiler
The GUI portion of the program merely has to facilitate easy use of the CLI service, with the added benefit of using HTTP/HTML as an interface inthe future.
Alternatively, you could use a variant of visual basic, such as RealBasic:
http://www.realsoftware.com/realstudio/
Something worth giving a quick read:
http://en.wikipedia.org/wiki/Comparison ... nd_C%2B%2B
Is it very difficult to make Java use native widgets?
I thought it wasn't common practice until yesterday, when I read of Swing, the impression I have now, is that it is possible. I have yet to find a Java application however, that doesn't have a Java "feel" to it. Whether it's because of visual cues I am not used to (being a life time Windows user) or possibly the sluggish-ness. I personally tend to stay away from Java applications, with the only exception being Eclipse.
p.s-just curious but what are you building, if I may ask? Sounds like a backup/remote storage utility app or media manager?
Cheers,
Alex
Re: Good C++ Forum?
Posted: Sun Sep 19, 2010 2:34 pm
by Eran
I didn't see any mention of C#, which is the most modern flavor of the C family of languages. Even though I started with C/C++ 8 years ago, today I would recommend people to start with a modern language such as C#, Java or Python. In my opinion you should use C/C++ only if you need to write closer to the metal or are set on a particular library / framework.
Re: Good C++ Forum?
Posted: Sun Sep 19, 2010 2:54 pm
by alex.barylski
I would personally go with C# over Java, but C# is somewhat Microsoft centric, although I realize you can probably run C# under Linux and Mac today, it still has that M$ stigma. :p
As for using Python to develop desktop Window'ed applications. Is it not a scripting language? Does it have compiler support? Do you need to configure bindings in order to utilize the Windows API? What about the X API? Those API are insane without the assistance of a advanced framework, like Qt, MFC, etc.
Cheers,
Alex
Re: Good C++ Forum?
Posted: Sun Sep 19, 2010 3:05 pm
by Eran
There are plenty of GUI frameworks for Python -
http://wiki.python.org/moin/GuiProgramming
There are even 3D engines for games -
http://wiki.python.org/moin/PythonGames
I remember there was a very long discussion on the forums previously on what defines a scripting language

let's just say that python can work as both a scripting language and a compiled one. Python is considered relatively easy to use and get started with, so depending on need it might be a better choice than Java/C/C++/C#
Re: Good C++ Forum?
Posted: Sun Sep 19, 2010 3:19 pm
by alex.barylski
Scripting language is vague, I agree. You could in theory build a JavaScript compiler. But, if they are not readily available, then obviously, in being practical, the difference of scripting and compiled come into play.
I have nothing against Python, and to be honest, it's one I have absolutely zero experience in and have not spent a lot of time reading about, other than a brief interest in DJango. It's syntax strikes me as odd, not in a bad way, just not in following the standard set by C. Grouping expressed by tabbed whitespace or something like that? Great idea, eliminates varying standards and makes the code clear and easy to read.
I have often thought the syntax of C/C++ could be improved, so I am possibly cutting myself short by not learning a new syntax, but I digress.
http://en.wikipedia.org/wiki/Python_syn ... _semantics
I like that first paragraph, if it matters any.
Cheers,
Alex
Re: Good C++ Forum?
Posted: Sun Sep 19, 2010 4:01 pm
by Jonah Bron
PCSpectra wrote:so don't be fooled into thinking you will learn it as fast as you did PHP.
Totally.
PCSpectra wrote:Define asset? What are your goals and/or career objectives?
You pretty much answered my question
PCSpectra wrote:
Another option, which I would recommed to you (knowing more of your background) is possible building these apps as two distinct units of functionality:
1. A simple GUI interface
2. A service/daemon
An interesting idea indeed. An second opinions?
PCSpectra wrote:
You can implement the service using PHP and compile it to native binaries for various platforms, possibly using RoadSend or HipHop (Google HipHop):
Wow, I had no idea that there were PHP "compilers" out there.
PCSpectra wrote:just curious but what are you building, if I may ask? Sounds like a backup/remote storage utility app or media manager?
The program will extract all picture files from a given external storage device (SD card, camera, etc.; the number of images could range from a dozen to over one-hundred), and present them to the user. The user will then select which images to group, which images to ignore, delete, etc. When the user finishes, all images are compressed and placed into compressed archives (ZIP, Tar, whatever) relative to the way the user grouped them. This application will be targeting a very specific work field.
pytrin wrote:start with a modern language such as C#, Java or Python
I'm pretty farmiliar with Python; I've created a few scripts with it... nothing ever graphical, though I've seen the GUI bindings.
pytrin wrote:let's just say that python can work as both a scripting language and a compiled one
There are Python compilers too!?
PCSpectra wrote:You could in theory build a JavaScript compiler
They practically have. V8 is a JIT compiler, right?