By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,247 Members | 1,287 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,247 IT Pros & Developers. It's quick & easy.

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

P: n/a
I am giving some thought to applying for some jobs that want people with
Java and C++ experience. I have been writing Java for several years and am
fluent enough that I don't have to get help with Java very often. I have no
real C++ experience and not much C experience for that matter.

However, the core Java statements are "borrowed" from C and C++ has often
been called "C with classes". It seems to me that it shouldn't take very
long to get up to speed on C++ if I am already fluent with Java and have at
least some knowledge of C. Then again, I understand that Java and C++ use
classes a bit differently; for instance C++ allows multiple inheritance
while Java allows only single inheritance but allows for multiple interfaces
as compensation. I'm not sure how long it would take to get fluent with
multiple inheritance after several years with Java.

I'd be very curious to know how long it took people here who were fluent in
Java to get fairly fluent in C++ if they started with approximately the same
skills I have today.

--
Rhino
---
rhino1 AT sympatico DOT ca
"There are two ways of constructing a software design. One way is to make it
so simple that there are obviously no deficiencies. And the other way is to
make it so complicated that there are no obvious deficiencies." - C.A.R.
Hoare
Jul 22 '05 #1
Share this Question
Share on Google+
30 Replies


P: n/a
Rhino wrote:
I am giving some thought to applying for some jobs that want people with
Java and C++ experience. I have been writing Java for several years and am
fluent enough that I don't have to get help with Java very often. I have no
real C++ experience and not much C experience for that matter.

However, the core Java statements are "borrowed" from C and C++ has often
been called "C with classes". It seems to me that it shouldn't take very
long to get up to speed on C++ if I am already fluent with Java and have at
least some knowledge of C. Then again, I understand that Java and C++ use
classes a bit differently; for instance C++ allows multiple inheritance
while Java allows only single inheritance but allows for multiple interfaces
as compensation. I'm not sure how long it would take to get fluent with
multiple inheritance after several years with Java.

I'd be very curious to know how long it took people here who were fluent in
Java to get fairly fluent in C++ if they started with approximately the same
skills I have today.

C++ supports 4 paradigms. The Object Oriented paradigm, the procedural
paradigm, the modular paradigm (namespaces) and the generic programming
paradigm (templates). Each paradigm is supported *well*, with optimal
space and time efficiencies.
The "well" part means that in OO for example, single and multiple
inheritance are supported (including that of interfaces), virtual
inheritance, virtual bases etc.
This means that it is a large language (I guess something like 4
languages in one), and will take time to learn.
However you do not need to know the entire language to begin writing
applications (myself have not finished it yet).
Since you have some programming background the best way to start is the
book "Accelerated C++" by Andrew Koenig, Barbara Moo.
You may also check http://www.accu.org for book reviews.


--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #2

P: n/a
Rhino wrote:
I am giving some thought to applying for some jobs that want people with
Java and C++ experience. I have been writing Java for several years and am
fluent enough that I don't have to get help with Java very often. I have no
real C++ experience and not much C experience for that matter.

However, the core Java statements are "borrowed" from C and C++ has often
been called "C with classes". It seems to me that it shouldn't take very
long to get up to speed on C++ if I am already fluent with Java and have at
least some knowledge of C. Then again, I understand that Java and C++ use
classes a bit differently; for instance C++ allows multiple inheritance
while Java allows only single inheritance but allows for multiple interfaces
as compensation. I'm not sure how long it would take to get fluent with
multiple inheritance after several years with Java.

I'd be very curious to know how long it took people here who were fluent in
Java to get fairly fluent in C++ if they started with approximately the same
skills I have today.


There was that philosopher, Diogenes, who lived in a huge barrel somewhere
not too far from Athens. And he was known as a very smart guy. And once
upon a time a man was passing Diogenes' barrel and asked him, "Tell me, o
wise man, how long a walk to Athens?" Diogenes answered, "Go!". The man
thought he heard it wrong and asked again, "I want to know how long I will
need to reach Athens" Diogenes again said, "Start walking, go!". Then the
man shrugged, and started walking away in the general direction of Athens.
After the man has made several dozen paces, Diogenes shouted, "Two and
an half days!". The man stopped, turned around and asked very
irritatedly, "Couldn't you just tell me that earlier?" "No", answered
Diogenes, "I didn't know how fast you were going to walk".

How can anybody can answer the question how long it will take _you_ to
learn C++? It's basically an attempt to predict the future without any
relevant information.

And, here is another point: don't ask how long it would take as if you're
deciding whether to take that route or not. If you feel that knowing C++
is essential for your career, start learning it NOW! I made my decision
more than 12 years ago and I am still learning. On the way I picked up
Java, Python, and several other languages I didn't know twelve years ago.
What does it tell you WRT how long it will take you to get there? Nothing
if you think about it.

Just my $0.02

V
Jul 22 '05 #3

P: n/a

