views:

192

answers:

8

I am ActionScript 3/Flex programmer, it is the first language I learned.

I want to learn either Java or C++.
Would one of these be easier to learn based on my current knowledge?

A: 

I would go with Java. It will be easier to learn and, given your background, I'm guessing you do more web/internet work in which case you'll probably find more ways to apply the Java knowledge then you would C++.

James Conigliaro
+3  A: 

It really depends what you want to do. C++ is more powerful and fast. But Java has a smaller learning curve.

I'd say learn C++, only because it will require you to gain a better understanding of how computers work under the hood. It will also help position you to learn Java, C#, or any other language down the road.

Nate Bross
If i decide to learn C++, I was thinking to use eclipse for C++ since I am already familiar with eclipse, or would it be better to just use VS for C++? Thanks for the info.
John Isaacks
Personally, I think that Visual Studio is far better than Eclipse; however, I've only used Eclipse for Java development. I'd try out Visual C++ Express http://www.microsoft.com/express/
Nate Bross
Ecliple and Java are great friends. For C++, I agree with Nate Bross that VC++ Express is nice.
Brian
A: 

Java seems more likely to be directly relatable to your work in AS3; C++ is better for giving you a grounding in a different technology (pointer-style OO rather than object-style. C++ may feel eerily similar yet different).

If you are doing C-ish C++, the pointer language learning process can be very informative as to how OS-level calls are written...

The places where you will reach for one tool or the other are very different, and the use you have for the tool may be more important in deciding than their relative merits as languages - employability IS a use for a tool, after all.

Tetsujin no Oni
+1  A: 

Well, AS3 more closely resembles JavaScript - they both follow the ECMAScript specification.

But to answer your question, I would say learning Java will be more beneficial and easier for you. Java supports Interfaces, and single inheritance, like Flex, whereas C++ supports multiple inheritance and lacks a formal notion of Interfaces. Java and Flex both manage memory for you, whereas C++ forces you to manage your own memory. Both Java and Flex have large helper libraries out of the box, and both have native String types, whereas C++ forces you to find a library to use and doesn't support native String types.

This may be my own bias, but it also seems more likely that you'll find a job that is looking for a Flex/Java developer, rather than a Flex/C++ developer. Java and Flex seem to work well together, with Flex as a front end and Java as a middle and back end.

Hooray Im Helping
Great info, It sounds like Java may be more right for me, I do like the idea of multiple inheritance though. That seems very strange that C++ doesn't have a native String data type.
John Isaacks
C++ is mostly upward-compatible with C (at least pre-1999 C), and therefore a quoted string literal is not a string type in a particularly useful sense. C++ does have a string class (std::string) that is quite useful, and a std::string can be initialized or assigned from a quoted string literal.
David Thornley
@David Thornley I'm not a whiz at C++ - but don't you have to include the <string> header in c++ to get access to the string class? Does this mean that C++ string types are native or not? Not trying to be argumentative, but if I'm incorrect I'll change that part of my answer.
Hooray Im Helping
A: 

I would say Java is more similar to AS3 than C++. You will find lots of familiar metaphors and mechanisms. C++ on the other hand, will require more effort to learn. It is closer to the machine and demands an undertanding of lower level mechanisms. For instance, there is no garbage collection so you have to manage your memory resources yourself.

Which is better to know depends on what you plan to do with the language. C++ is good at performance critical applications (games, all kinds of real time simulations etc.). Java makes it easier and safer to build things, but at the cost of performance.

hope this helps

regards

david h
Why do people still think Java has performance problems? http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/
Nosredna
sorry, you are right. I was thinking of my domain of work (procedural interactive animation) where C++ has an edge over Java. I should have been more specific.
david h
+1  A: 

C++ is, generally, harder to learn than Java. You will find this true pretty much no matter what your previous experience. Therefore, if you want to learn the easier, learn Java.

(This is partly a matter of design philosophy. C++ was designed to be mostly upward compatible from C, at least the C at the time C++ was being designed. It was also designed to be useful and permissive, with ease of learning being secondary. Java was designed partly as a reaction to C++, as a generally safer and easier language. C++ is more expressive than Java, but this comes at a price: it's harder to learn C++, and easier to screw up with it.)

That being said, you never said why you wanted to learn another language. You might well be better off learning C++, even though it is more difficult.

David Thornley
A: 

I think you would find Java more similar.

Learning C++ will likely require you to learn concepts that you could avoid with other high level languages (such Java and AS3) e.g. manual memory management, pointers, non forward looking compiler, multiple inheritance, etc.

Nick
A: 

Whatever you'll finally decide to learn, do yourself a favor and read either Thinking in Java or Thinking in C++.

Both books are available - for free! - at Bruce Eckels website. They are very, very good.

C++ is more complex than Java so I'd suggest to take a look at Java, first.
However, this isn't meant as C++ bashing. Both are great language, it just depends on what you'd like to do in the end.

Huxi