View Full Version : Which language is better to learn? C++ or Java?
GameDev
2003.01.18, 05:28 PM
Can the moderator please change the JAva to Java. Thanks.
Feanor
2003.01.18, 05:42 PM
That was my favourite moderator job so far!
I voted Java, even though I hate Java. Java will get you a job faster and there are more jobs, least as far as I can tell. Then again, I don't know squat.
macboy
2003.01.18, 05:47 PM
Originally posted by Feanor
Java will get you a job faster and there are more jobs, least as far as I can tell.It might get you jobs, but Java is .... no word to describe it... I guess "odd" I don't especially like either one, but C++ is a little bit better.
furballphat
2003.01.18, 06:23 PM
I went for Java. It has a beautiful built in API, superb multi threading and exception handling and creates structured code.
GameDev
2003.01.18, 06:26 PM
The reason I posted this poll was to help me decide which one I want to take first. I eventually want to take both. I am also going to learn Obj. C sometime.
henryj
2003.01.18, 09:18 PM
Java is significantly easier to learn than c++.
Java will teach you better habits than c++.
Java has a 'better' standard library so you will be productive sooner.
All in all it will be a more pleasant experience especially on mac osx.
FCCovett
2003.01.19, 02:21 AM
The processing power of current computers is more than enough to run Java applications with decent performace and, overall, Java is a beauty of a language.
Now, Apple just needs to get the 1.4 version of Java running on most machines as soon as possible, otherwise our games can't fully benefit from the latest features as fast 3D rendering.
There are free libraries for Java 1.4 that allow your applications to access OpenGL in a simple manner. Java is really worth a try for a simple game, especially if you require networking, and it's not so difficult to port a game made with Java to C++ somewhere down the road.
GameDev
2003.01.19, 12:30 PM
OK, I'm convinced. I am going to learn Java first. Question 2: Should I learn Java before Obj C? Thanks for your help.
P.S.
Does it help to know C to learn Java like C++? (I'm trying to put off learning pointers as long as possible :D )
Originally posted by GameDev
OK, I'm convinced. I am going to learn Java first. Question 2: Should I learn Java before Obj C? Thanks for your help.
P.S.
Does it help to know C to learn Java like C++? (I'm trying to put off learning pointers as long as possible :D )
I don't know why you would not want to learn pointers. Understanding of pointers is key to any programming language, unless you absolutely don't care what goes on under the hood. And pointers is not such a difficult topic, you just have to get the syntax down.
- D.G
macboy
2003.01.19, 01:04 PM
Originally posted by DoooG
Understanding of pointers is key to any programming languageNot if you're using BASIC :p BASIC does just what you tell it to :rolleyes:
Originally posted by macboy
Not if you're using BASIC :p BASIC does just what you tell it to :rolleyes:
Ok, I should have said modern languages, especially oop. Since objects are typically dynamically allocated, you always deal with pointers, even if you don't really get to play with them.
- D.G
OneSadCookie
2003.01.19, 03:54 PM
Learning C will probably not significantly help you learn Java.
henryj
2003.01.19, 06:02 PM
You don't need to understand pointers to learn Java either.
But as Dooog said pointers aren't that hard. There is MUCH worse stuff to come.:um:
Carlos Camacho
2003.01.19, 07:21 PM
You should have clarified your poll, by saying "for what"? As in, which is better to get a job, which is better to do ABC, etc... OneSadCookie's article comes to mind on this.
Frankly, I'm a little confised why so many ads are looking for Java programmers. To me, the best info you could learn to work for 'Net related companies is PHP, backed up by solid SQL database knowledge, XML, along with some other little tidbits.
How often is Java used in the enterprise? And for what? In my company, the only time I came across it was in my former project. In that case, the ONLY language that would do what the project demanded was JAVA (distributed contol and monitoring of device.)
No slam against Java or its API, I'm just trying to understand why all those ads say Java programmer wanted? Perhaps I am forgetting companies that provide small and specific turn-key systems, like perhaps for a medical office? Other examples?
heck, in java there is nothing else but pointers to objects (except for the basic types), and they do behave as such. you'd be pretty fucked up if you wouldn't know how to handle those.
pointer arithmetic would actually be a pretty simple part, and it gives you more understanding.
not that java is worse than c++.
concerning some of it's features, it is just somehow pretty poor compared to what it actually should be.it's not as platform independent as it should; left out multiple inheritance to avoid a problem which was introduced by interfaces anyways ...;
on the other hand it has a lot of things implemented as standard which you'd have to get somewhere else in other languages.
you could actually miss out on obj-c entirely and write all your cocoa applications in java.
what i like about c++ is that you get the chance to do things like pointer arithmetic yourself if you want (and you can overload operators), but you could entirely get along without pointers and keep things as simple as in java (except for maybe garbage collecting) and just use references everywhere.
p.s.: java programming is kind of lazy
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
OneSadCookie
2003.01.19, 07:55 PM
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.
p.s.: java programming is kind of lazy
In what way?
GameDev
2003.01.19, 08:03 PM
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. :)
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.
applekid
2003.01.19, 08:09 PM
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
2003.01.19, 08:20 PM
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
2003.01.19, 10:26 PM
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
2003.01.20, 12:48 AM
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
2003.01.20, 12:55 AM
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.
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.
OneSadCookie
2003.01.20, 02:33 PM
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.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.