"Victor Bazarov" <v.********@comAcast.net> wrote in message
news:tc******************@newsread1.dllstx09.us.to .verio.net...
Rhino wrote:
I am giving some thought to applying for some jobs that want people with
Java and C++ experience. I have been writing Java for several years and am fluent enough that I don't have to get help with Java very often. I have no real C++ experience and not much C experience for that matter.

However, the core Java statements are "borrowed" from C and C++ has often been called "C with classes". It seems to me that it shouldn't take very
long to get up to speed on C++ if I am already fluent with Java and have at least some knowledge of C. Then again, I understand that Java and C++ use classes a bit differently; for instance C++ allows multiple inheritance
while Java allows only single inheritance but allows for multiple interfaces as compensation. I'm not sure how long it would take to get fluent with
multiple inheritance after several years with Java.

I'd be very curious to know how long it took people here who were fluent in Java to get fairly fluent in C++ if they started with approximately the same skills I have today.


There was that philosopher, Diogenes, who lived in a huge barrel somewhere
not too far from Athens. And he was known as a very smart guy. And once
upon a time a man was passing Diogenes' barrel and asked him, "Tell me, o
wise man, how long a walk to Athens?" Diogenes answered, "Go!". The man
thought he heard it wrong and asked again, "I want to know how long I will
need to reach Athens" Diogenes again said, "Start walking, go!". Then the
man shrugged, and started walking away in the general direction of Athens.
After the man has made several dozen paces, Diogenes shouted, "Two and
an half days!". The man stopped, turned around and asked very
irritatedly, "Couldn't you just tell me that earlier?" "No", answered
Diogenes, "I didn't know how fast you were going to walk".

How can anybody can answer the question how long it will take _you_ to
learn C++? It's basically an attempt to predict the future without any
relevant information.

And, here is another point: don't ask how long it would take as if you're
deciding whether to take that route or not. If you feel that knowing C++
is essential for your career, start learning it NOW! I made my decision
more than 12 years ago and I am still learning. On the way I picked up
Java, Python, and several other languages I didn't know twelve years ago.
What does it tell you WRT how long it will take you to get there? Nothing
if you think about it.

Just my $0.02

Your point is well taken, even if it isn't very helpful. Yes, you are right,
you know nothing about me so you can't estimate accurately how long it would
take _me_ to learn C++.

I was really just looking for a generalization to get an idea of whether
this would be a difficult task or something that was relatively easy given
what I already know. I wasn't looking for an estimate that was accurate to
within 10 minutes. I suppose I should have made that clearer, although I
think most people would understand the sense of my question without having
to spell that out.

Rhino
Jul 22 '05 #4

P: n/a
Rhino wrote:
I was really just looking for a generalization to get an idea of whether
this would be a difficult task or something that was relatively easy given
what I already know. I wasn't looking for an estimate that was accurate to
within 10 minutes. I suppose I should have made that clearer, although I
think most people would understand the sense of my question without having
to spell that out.

It is not difficult, however it will take you enough time, since it is
more powerful language and provides more features.

An example is being able to read an object of whatever type as a
sequence of characters (unsigned chars = bytes) and print it character
by character.
After all, JVM is written in C++. :-)
However as I said in another message, you do not need to know the whole
language to begin writing applications.


--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #5

P: n/a

"Ioannis Vranos" <iv*@remove.this.grad.com> wrote in message
news:1102371038.685074@athnrd02...
Rhino wrote: After all, JVM is written in C++. :-)


or C++--

Jonathan
Jul 22 '05 #6

P: n/a
Ioannis Vranos wrote:
It is not difficult, however it will take you enough time, since it is
more powerful language and provides more features.

An example is being able to read an object of whatever type as a
sequence of characters (unsigned chars = bytes) and print it character
by character.
After all, JVM is written in C++. :-)
However as I said in another message, you do not need to know the whole
language to begin writing applications.

Also check this:

http://www23.brinkster.com/noicys/learningcpp.htm


--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #7

P: n/a
"Rhino" <rh****@NOSPAM.sympatico.ca> wrote in message
news:fi********************@news20.bellglobal.com. ..
I am giving some thought to applying for some jobs that want people with
Java and C++ experience. I have been writing Java for several years and am
fluent enough that I don't have to get help with Java very often. I have no real C++ experience and not much C experience for that matter.

However, the core Java statements are "borrowed" from C and C++ has often
been called "C with classes". It seems to me that it shouldn't take very
long to get up to speed on C++ if I am already fluent with Java and have at least some knowledge of C. Then again, I understand that Java and C++ use
classes a bit differently; for instance C++ allows multiple inheritance
while Java allows only single inheritance but allows for multiple interfaces as compensation. I'm not sure how long it would take to get fluent with
multiple inheritance after several years with Java.

I'd be very curious to know how long it took people here who were fluent in Java to get fairly fluent in C++ if they started with approximately the same skills I have today.


