Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java and other languages

 
Stephen Foy
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just wondering how it is, when you get quite good at java, is it difficult to apply knowledge from java to other languages like c++.

Sorry if this isnt appropriate for this forum section.
 
Gerardo Tasistro
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, not at all.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I first learned to program with GWBASIC under DOS 5.something when I was in high school. When I took my first C programming course in college, I found a lot of the concepts transfer directly. Most of my time was spent in learning a new syntax to do the exact same things I was already used to. Then I took a course in C++ and now do some Java. I've also dabbled in Python, Perl, Lisp, and PHP. In my experience, each language is a little bit easier.

Java and C++ are very similar, so in some ways it will be easy since the syntax is somewhat familiar. However, C++ has some different pitfalls, so you have to be careful. For instance, you have to worry about memory management yourself since there is no default garbage collector. There are other minor differences, too, such as "bool" instead of "boolean". Once you get going, you should get used to these differences. Just be sure that you learn what things you CAN transfer from Java and which ones you should NOT.

Layne
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The last thing I did before leaving C++ for Java was buy the book "Exceptional C++" by Herb Sutter (subtitled "47 Engineering Puzzles, Programming Problems, and Solutions"). It languished on a shelf until I took it with me to survive a Christmas with the in-laws. This is essentially a book about pitfalls, and I hoped that I could apply some of what I read to Java or object-oriented design and programming in general. No such luck, but it did make be feel happy to be working in Java, and not dealing with all the gotchas of C++.

Some somethings transfer and somethings don't. You could argue that it's all experience and therefore all good, but the amount that transfers can be slight, so it could amount to a near-complete waste of time.

On the other hand, the first time I read the Gang of Four's Design Patterns, I was totally blown away by how much insight the book packed in and how relevant it was to OOP, in any language. I skipped all the code samples (which are mainly in C++, with some smalltalk thrown in to really confuse me) and still do now, when I go back to the book. I guess I'm saying that what I get the most out of is the higher level stuff, and this seems to be what I can apply across languages, versus things like "watch out for == versus equals()", which is true enough, but doesn't travel.
[ January 16, 2006: Message edited by: Jeff Albrechtsen ]
 
Steve Stanicki
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I took a VB .NET course about a year ago, and I find that VB .NET has taken alot from Java. Java seems much cleaner. For instance, if a method in VB overrides another method, you have to declare it with "overrides myOtherMethod" when you declare the method. It's kinda fuzzy now, but this is what I remember. In Java you just do it.

So it would be very easy to learn VB .NET after Java, or vise versa.

Steve
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Steve Stanicki:
Java seems much cleaner. For instance, if a method in VB overrides another method, you have to declare it with "overrides myOtherMethod" when you declare the method. [...] In Java you just do it.


Hmmm... If you are using the current version of Java, you should be using the following annotation when overriding a method:Just do it, or do it properly? (Okay, it's not such a good slogan for selling shoes )
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic