views:

157

answers:

4

I learned the C programming language and did my data structures class with C. What I am thinking is to learn Java. I know how the low level stuff works and people suggested that C++ is not a good language to do object oriented design. What do you think? Should I skip C++ and learn object oriented design using Java or should I first learn C++ and do object oriented design with C++ and then learn Java?

Edit: of course I am doing C++ as I am a computer science major. Sorry for the confusion. But in which order? Java first or C++ first for my object oriented design class?

+1  A: 

I would say, for coding style reasons and OOP thinking, moving from Java/.NET (while Java is more pure OOP) to C++ is much better than the other way. But there will be discussion ;)

atamanroman
A: 

TBH it really depends on what you want to do. If you think Java programming will get you to where you want to go in the future then learn it. If you think C++ will do it learn C++. Don't get too tied up in language choices though. Java has advantages and disadvantages as does C++.

I'd definitely try and learn both if I were you ...

Edit in response to the comment: Its not the best language certainly. Nor is Java. Eiffel for the OOP based win! :D Seriously though its more to do with the concepts. Never let yourself get tied down by one language or another. Learn the concepts and you will find an ability to work in any language after a short familiarisation period :)

Goz
what I am confused is the order. java first or c++ to do my object oriented design. which language is better. I am asking this because people suggested c++ is poor language to do oop
user2
+1  A: 
  • First learn a managed language like Java before learning C++.
  • Consider another language than Java, like Python, Ruby, C#.
Sjoerd
A: 

It's hard to suggest something without knowing more about what your aspirations are. If you want to become a very fluent programmer who can easily adapt to new languages, I have to recommend C++ for its multi-paradigm aspect.

If you become fluent in C++, you will not only understand object-oriented programming, but also generic programming, functional programming, procedural programming, how to implement DSELs, etc. and how all of these things can be combined harmoniously. You will also most likely have a hell of a time getting to that point; it can take a decade of constant learning to become truly experienced. The flexibility of the language also allows programmers to implement so many bad designs in addition to good ones and people often create a lot of bad code in C++ before they create good code. The basic language is fairly easy to learn, but like chess, learning to master it can take a lifetime. That's true of every programming language but I don't think there's any language for which that applies more than C++; understanding how to use it efficiently takes dramatically longer than learning the language.

Java also isn't necessarily better than C++ from an object-oriented standpoint. Just try to look up how to implement mixins or RAII in Java and you'll find that it's quite limited in such respects. There are generally no such cases for things we can do in Java that relate to OOP that cannot be done in C++ with the exception of introspection which isn't exactly related to OOP.

That said, I might sound like I'm bashing Java in favor of C++. That's not the case and Java has many attractive qualities. However, it is a less flexible language (for most people, this is for the better), so you will more likely be tied to it than if you studied C++. An experienced C++ developer is likely to be able to pick up languages that are quite different like Lisp, Haskell, Ada, Prolog, etc. much faster than a Java programmer of equal experience. Then again the C++ programmer will probably have been to hell and back, while the Java programmer was steadily productive in his work. This ability to pick up new languages be an important skill if you're interested in longevity: languages don't stay popular forever and there are always new paradigm shifts. Even C++ programmers who have been using it for decades can tell you a lot about that; the way C++ is used now is so dramatically different than how it was used 20 years ago which is very unusual for a programming language.

Also if you're really serious about programming, it never hurts to learn multiple languages. I took the time to learn lisp long after it stopped becoming popular and it taught me a lot about the languages I use daily. There are always admirable qualities you can find by studying new languages, and it really doesn't hurt to get started. Whether you want to continue with a given language for a lengthy amount of time is up to you.

I am going to do c++ but which language should I use to learn object oriented design and analysis. To be more clear I am thinking of learning object oriented design and analysis using java and move on to c++ for other courses that need c++ like some higher level elective courses.
user2