No really good answer is possible without knowing what skills you have
today.
However, I have found students who knew C++ fairly well learned Java fairly
well in about a year. It was on the order of six months to learn Java and
how to cobble together a program that actually did something, and another
six months to refine their understanding and eliminating the C++ knowledge
they had from the Java knowledge. I suspect it will work similarly the other
direction. There is just enough difference between the two languages to
cause problems for someone who wishes to learn both.

To become proficient in either probably takes years unless all you spend
your time on is exploring classes, libraries, etc.
--
Gary
Jul 22 '05 #8

P: n/a
Rhino wrote:
Your point is well taken, even if it isn't very helpful.
Yes, you are right, you know nothing about me
so you can't estimate accurately how long it would take _me_ to learn C++.
A week.
It shouldn't take you more than a week to learn C++.
It takes about as much time to learn C++
as it takes to read a textbook on C++ cover-to-cover.
Most computer science students taking a course on programming languages
get about a week to learn each new language if they are lucky.
Java is smalltalk disguised as C++.
C++ is *not* Java.
You will need to *unlearn* some of Java
before you can progress in C++.
But both Java and C++ are imperative computer programming languages
so much of what you learned to do with Java
will transfer to C++.
I was really just looking for a generalization
to get an idea of whether this would be a difficult task
or something that was relatively easy given what I already know.
I wasn't looking for an estimate that was accurate to within 10 minutes.
I suppose I should have made that clearer,
although I think most people would understand
the sense of my question without having to spell that out.


It might also help if you can learn to be patient
with people who are trying to help you.
Jul 22 '05 #9

P: n/a

I don't know what everyone else thinks, but I think the areas you'd have the
most fun with will be resource management (say goodbye GC - hello memory
leaks!) since you will have to know the implications of pointers to objects,
references to objects and value objects - there's no automatic reference
counting of your resources in C++.

Oh - and introductions to the 'const' keyword are in order - a close
personal friend of mine for the last ten years - sorely missed in my Java
experience - he'll be delighted to meet you!

And Templates! - Once you start looking into Templates - well! You'll wonder
how you ever lived without them!

Not that I'm biased, but I reckon you'll have more fun learning C++ than
most C++ developers have learning Java!

In short - 21 days.

(that's what it'll say on the cover of the book anyway :-)

"Rhino" <rh****@NOSPAM.sympatico.ca> wrote in message
news:fi********************@news20.bellglobal.com. ..
I am giving some thought to applying for some jobs that want people with
Java and C++ experience. I have been writing Java for several years and am
fluent enough that I don't have to get help with Java very often. I have
no
real C++ experience and not much C experience for that matter.

However, the core Java statements are "borrowed" from C and C++ has often
been called "C with classes". It seems to me that it shouldn't take very
long to get up to speed on C++ if I am already fluent with Java and have
at
least some knowledge of C. Then again, I understand that Java and C++ use
classes a bit differently; for instance C++ allows multiple inheritance
while Java allows only single inheritance but allows for multiple
interfaces
as compensation. I'm not sure how long it would take to get fluent with
multiple inheritance after several years with Java.

I'd be very curious to know how long it took people here who were fluent
in
Java to get fairly fluent in C++ if they started with approximately the
same
skills I have today.

--
Rhino
---
rhino1 AT sympatico DOT ca
"There are two ways of constructing a software design. One way is to make
it
so simple that there are obviously no deficiencies. And the other way is
to
make it so complicated that there are no obvious deficiencies." - C.A.R.
Hoare

Jul 22 '05 #10

P: n/a
The interesting difference between Java and C++ is that in Java, you
spend about 3 days learning the "Language", and then the rest of your
life learning the "Library". C++ has a lot of history behind it, and is
very complicated. It will probably take you longer to get used to the
language then it did for Java. In C++ you will spend a lot of time
learning small things like implementation-less declarations, memory
leaks, and syntax, and a little longer getting used to things like
multiple inheritence. I don't suppose you have any C background, do
you? If you did, it would be a snap.

By the way, the Java Virtual Machine is no longer there to baby-sit
you...no offense implied (Java was my first language too)
~(but then what do I know?)

Jul 22 '05 #11

P: n/a
adbarnet wrote:
I don't know what everyone else thinks, but I think the areas you'd have the
most fun with will be resource management (say goodbye GC - hello memory
leaks!) since you will have to know the implications of pointers to objects,
references to objects and value objects - there's no automatic reference
counting of your resources in C++.

He can use RAII which works everywhere. And also memory is not the only
resource than can leak, and RAII manages all kinds of resources.
Also it depends on the platform. For example I am programming in .NET
which is a VM environment.

He could also plug in a third party GC engine if he had the need to.

However RAII is important even in VM environments, in .NET (and in the
advent of C++/CLI), it is called "deterministic destruction".


--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 22 '05 #12

P: n/a
Geo

E. Robert Tisdale wrote:
Rhino wrote:
Your point is well taken, even if it isn't very helpful.
Yes, you are right, you know nothing about me
so you can't estimate accurately how long it would take _me_ to learn C++.

