Which language is better to learn? C++ or Java?

DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #16
Aye, we are getting stuck again. I am still an advocate of c++, for some of the aforementioned reasons, and its heritage to C. Basically, by learning c++ you learn 2 languages at once.

The only area in which java is really superior to c++ is the GUI features, which are built in, yet not as simple to use as Cocoa. So, if you plan to stay on the Mac mostly, I suggest learn C, then C++ and Cocoa, for the last 2 it doesn't matter which order, just not at once. You would still be able to program for other platforms with C++ if you find yourself a suitable GUI framework.

I learned C++ way before ObjC, and for me the new syntax and concepts introduced with ObjC were mostly very easy to grasp, but I doubt it is the same the other way around. I guess this is because ObjC is more lazy than C++. HTH,

- D.G
Luminary
Posts: 5,143
Joined: 2002.04
Post: #17
Quote:left out multiple inheritance to avoid a problem which was introduced by interfaces anyways ...;

What problem is that? The problem with multiple inheritance is one of knowing which overloaded function to call. Interfaces avoid this.

Quote:p.s.: java programming is kind of lazy


In what way?
GameDev
Unregistered
 
Post: #18
OK, I was just joking about the pointers. I'm going to finish learning C before I venture into anything else, so I'm going to learn pointers eventually. I just said that because I know pointers are the hardest part of C. BTW Carlos, I'm looking to make shareware games, so the moderator can feel free to change it to "Which language is better to learn for making shareware games: C++ or Java?" Thanks. Smile

P.S.-
I think it is important to note that right now, I'm just looking to create simple shareware games, not the next Halo.
Member
Posts: 81
Joined: 2002.12
Post: #19
From my experience with Java (which hasn't been good at all), find a very good book and learn from a true blue guru. Learning from a teacher that's trying to learn Java is horrible.

And with any programming language, learn the basic things like If-Then, loops, arrays, etc. and understand how they work. You might want to learn those basics, in well, BASIC. Download METAL and find some documents on basic things for BASIC then jump right into Java or C, whatever you plan on using.
henryj
Unregistered
 
Post: #20
Quote:in java there is nothing else but pointers to objects (except for the basic types), and they do behave as such


This is a misleading statement. While technically speaking all objects in Java are accessed via a pointers, They behave more like c++ references. Pointers imply access to raw memory addresses which ISN'T possible in Java from the language (only in the JVM)

So things like dereferencing, pointer arithmetic, arrays and all the other things that confuse beginners are not possible with Java. The result is more reliable and secure applications.
GameDev
Unregistered
 
Post: #21
Are you refering to how objects are declared when you say that Java is all pointers? I think that objects are declared as pointers in all OOP languages. (I know they are in Obj. C and Java, at least)
henryj
Unregistered
 
Post: #22
In c you have 2 ways to declare an variable
int x; // by name
int* x; // by pointer

In c++ you also have by reference
int& x; // by reference

In Java you only have one method. It is declared by name, allocated like a pointer and behaves like a reference.

Integer x;
x = new Integer;
x.toString( 42);
henryj
Unregistered
 
Post: #23
I may have said this before but...

Recently I have slowly come to the conclusion that people spend far too much time thinking about programming and not enough time doing it.

Who cares whether java objects are pointers or references. Who cares whether a header includes other headers, who cares whether garbage collection is better than manual memory allocation. Who cares which is the best programming language.
After all there is nothing you can do about it so stop worrying and write some bloody code.
The shittiest FINISHED program is infinitely better than the best unfinished one.
Hog
Member
Posts: 151
Joined: 2002.09
Post: #24
Quote:Originally posted by henryj
So things like dereferencing, pointer arithmetic, arrays and all the other things that confuse beginners are not possible with Java.


you are actually dereferencing alot of times in Java, i.E.:
when you write:
Instance1 = Instance2;

this can be misleading too, if you don't take note of it.
Luminary
Posts: 5,143
Joined: 2002.04
Post: #25
Actually, a simple assignment is a good example of when you're not dereferencing.

What henryj meant, I think, is that you can never simply dereference a pointer to get an equally-usable (but semantically different) thing.

Field access and method calls implicitly involve a dereference.
Nibbie
Posts: 1
Joined: 2009.10
Post: #26
the limitations that are inherent in small devices require you to change the way in which you design and code your application. if in doubt, what do you think it is better to use? java or C/C++?? is there a special reason? Smile
Moderator
Posts: 3,572
Joined: 2003.06
Post: #27
I don't know how you found this ancient thread viren, but I found the conversation kind of interesting, and rather amusing (especially if you know some of the long-time members here), so I approved the post anyway. Wink

It's also funny to see this poll has ObjC in dead last way back then.
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #28
Is it bad that I don't understand any of what I said back then?

I'd prefer such old threads to stay buried forever Rasp
Moderator
Posts: 3,572
Joined: 2003.06
Post: #29
hehe.. yeah, times sure have changed! LOL
Member
Posts: 260
Joined: 2005.05
Post: #30
"Which language is better to learn?" For what purpose?

My vote is for all and none. Learning only a single language makes you limited. You need to be able to move between them. If the goal is maximum job opportunities, the answer is definitely "all of them"!

But I wouldn't use any of these three for neither undergrad teaching nor my own programming, given a free choice. All three are badly designed languages, locked into design flaws (hacks) made by K&R in the early 70's.
Thread Closed 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Learn java ? icross 6 5,992 Apr 22, 2009 11:11 PM
Last Post: AnotherJake
  What to learn next? stevejohnson 3 3,104 Nov 19, 2006 04:08 PM
Last Post: unknown