-
May 14th, 2009, 01:04 PM
#16
Re: Java to C++
So to sum it all up:
Originally Posted by potatoCode
learn C++ as if you knew nothing about it.
Where "it" means Java.
Regards,
Paul McKenzie
-
May 18th, 2009, 05:59 PM
#17
Re: Java to C++
Originally Posted by sgiri1981
Dear All,
I m new to C++ and am transitioning from Java. I m comfortable with the principles of OOP, which I learnt along with Java.
You're at square one. Java means nothing in the C++ world. Java and C++ are VERY different languages.
Start learning C++ from the beginning. I recommend the new book by Stroustrup (the founder of C++). It's called Programming, Principles and Practices Using C++.
-
May 18th, 2009, 06:28 PM
#18
Re: Java to C++
Originally Posted by nuzzle
You're at square one. Java means nothing in the C++ world. Java and C++ are VERY different languages.
Exactly. Even though many of the posts here are helpful in stating the differences in the two languages, I would believe that trying to figure out the differences would be very confusing to a Java programmer learning C++.
So the safest thing to do is to hide all of the Java books, pretend Java doesn't exist, and learn C++ from scratch.
Start learning C++ from the beginning. I recommend the new book by Stroustrup (the founder of C++). It's called Programming, Principles and Practices Using C++.
Another book is "Accelerated C++" by Koenig & Moo.
Regards,
Paul McKenzie
-
May 18th, 2009, 06:49 PM
#19
Re: Java to C++
Originally Posted by Paul McKenzie
Even though many of the posts here are helpful in stating the differences in the two languages,
They're not helpfull. They suggest there are minor differences between C++ and Java/C#. There isn't. The differences are major.
-
May 18th, 2009, 07:54 PM
#20
Re: Java to C++
Originally Posted by nuzzle
They're not helpfull.
Well, those are the differences, whether they are helpful or not is a matter of opinion.
I don't disagree with you that any Java or C# programmer going to C++ should just forget about those languages when learning C++. That's been proven by the many threads started on CodeGuru by Java programmers who have totally butchered C++ programs with Java-ized code.
Regards,
Paul McKenzie
-
May 18th, 2009, 08:05 PM
#21
Re: Java to C++
Originally Posted by Paul McKenzie
Well, those are the differences, whether they are helpful or not is a matter of opinion.
Well, point at a helpful difference that has been pointed out in this thread?
-
May 18th, 2009, 08:10 PM
#22
Re: Java to C++
Originally Posted by nuzzle
Well, point at a helpful difference that has been pointed out in this thread?
Aye, I went straight to suggesting Accelerated C++ because I felt that it was futile to try and answer the more technical questions. It would be better for sgiri1981 to just learn C++ and then compare for himself/herself in retrospect.
-
May 18th, 2009, 08:20 PM
#23
Re: Java to C++
Originally Posted by nuzzle
Well, point at a helpful difference
"Helpful" is subjective. Maybe the OP has now seen so many differences, they've been convinced into *not* assuming that Java and C++ are similar (hopefully the OP sees that it's a loser trying to leverage what they've learned in Java in learning C++).
I've responded many times on threads over the years like these concerning Java programmers learning C++. I've gotten into many disagreements from Java programmers saying what they're doing is OK. Again, you have no argument with me when it comes to Java programmers learning C++.
Regards,
Paul McKenzie
-
May 18th, 2009, 09:29 PM
#24
Re: Java to C++
Originally Posted by Paul McKenzie
"Helpful" is subjective.
It's like with my kangoroos. They aren't very helpful.
-
May 19th, 2009, 02:43 AM
#25
Re: Java to C++
Originally Posted by nuzzle
It's like with my kangoroos. They aren't very helpful.
At least they´re tasty
- Guido
-
May 19th, 2009, 02:45 AM
#26
Re: Java to C++
You can switch from any languages to any languages provided you understand the concept.
Thanks for your help.
-
May 19th, 2009, 02:53 AM
#27
Re: Java to C++
Originally Posted by Paul McKenzie
I don't disagree with you that any Java or C# programmer going to C++ should just forget about those languages when learning C++.
Do long term C++ coders have the same sort of problems when trying to learn Java/C#. I imagine that forgetting (almost) all things are references would likely trip up the unwary.
i.e.
This snippet will do different things in C++ and Java/C#
Code:
a.value = 0;
b = a;
b.value = 1; // Has 'a' changed? Depends on the language.
Last edited by JohnW@Wessex; May 19th, 2009 at 02:55 AM.
"It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
Richard P. Feynman
-
May 19th, 2009, 04:02 AM
#28
Re: Java to C++
Originally Posted by JohnW@Wessex
Do long term C++ coders have the same sort of problems when trying to learn Java/C#. I imagine that forgetting (almost) all things are references would likely trip up the unwary.
The problem that I see with C++ programmers going to Java are these:
1) Not getting used to what "=" does in Java (which is your snippet)
2) Not using the ready-made libraries by Sun and other companies, and instead code their own routines. Most of the time, the reason for this is that the C++ programmer is not aware of these libraries (or particular library) that exists to do the job (not really because the C++ programmer believes they're superior programmers and who must "code it themselves").
3) Getting used to the difference between a byte and a character.
4) Not only the language is different, but the programming paradigm is different (for example, a typical Java app throws exceptions if you make the slightest wrong move, while C++ only throws exceptions when there are those rare exceptional conditions).
A C++ programmer can readily maintain an existing Java application -- however (and IMO) it takes much more for a C++ programmer to actually design and start coding a non-trivial Java app from scratch. The same vice-versa, however an existing C++ application being maintained by a Java programmer scares me more than the other way around.
Regards,
Paul McKenzie
-
May 19th, 2009, 05:47 AM
#29
Re: Java to C++
When I coded in Java I commonly made the mistake of forgetting to initialise members, eg collections, so I would for example have a vector as a class member and try using it forgetting that it was null by default.
It was also difficult to grasp in some ways the lack of ownership and the lack of const, so if I passed a vector from a class to a function in another class that function could do what it wanted with it, and also if it stored a copy, neither class actually "owned" it.
A noticeable issue was that a Java project with a bad class path would run continuously, just throwing ClassNotFound exceptions and logging them whereas a similarly bad C++ program (i.e. bad LD_LIBRARY_PATH or whatever) would probably have terminated, probably immediately on start-up, which would mean it would be easier to fix. Particularly given that you might have the class path correct in dev and wrong in production (they never quite match up exactly). Of course this may have been a less-than-perfect setup. Probably a good setup would ensure all the required .jar files are there as soon as your Java server starts up and terminate instantly if they are not, allowing you to fix the issue.
-
May 19th, 2009, 09:56 AM
#30
Re: Java to C++
Hi All,
Good to see so many fruitful posts while I was away, tied up in yet another language: SAS.
Originally Posted by Paul McKenzie
....
....
The same vice-versa, however an existing C++ application being maintained by a Java programmer scares me more than the other way around.
Regards,
Paul McKenzie
I m precisely in this situation!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|