A week.
It shouldn't take you more than a week to learn C++.
It takes about as much time to learn C++
as it takes to read a textbook on C++ cover-to-cover.
Most computer science students taking a course on programming languages get about a week to learn each new language if they are lucky.
Java is smalltalk disguised as C++.
C++ is *not* Java.
You will need to *unlearn* some of Java
before you can progress in C++.
But both Java and C++ are imperative computer programming languages
so much of what you learned to do with Java
will transfer to C++.
I was really just looking for a generalization
to get an idea of whether this would be a difficult task
or something that was relatively easy given what I already know.
I wasn't looking for an estimate that was accurate to within 10

minutes. I suppose I should have made that clearer,
although I think most people would understand
the sense of my question without having to spell that out.


It might also help if you can learn to be patient
with people who are trying to help you.


A WEEK!!!!! why delude him.... a decade maybe.... or do you consider a
vague notion of the syntax to be enough to be fluent in a language,
perhaps you are deluded yourself, but I'll give you the benefit of the
doubt and assume you were just taking the piss.

Jul 22 '05 #13

P: n/a
I would recommend "Accelerated C++". It assumes a fairly astute reader
but it will guide you through the major pitfalls, of which there are
many. You also should get a good library reference like Josuttis "The
C++ Standard Library". The C++ standard library is very different to
the Java class library. But learning it will help you to write good
"modern style" C++. Oh, and get all the Meyers books. Armed with that
lot you should be able to make intermediate level in about a year :-)

The main issues you will have are:

