tags:

views:

544

answers:

10

I consider myself an experienced Java developer and am planning to get started with learning C++.

If you had same experience, i.e learn C++ after Java, I would like to hear your thoughts on what is the best approach at doing this.

[Update] "the best approach" was not well quantified. What I am looking for is to leverage my existing java knowledge and programming experience so that I can quickly ramp up on C++.

+5  A: 

I would start with Effective C++ and More Effective C++ by Scott Meyers. These two books go over some really good best-practices for C++.

http://www.aristeia.com/books.html

Andy White
+12  A: 

I've taught C++ to Java people, even though I learned them the other direction.

Are you comfortable with C? If not, read Kernighan and Ritchie. Many many peculiarities of C++ are explained by the desire for C++ to be a "Better C" with C's basic expression syntax.

You should get Stroustrup.

I think well of Thinking in C++ by Bruce Eckels.

I've used The C++ FAQ Book, by Cline, Lomow, and Girou; I refer to it pretty often. Marshall Cline has C++ FAQ content on his site, too.

Update

You might also look at C++ for Java Programmers. I don't know the book but it looks decent.

Charlie Martin
Try Effective c++ series with Stroustrup concurrently
yesraaj
A: 

Andy and Charlie already gave you the books, so I will indicate the boost libraries and the Qt framework.

Boost gives you some basic functions to work with so you don't need to create everything from scratch.

Qt, as you may know, is a GUI framework, and I find it very enjoyable to use. There is a book called "C++ GUI Programming With Qt 4" that covers all the important topics to learn Qt.

Renato Besen
+6  A: 

My proposal would be to write highly pointer-based thing, like a linked list library, BST library, etc. The code should be STL-free, similar to pure C. You should build application using such library (eg. sort algorithms?) and learn how to deal with all the pitfalls which will for sure come up, if it's your first C/C++ code.

In my opinion the most important fundamental in knowing C++ is to understand pointers and low level memory representation of classes and structures. It's like an enlightenment after which everything is simple and clear ;)

Yes, implementing data structures from scratch is a good way to learn about pointers, explicit memory (de)allocation etc.
javashlook
A: 

This is going to sound a little funny, but you asked for the best way, not the quickest. I'd suggest you start by learning C first, before you learn C++. Kernighan and Ritchie is one of the best language books ever written. When you know C and Java, you'll be able to write good, clear programs in a sensible subset of C++ with almost no additional effort.

Norman Ramsey
What would be the "quickest" way then?
Journeyman Programmer
+2  A: 

Others have already specified the required books. I would like to add just couple of points to be noted: ( as background is java)

  • C++ doesnot provide you the Garbage collection ( as in Java). Hence, you must be very perticular about memory leaks. Always use delete the memory allocated on heap using new. Try to remember the Free-Store management in FAQ while writing the C++ applications.
  • Most often in C++ you may have to work with pointers ( missing in Java). Learn pointers ( books suggested by @Charlie Martin) effectively and use them.
  • One you are familiar with C++, learn the basics of STL and use effectively. ( Book By Josuttis and Scott Meyers)

Good luck.

aJ
+2  A: 

I strongly disagree with learning C first, and with trying tgo learn C++ from the Effective books, excellent though they are. Instead, get hold of a copy of Accelerated C++ by Andrew Koenig and Barabra Moo - this is written by two of the original C++ development group and will teach you how to use modern C++ features.

anon
For a dissenting view see http://www.idinews.com/KoenigRvw.html
Norman Ramsey
Hmm, I don't see how saying a book is excellent and that he enthusiastically recommends it dissents from my recommendation.
anon
+1  A: 
eed3si9n
A: 

"C++ for Java Programmers" by Mark Allen Weiss is a good intro book for seasoned Java programmers.

Journeyman Programmer
A: 

Learn Qt. Trust me on this; I'm both a Java and C++ developer; I can tell you Qt makes C++ language closer to Java. Don't just learn the bare-bone C++.

C++ with Qt makes you infinitely more productive. I used to combine so many different libraries (Boost, Intel's, database connectors, etc..) just to achieve the kind of stuff we do (high-performance/real-time computing). At the end, I found that more than 80% of what I need is already included in Qt.

Not to mention, imo, Qt has the best documentation on any framework/library I've worked on, which makes it very easy to just learn everything on your own.

Try it, and see for yourself.

Disclaimer: I'm just a developer--I dont work for Nokia. =p

ShaChris23