Re: How long to learn C++ if fluent in Java?
From: Dietmar Kuehl (dietmar_kuehl_at_yahoo.com)
Date: 7 Dec 2004 02:13:32 -0800
> I am giving some thought to applying for some jobs that want people
> Java and C++ experience.
If you don't know C++ now, it is probably to late to learn it for a job
where you need to know it which is already advertised: even if you are
fluent in another programming language, it will take some time to get
fluent in *reasonable* C++, too. The thing is that in C++ you are doing
things quite differently than in Java. Actually, I'd say that the only
relation between Java and C++ is that they share a similar syntax. This
is actually rather unhelpful: the relevant foundation (the underlying
object model) of C++ does not share anything with Java's counterpart.
Essentially, C++ is value-based while Java is pointer-based (call the
Java pointers "references" if you want to but they are actually just
pointers; from a C++ perspective Java's pointers add garbage collection
but lack pointer arithmetic). The consequences are actually quite
dramatic. In particular, approaches which work reasonable in Java (I
don't think there is anything which works "well" in Java at all due to
limitations inherent in Java's design), will probably not work in C++
(... and what works well in C++ will almost certainly not be workable
at all in Java). The consequence is that you will have to unlearn many
habits of Java programming when you have your C++ hat on. It is also
very important that C++ is not an object-oriented language: it support
object-orientation but it also supports other paradigms e.g.
procedural and generic programming.
As a recommondation how to learn C++ with knowledge in another
I would recommend to read and understand the following books for a
headstart in the given order:
- "Accelerated C++" by Andrew Koenig and Barbara Moo
- "Effective C++" by Scott Meyers
- "The C++ Object Model" by Stan Lippmann
These three books are, IMO, essential to learning C++. These mostly
address the core language but it is also important to understand the
standard library, in particular the portion refered to as "STL"
(which is actually about "concepts": these concepts are used to realize
highly efficient algorithms in terms of iterators accessing containers;
many people, errorneously take exactly the opposite perspective putting
containers at the heart and consequently don't understand what STL is
all about). There is no book I'm aware of which is the single most
appropriate and complete book covering the language but these are a
good choice to learn about it:
- "The Standard C++ Library" by Nicolai Josuttis
- "Generic Programming" by Matt Austern
- "IOStreams and Locales" by Angelika Langer and Klaus Kreft
Nico's book covers the whole standard library while the others cover
only a selected portion (STL and IOStreams/locales, respectively) but
go into much more depth.
The books mentioned so far will give you a solid *foundation* to start
from. To become an efficient professional working with C++ you will
probably also want to read:
- "More Effective C++" by Scott Meyers
- "Exceptional C++" by Herb Sutter
- "More Exceptional C++" by Herb Sutter
- "Exceptional C++ Style" by Herb Sutter
- "Large Scale C++" by John Lakos
- "C++ Templates" by Nicolai Josuttis and David Vandevoorde
- "Modern C++" by Andrei Alexandrescu
Somebody in this thread mentioned that about a week would do to learn
C++. Well, after that time you will be able to create programs which
do what you want but probably only for relatively minor tasks. To be
ready for real production development I'd rather estimate at least
half a year of relatively instensive working with C++. Of course, I'd
expect something like this to become comfortable and accustomed to
the language specific idioms for other languages, too.
-- <mailto:email@example.com> <http://www.dietmar-kuehl.de/> <http://www.contendix.com> - Software Development & Consulting