1. C++ does not have a huge standard class library like Java. You need
3rd party libs for networking, thread, GUI etc.
2. Objects can be created on the stack as well as the heap. In Java
they are only on the heap.
3. Memory management. Probably the single biggest hurdle for Java
programmers. You will be amazed at the reams of advice available on how
to manage memory, and then you will realize how spoiled you were with
Java :-)
4. Generic programming with templates. The C++ library uses templates
heavily. There is no direct comparison in Java (not even in JSE 5.0)
5. Getting used to the syntax. C++ can look virtually unreadable to a
Java programmer. Check out the source to the C++ library to see what I
mean.
6. Unfriendly compile errors, especially with templates
7. The preprocessor. No equivalent in Java.
8. There is no C++ IDE as good as Eclipse :-(

--
Martin

Jul 22 '05 #14

P: n/a
I suppose the term "easy to learn, hard to master" sums it up really well.
It won't take you too long to write your first program if you work through
a book about the language basics.
However, to really *know* the language, to write efficient, large scaled and
stable code, well, I don't think that will happen anytime soon. I can only
speak for myself here, but the more I read about C++, the more I have the
impression I know very little about it. And I have learned for roughly 5
years now.

By the way, since at university the primary language is Java, I had the same
problem the other way round. However I would imagine that already knowing
C++ and learning Java afterwards is easier than knowing Java and learning
C++. C++ is the far bigger and complete language (well, it's way older than
Java), is more flexible and has far more possibilities to realize a
specific problem, each with its own advantages and disadvantages, whereas
in Java you mostly have one language structure to fullfill a specific task
and you have to stick with it (which is less error prone, but also less
flexible).

Overall I'd say, C++ is well worth the time you'll need to learn it. In my
eyes it's the most powerful and flexible language available, and on top of
that, it's extremely well known and nearly a standard in the industry.

That's just my 2 ?-Cent :)

Rhino wrote:
I am giving some thought to applying for some jobs that want people with
Java and C++ experience. I have been writing Java for several years and am
fluent enough that I don't have to get help with Java very often. I have
no real C++ experience and not much C experience for that matter.

However, the core Java statements are "borrowed" from C and C++ has often
been called "C with classes". It seems to me that it shouldn't take very
long to get up to speed on C++ if I am already fluent with Java and have
at least some knowledge of C. Then again, I understand that Java and C++
use classes a bit differently; for instance C++ allows multiple
inheritance while Java allows only single inheritance but allows for
multiple interfaces as compensation. I'm not sure how long it would take
to get fluent with multiple inheritance after several years with Java.

I'd be very curious to know how long it took people here who were fluent
in Java to get fairly fluent in C++ if they started with approximately the
same skills I have today.


Jul 22 '05 #15

P: n/a
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:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting

Jul 22 '05 #16

P: n/a
"Dietmar Kuehl" <di***********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Rhino wrote:
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.<<giant snip>>


What you say in the rest is quite reasonable, but this "call the Java
pointers "references" if you want to but they are actually just pointers;
from a C++ perspective" is wrong and misleading. Java just doesn't have
pointers. Period.
The two biggest differences I find students have the problems with are the
many "types" C++ has versus the nine that Java has, and the difference in
exception handling. Java may simplify too much (and is remedying that by
adding boxing and making everything an object), but C++ gets confusing with
all the portability built into the implementation instead of an
language/interpreter. Of course, C++ is more useful and produces tighter
code if you strip it down.
--
Gary
Jul 22 '05 #17

P: n/a
On Tue, 7 Dec 2004 08:52:00 -0500, "Gary Labowitz"
<gl*******@comcast.net> wrote:
What you say in the rest is quite reasonable, but this "call the Java
pointers "references" if you want to but they are actually just pointers;
from a C++ perspective" is wrong and misleading. Java just doesn't have
pointers. Period.


In C++ terminology, Java references behave like pointers - they can be
null, you can assign new values to them, etc. A procedure with a
reference parameter in Java behaves like a procedure with a pointer
parameter in C++ in that you can modify the value of the pointed to
object, but changes to the "pointer" itself don't propogate back to
the calling procedure.

Finally, the Java NullPointerException rather gives the game away!

Certainly all the Java developers I know who have some C or C++
background think of Java references as pointers...

Tom
Jul 22 '05 #18

P: n/a
then you miss the point entirely his answer is the MOST HELPFUL one can
could possibly get. GO!!! Start learning NOW! if you think it is
important, if not don't.

Jul 22 '05 #19

P: n/a
"Tom Widmer" <to********@hotmail.com> wrote in message
news:ss********************************@4ax.com...
On Tue, 7 Dec 2004 08:52:00 -0500, "Gary Labowitz"
<gl*******@comcast.net> wrote:
What you say in the rest is quite reasonable, but this "call the Java
pointers "references" if you want to but they are actually just pointers;
from a C++ perspective" is wrong and misleading. Java just doesn't have
pointers. Period.
In C++ terminology, Java references behave like pointers - they can be
null, you can assign new values to them, etc. A procedure with a
reference parameter in Java behaves like a procedure with a pointer
parameter in C++ in that you can modify the value of the pointed to
object, but changes to the "pointer" itself don't propogate back to
the calling procedure.

Finally, the Java NullPointerException rather gives the game away!

Ah, but that's just what it's called. The real question is: What is it? (See
Alice Through the Looking Glass chapter with the White Knight for details on
the difference put in a nice way.)
Certainly all the Java developers I know who have some C or C++
background think of Java references as pointers...


Yes, I know. And some C++ programmers think of passing by reference as a
"pointer" under the hood. Still, there is no requirement that implementation
use pointers to support references in either language. They could just as
easily be handles used to look up resources that control the variables.
Anyway, it's one of those areas where the term has lost precise meaning and
causes a lot of head scratching ... and bar brawls.
--
Gary
Jul 22 '05 #20

P: n/a
E. Robert Tisdale wrote:
Rhino wrote:
Your point is well taken, even if it isn't very helpful.
Yes, you are right, you know nothing about me
so you can't estimate accurately how long it would take _me_ to
learn C++.
A week.
It shouldn't take you more than a week to learn C++.
It takes about as much time to learn C++
as it takes to read a textbook on C++ cover-to-cover.
Most computer science students taking a course on programming languages get about a week to learn each new language if they are lucky.
Java is smalltalk disguised as C++.
C++ is *not* Java.
You will need to *unlearn* some of Java
before you can progress in C++.
But both Java and C++ are imperative computer programming languages
so much of what you learned to do with Java
will transfer to C++.


I cannot tell whether this is a joke or not. Whether or not most
computer science students "get about a week to learn each new
language", they do not actually end up learning the languages. I doubt,
for example, that the average student learns how to leak memory in
Java, and how to avoid it, or how to release resources properly in the
presense of exceptions in C++.

In any case, the original poster has already had a job. For him, when
he says he knows a language, it is expected that he has written a real
application in it, not that he solved the 8 Queens problem in it. 8
Queens will be the same in any imperative language, but string
operations, I/O, error handling, standard containers, memory
management...

--
Dave O'Hearn

Jul 22 '05 #21

P: n/a
Dave O'Hearn wrote:
E. Robert Tisdale wrote:
Rhino wrote:

Your point is well taken, even if it isn't very helpful.
Yes, you are right, you know nothing about me
so you can't estimate accurately how long it would take _me_ to

learn C++.
A week.
It shouldn't take you more than a week to learn C++.
It takes about as much time to learn C++
as it takes to read a textbook on C++ cover-to-cover.
Most computer science students taking a course on programming


languages
get about a week to learn each new language if they are lucky.
Java is smalltalk disguised as C++.
C++ is *not* Java.
You will need to *unlearn* some of Java
before you can progress in C++.
But both Java and C++ are imperative computer programming languages
so much of what you learned to do with Java
will transfer to C++.


I cannot tell whether this is a joke or not.


It is *not* a joke.
Whether or not most computer science students
"get about a week to learn each new language",
they do not actually end up learning the languages.
They do. I did.
I doubt, for example, that the average student learns
how to leak memory in Java, and how to avoid it,
or how to release resources properly in the presense of exceptions in C++.

In any case, the original poster has already had a job.
For him, when he says he knows a language,
it is expected that he has written a real application in it,
not that he solved the 8 Queens problem in it.
8 Queens will be the same in any imperative language,
but string operations, I/O, error handling, standard containers,
memory management...


Evidently, you were never a computer science student.
Abilities differ from one person to another.
Some people will never learn C++ well enough
to sell their skills as a professional programmer.
But, if you can't pick up a new language within a week,
I would *strongly* suggest that you look into a different career path.

Jul 22 '05 #22

P: n/a
Gary Labowitz wrote:
"Dietmar Kuehl" <di***********@yahoo.com> wrote in message What you say in the rest is quite reasonable,
Thank you.
but this "call the Java
pointers "references" if you want to but they are actually just pointers;
from a C++ perspective" is wrong and misleading. Java just doesn't have
pointers. Period.
I know this "Java has no pointers" mantra. The reasons for calling Java
pointers "references" are quite simple: pointers are a hard concept to
grasp and enough people turned away from C or C++ because the had
problems with pointers in some form or the other.

The point is, however, that Java reference behave much more like C++
pointers than C++ references! For example, a C++ reference can never
be null: if you have correct program, you can always just use a
reference (in C++ you can have stale reference, however, referring to
destroyed objects but this is a programming error according to the
standard; it is just not required to be detected by C++ implementation).
There is no such thing like a "null reference" in C++.

On the other hand, Java reference can be null - like C++ pointers. In
C++ you cannot change what a reference refers to. In Java you can
change the object a reference refers to - like C++ pointers. As I
mentioned, there are two essential difference between Java references
and C++ pointers:

- Java reference are garbage collected.
- C++ pointers allow pointer arithmetic.

Other than this, Java reference behave exactly like pointers. That is,
I would call them pointers. Of course, how these pointers are realized
is an entirely different issue! Actually, even in C++ it would be
legal if a pointer were some handle to some object. In fact, this is
what normally is: the handle just happens to be number of the memory
location where the object starts.
The two biggest differences I find students have the problems with are the
many "types" C++ has versus the nine that Java has, and the difference in
exception handling.
You are saying, students fluent in Java have no trouble abandoning
dynamic polymorphism and using templates instead where appropriate? I'm
rather surprised that this is true. The people I have seen who learned
Java first try to program Java in C++ - and fail big time, of course.
That is, they typically get something to work but it is essentially
unmaintainable and does not scale.
Java may simplify too much (and is remedying that by
adding boxing and making everything an object), but C++ gets confusing
with all the portability built into the implementation instead of an
language/interpreter. Of course, C++ is more useful and produces tighter
code if you strip it down.


There are advantages of both languages and I wouldn't call C++ to be
optimal. Rather I would describe C++ similar to the way Winston Churchill
described democracy: "C++ is the worst programming language, except for
all those others that have been tried from time to time" :-) Of course,
unlike with democracy, for some purposes there is indeed a better tool to
solve the problem at hand.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting
Jul 22 '05 #23

P: n/a
E. Robert Tisdale wrote:
Dave O'Hearn wrote:
I cannot tell whether this is a joke or not.
It is *not* a joke.


It's still funny. It's probably just a semantic disagreement, over the
definition of "knowing" a language, but then, must humor is due to
semantic ambiguity.
Whether or not most computer science students
"get about a week to learn each new language",
they do not actually end up learning the languages.


They do. I did.


I can fake knowing a language after 1 week too, but I will make
beginners mistakes that cause maintainence problems. This isn't a
problem for homeworks and projects, since they get thrown out after the
due date, but most software gets shipped to users on the due date, and
the users do more interesting things with the software than grade it
and throwing it out.
I doubt, for example, that the average student learns
how to leak memory in Java, and how to avoid it,
or how to release resources properly in the presense of exceptions in C++.
In any case, the original poster has already had a job.
For him, when he says he knows a language,
it is expected that he has written a real application in it,
not that he solved the 8 Queens problem in it.
8 Queens will be the same in any imperative language,
but string operations, I/O, error handling, standard containers,
memory management...


Evidently, you were never a computer science student.


I was, but I have limited experience with this supposed phenomenon of
learning entire programming languages in a week. The only language I
was ever forced to learn for a course was Scheme, and Scheme does not
really count. Besides, you were talking about modern imperative
languages with significant standard libraries.

I had other courses that required a language, either C, C++, or Java,
but I knew the languages before I took the courses. I also, invariably,
wrote much better code, much more easily, than anyone else. I doubt
this is because I am a phenomenal genius. I am smart, but not orders of
magnatude smarter than an entire undergraduate program. Actually
knowing the language lets you write more, better code, much faster.
Imagine that.
Abilities differ from one person to another.
Some people will never learn C++ well enough
to sell their skills as a professional programmer.
But, if you can't pick up a new language within a week,
I would *strongly* suggest that you look into a different career

path.

I have merely recommended not lying to a potential employer. I take my
business relationships seriously. I do not lie to my employer. If you
have 1 week of C++ experience, put on your resume "C++ - 1 week total
of experience" or "C++ - I read a book about it once." That would be
honest.

It very well may be that the employer is willing to hire someone with 1
week of C++ experience, provided he or she is a fast learner, and has
other experience, and a good academic record, or is somebody's friend
or cousin. That is the employer's decision, and it may or may not be
wise, but it should not be manipulated by dishonesty.

--
Dave O'Hearn

Jul 22 '05 #24

P: n/a
I think I have to agree with Dave O'Hearn here.

I'm a computer science student too, and I already had 3 to 4 years C++
experience before I started studying. But frankly, I still don't have the
impression when reading through new articles or this newsgroups that I'm
anywhere near to knowing C++ like most professionals here.

I know, university often demands that the student has to "learn" a language
for a *specific task* in maybe a week, but this will only gain him the
opportunity to solve the given problem, but not much more actually.

For example, in the second half of this semester, we have to implement a
solver for linear optimization problems using the revised simplex in C++
(it's a project from the math faculty, not the computer science faculty),
although we have used Java as the primary language almost everywhere
(except for functional programming in Standard ML).

I really can't tell how *glad* I am that I already know C++ (quite well,
compared to most of my fellow students!). This will ease this project
assignment a LOT for me compared to someone who has merely one week of C++
experience ^^.

Regards,
Matthias

E. Robert Tisdale wrote:
Dave O'Hearn wrote:
E. Robert Tisdale wrote:
Rhino wrote:
Your point is well taken, even if it isn't very helpful.
Yes, you are right, you know nothing about me
so you can't estimate accurately how long it would take _me_ to


learn C++.
A week.
It shouldn't take you more than a week to learn C++.
It takes about as much time to learn C++
as it takes to read a textbook on C++ cover-to-cover.
Most computer science students taking a course on programming


languages
get about a week to learn each new language if they are lucky.
Java is smalltalk disguised as C++.
C++ is *not* Java.
You will need to *unlearn* some of Java
before you can progress in C++.
But both Java and C++ are imperative computer programming languages
so much of what you learned to do with Java
will transfer to C++.


I cannot tell whether this is a joke or not.


It is *not* a joke.
Whether or not most computer science students
"get about a week to learn each new language",
they do not actually end up learning the languages.


They do. I did.
I doubt, for example, that the average student learns
how to leak memory in Java, and how to avoid it,
or how to release resources properly in the presense of exceptions in
C++.

In any case, the original poster has already had a job.
For him, when he says he knows a language,
it is expected that he has written a real application in it,
not that he solved the 8 Queens problem in it.
8 Queens will be the same in any imperative language,
but string operations, I/O, error handling, standard containers,
memory management...


Evidently, you were never a computer science student.
Abilities differ from one person to another.
Some people will never learn C++ well enough
to sell their skills as a professional programmer.
But, if you can't pick up a new language within a week,
I would *strongly* suggest that you look into a different career path.


Jul 22 '05 #25

P: n/a
On Tue, 7 Dec 2004 16:20:23 -0500, "Gary Labowitz"
<gl*******@comcast.net> wrote:
Finally, the Java NullPointerException rather gives the game away!

Ah, but that's just what it's called. The real question is: What is it? (See
Alice Through the Looking Glass chapter with the White Knight for details on
the difference put in a nice way.)


Sadly I've not yet got around to reading the second book of Alice's
adventures, but literary references are always appreciated, even if
the author referenced was a mathematician!
Certainly all the Java developers I know who have some C or C++
background think of Java references as pointers...


Yes, I know. And some C++ programmers think of passing by reference as a
"pointer" under the hood. Still, there is no requirement that implementation
use pointers to support references in either language. They could just as
easily be handles used to look up resources that control the variables.
Anyway, it's one of those areas where the term has lost precise meaning and
causes a lot of head scratching ... and bar brawls.


Still, if we're talking about semantics, and certainly that's the most
important facet for most programmers, then a Java reference *behaves*
much like a C++ pointer (bar the two points Dietmar mentions). A C++
reference *behaves* like an object alias rather than a pointer.

How the two are implemented varies - I imagine that Java references
usually are handles of some kind, since this allows the GC to
seamlessly move objects around in memory. C++ references are generally
either replaced with the original object or implemented as pointers,
depending on optimization, inlining, etc.

Tom
Jul 22 '05 #26

P: n/a
Matthias Käppler wrote:
I think I have to agree with Dave O'Hearn here.

I'm a computer science student too, and I already had 3 to 4 years C++
experience before I started studying. But frankly, I still don't have the
impression when reading through new articles or this newsgroups that
I'm anywhere near to knowing C++ like most professionals here.


I think that you are seriously overestimating
the knowledge of most "professionals"
who contribute to the C++ newsgroup.
Knowing the subtle implications of a computer programming language
like C++ doesn't really make you a much better programmer.
Probably, most of the people that you consider to be professionals
really aren't.
Most of the contributers to comp.lang.c++ are amateurs
who are expert in some aspect such as the ANSI/ISO standard.
They really aren't much better (more productive for example)
than C++ programmers with one week of experience.
Being a really good programmer (amateur or professional)
is really something quite apart
from knowing a computer programming language like C++ really well.
And, once you have become a really good programmer,
stepping over to a new computer programming language
is really quite simple.
Jul 22 '05 #27

P: n/a
E. Robert Tisdale wrote:
Knowing the subtle implications of a computer programming language
like C++ doesn't really make you a much better programmer.
I don't agree exactly with this statement. It may not be the subtle
implications you have to be aware of but the techniques which work
- and avoid being bitten be the subtle implications. That is, you
need to know language specific idioms and when to use them.
Most of the contributers to comp.lang.c++ are amateurs
who are expert in some aspect such as the ANSI/ISO standard.
They really aren't much better (more productive for example)
than C++ programmers with one week of experience.
I'd claim that I'm more productive than C++ programmers with one
week of experience, even if the C++ programmer had loads of
expertise in other languages. Of course, productivity also depends
on the application domain, the development environment and tools,
etc.
Being a really good programmer (amateur or professional)
is really something quite apart
from knowing a computer programming language like C++ really well.
This is definitely true. It is even quite hard to grasp what really
makes a good programmer.
And, once you have become a really good programmer,
stepping over to a new computer programming language
is really quite simple.


.... but I disagree with the above statement! Sure enough, I have
no big trouble creating programs in new languages and I'm starting
to use typically one or two additional languages per year. However,
for each of them it takes a while before I become effective! I can
create working programs all the way but I'm typically relatively
slow and create a mess which matches design principles of a language
I already new rather than the new language. Picking up the idioms
for a new language takes some time, definitely much more than just
a week.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting

Jul 22 '05 #28

P: n/a
Dave O'Hearn wrote:
I can fake knowing a language after 1 week too, but I will make
beginners mistakes that cause maintainence problems. This isn't a
problem for homeworks and projects, since they get thrown out after the
due date, but most software gets shipped to users on the due date, and
the users do more interesting things with the software than grade it
and throwing it out.
It depends on what you call "learning a language". If you call being
able to write compilable, error-free code in a language "learning", 1
week is all it takes. I saw it in my first year in college. We had C for
our programming course. I had C++ in school for 2 years, and before that
I had done a lot of programming in BASIC (my first language). So the C
course was pretty easy for me. However, I saw my batch mates struggle.
Most had never done any sort of programming before. But they did write
workable code in the first week itself, if only after a lot of
compilation errors and segmentation fault:core dumped s. By the end of
the semester, they were producing working solutions of the standard
problems. And OP here says he has a lot of experience in Java. Shouldn't
take him more than a week to start programming in C++.

This is a general guideline I consider: If given an algorithm, you can
convert it into code in a particular language, you know that language.
If you can devise the algorithm also, such that it suits that particular
language, you know that language well. Programming ultimately boils down
to algorithms, and at its core, it is nothing but implementing and
interconnecting algorithms into a working program.

I was, but I have limited experience with this supposed phenomenon of
learning entire programming languages in a week. The only language I
was ever forced to learn for a course was Scheme, and Scheme does not
really count. Besides, you were talking about modern imperative
languages with significant standard libraries.

I had other courses that required a language, either C, C++, or Java,
but I knew the languages before I took the courses. I also, invariably,
wrote much better code, much more easily, than anyone else. I doubt
this is because I am a phenomenal genius. I am smart, but not orders of
magnatude smarter than an entire undergraduate program. Actually
knowing the language lets you write more, better code, much faster.
Imagine that.


Knowing the language will help you write more code. Yes, definitely. You
will spend less time spotting compiler errors and warnings. And in C++,
where the errors the compiler gives usually have no relation to the
actual error, this is a big help. Better code ? Doubtful, but probable.
Depends on what you call better code. If two programmers implement the
same algorithm in a language, and one knows the language better than the
other, the former will write faster, smaller code. But as with almost
everything, it too follows the law of diminishing returns. A person with
4 months experience will write a lot better code than one with 1 month.
However, the difference will be much less marked in a person with 4
years experience, and another with 1 year.

However, if the person with less experience is more experienced in
programming theory, he may choose a better algorithm, giving much more
efficient results than the person with more experience. So it depends.

-Arijit
Jul 22 '05 #29

P: n/a
On Mon, 06 Dec 2004 14:33:45 -0800 in comp.lang.c++,
"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote,
It shouldn't take you more than a week to learn C++.


No, you are the only person who stops learning after a week with
C++. The smartest people are still learning after years.

Jul 22 '05 #30

P: n/a
Thank you all for your thoughtful and thought-provoking replies to my
original question. You've given me a lot to think about!

For what it's worth, I know someone at the company that wants people with
both C++ and Java skills; I'm going to see if I can get him to ask the
appropriate people what level of C++ proficiency they need. That will give
me a lot better idea of whether I would be wasting their time in applying
for a job there.

Thanks again!

Rhino
Jul 22 '05 #31

This discussion thread is closed

Replies have been disabled for this discussion.