Re: How long to learn C++ if fluent in Java?

From: Dietmar Kuehl (dietmar_kuehl_at_yahoo.com)
Date: 12/07/04


Date: 7 Dec 2004 02:13:32 -0800

Rhino wrote:
> I am giving some thought to applying for some jobs that want people
with
> 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
language,
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:dietmar_kuehl@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting


Relevant Pages

  • Re: The Java no pointer big fat lie!
    ... > reference types, it wouldn't be a good comparison. ... and what you can't - and there is a big difference in Java to C and C++. ... You cannot change it in the language itself, ... Thus I would distinguish pointers from ...
    (comp.lang.java.programmer)
  • Re: Another Newbie Question: C or C++
    ... regardless of the language they use. ... Java, but it's not the best language to start with for understanding ... wish I knew a good starter one, but it's been a while...can try Deitel ... books, but they DO provide pretty decent overall coverage. ...
    (freebsd-questions)
  • Re: Learning perl - for experienced programmers
    ... The books are cheap. ... They're more the "ease your way into programming and perl" type ... examples of hideous and unmaintainable Java code there's plenty I'm ... A language is only as bad as the ...
    (comp.lang.perl.misc)
  • Re: Whats the use of an interface
    ... I know people who found Sun's books to be excellent, ... One helpful resource I found was Roedy Greene's Java section ... of several of the trickier 'gotchas' with the Java language is there, ... Randolf Richardson - kingpin+nntp@xxxxxxxxxxxxxxx ...
    (comp.lang.java.programmer)
  • Re: Listing the most dangerous parts of C
    ... 8 C functions suffer from format string vulnerabilities ... Java is a language allows you to understand what it *does* very clearly. ... Making C more like Java is just as easily achieved by throwing it out and starting with Java. ... passing pointers tends to more dangerous in general for some cases. ...
    (comp.lang.c)