Myths and Truths Comparing C++ and Java
A quote from an interview with George Paolini, Director of Corporate
Marketing at JavaSoft, published in JavaREPORT 5/98:
Q:
When will Java win over the C++ developers once and for
all ?
A:
I think we're winning them over now. On the programming language
side, C++ programmers are probably the most adept at picking up Java. For
them it's basically about leaving out a lot of the trapdoors that were
developed in C++ and unlearning a lot of bad habits.
This and other statements which advertise Java as a "simplified
C++" created the myth that C++ programmers would almost automatically master
Java. The reality, in contrast, shows that Java opens quite a number of
trapdoors especially to Java programmers with a strong C++ background.
The reason for this is the fact that Java shares most of the syntax
and numerous concepts with C++, and exactly this property misleads former
C++ programmers. Language constructs that are syntactically identical in
Java and C++ have entirely different semantics in both languages. Typical
examples are assignment and comparison of objects: they are syntactically
identical, but exhibit different behavior in both languages. The construction
of objects differs in subtle ways between C++ and Java. Reference variables
in Java look like C++ references, but behave like C++ pointers. In addition,
it turns out that common C++ idioms such as value semantics, const-correctness,
or resource management techniques cannot be transported to Java.
Based on several years of practical Java experience, this tutorial
aims to shed some light on obstacles and misunderstandings that come up
during the transition from C++ to Java. This is not a talk about the fact
the Java lacks templates and that C++ lacks garbage collection, but about
the subtle differences between Java and C++. Considering that many C++
idioms are not suitable for Java programming, the tutorial also explains
corresponding Java idioms, and how they relate to the respective C++ idioms. |
|
PREREQUISITES
|
|
Level:
|
intermediate |
Duration:
|
2 hours |
Prerequisites:
|
Attendants should have practical experience with C++, some
basic knowledge of Java, and an interest in exploring the differences that
come up in practice. |
Presented at:
|
Application Development
'99
, London, UK, July 1999
C++ World '99
, Miami,
FL, December 1999
OOP 2000
, Munich, Germany,
January 2000
DevWeek Europe 2000
, London,
UK, Feburary 2000 |
If you are interested to hear more about this
and related topics you might want to check out the following seminar or
skim through some further reading:
|
|
Seminars
|
Paper
|
|