Question:
Which programming language should I learn?
There aint half been some clever
2011-01-08 21:26:06 UTC
I have been given the opportunity by my employers to learn a computer programming language. I basically have a choice between Java and C++. Could anyine give me a couple of pros and cons for these two languages to help me decide which one to go for? Is either one more prevalent or useful in the modern programming world?
Three answers:
Light Cloud
2011-01-08 23:30:00 UTC
They are both excellent languages. You didn't mention your background, so it's difficult to give targetted advice. If you haven't programmed before, I would highly recommend starting with Java first, because Java is a more forgiving and easier language to learn than C/C++. C++ is a loaded machine gun with no instruction manual attached.



C++:

+ One of the fastest languages, so C++ programs tend to run pretty fast.

+ Ubiquitous; almost every platform has a C++ compiler and so can run C++ code.

+ IMO, almost every serious programmer should know at least something about C/C++.

- Very difficult to learn

- Requires you to explicitly manage memory allocation

- The specs allow for "undefined behavior", which can sometimes only be understood by knowing how all the low-level stuff works, and errors can sometimes be mysterious and hard to debug.

- Not fully platform independent. For instance, a pointer can be 32 or 64 bits depending on the platform.



Java:

+ Easier than C++ to learn.

+ Operates on a higher level, with an automatic garbage collector so you don't need to explicitly manage memory.

+ Tends to be easier to debug. Errors like overstepping the bounds of an error result in well-defined behaviors.

+ Platform independent, for the most part anyway.

- Requires that the computer have Java installed.

- Could be a bit slower than C/C++.

- Is higher level, so you probably won't be able to do systems programming in Java.



In my opinion though, once you learn one programming language, learning a second one is a lot easier. Programming is much more about the computer science concepts, and not at all about which programming language you use.
2011-01-08 21:54:12 UTC
It can really depend what industry you're in.

C++ is widely used for games, and can do a little bit more than java as you can directly control your pointers (sorry if that just sounds like jargon). It can also be easier to mess up b/c its an unmanaged language and its not standardised.

Java is a bit more user friendly, and is standardised (ie produced by a single company, has better online help - ish), plus its managed so you wont have trouble with memory leaks and such. However its slower the C++ in high performance environments because it has to work through an extra layer of abstraction (namely the JVM).



In any case, my original statement stands, it depends what you're usig it for.
?
2016-09-16 13:20:26 UTC
He perhaps looking to say that you just ought to study programming approaches and good judgment, alternatively than languages. This quite is major, too. For illustration, being in a position to keep a talk in 15 human languages does not imply you'll be able to write an top notch paintings of literature in any of them; and a quite good written application is just like a quite good written guide, in that it demands to have many elements that are compatible in combination in non-seen however amazing methods.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...