PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Java....AYE

Ok, so I found out, my school has a Computer Science I course and an AP Computer Science course (that you can get into if you do well in the first class).

Anyway, I found out, they teach Computer Science using the JAVA lanuage. I am not familiar with the language at all. By skimming through the source code, I have come to the conclusion that it is an Object-Oriented language like C/C++, and even appears quite similar.

What are the capabilities of this language? Is it half-decent? Is it harder or easier than C++? Is it portable? Will it help me develop in the future?
JAVA borrows heavily from C++ syntactically; loosely, you could even call it a superset of C++ (though JAVA folk tend to get their panties in a bunch over that statement -- largely why I write it). Functionally, however, I'd call it more of a subset of C++. But, I'll try to stick away from my personal prejudice of the language.

JAVA is a platform independent language. Rather than being compiled into machine-dependent language like C++ is, it is compiled into JAVA bytecode (which has to be interpreted in some way or another). Normally, that bytecode is interpreted by a JVM (which is slow as hell). Most big platforms have methods of compiling or interpreting JAVA bytecode into native machine code, which makes the performance somewhat comparable to C++.

I would say JAVA is a lot like a C++ that goes out of its way to hide memory management from the programmer. This has its pros and cons.
* You don't have to manage your memory; as soon as a class is dereferenced it will eventually be cleaned up by the garbage-collector. This has minor performance implications. Technically, you can implement automatic garbage collectors for C++, but I've not seen a C++ programmer bother doing so.
* JAVA, also doesn't have pointers (ie, memory addresses). Not a surprising casualty in JAVA's war against memory management. It's not a huge deal, though, anything you can do with pointers is probably easily doable with one of JAVA's various class constructs. That is arguably a good thing, pointers are one of, if not the largest culprits in faulty software.

Basically, JAVA is a great choice for an academic language. It's virtually impossible to shoot yourself in the foot with it. It has a standard, and actually adheres to it. It has a great library set. It is more readable that C++. It is platform independent. And it is an OOP language.

And as for "will it help me develop in the future", it would. JAVA has grown quite popular in the last few years. I'd say there's more JAVA jobs in my area than C/C++ ones, in fact. Even if you don't program in JAVA later in life, any programming experience makes you a better programmer.

That being said, I wouldn't use JAVA for PPC game development personally, but I'm sure some people do (presuming there is ways to run JAVA apps on PPC).

I should also mention that intro Computer Science classes _should_ be mostly language independent. You'll just be learning your basic sorts algorithms, program-flow structures, and so on. So it really doesn't matter that much what language you're learning with.
C/C++ is a substantially more difficult language to code in than Java for the reasons Andy described. Thus from a educational perspective it is both good to learn Java first (because the learning curve is less steep if you're the type of person that can't stick with C++ until you grasp it), and bad (migrating to C/C++ is still difficult because you do not have a solid foundation of directly accessing memory, which is key to C/C++, ie pointers, memory allocation, etc).

I learned Pascal first, which was the standard Academic method of learning structured programming (which has since gone out of style - I doubt many universities are teaching Pascal at all these days). Like Java, Pascal is a much more type strict language, and did a pretty good job of hiding pointers and memory from the developer. However syntactically it was quite different from C - much more so than the difference between Java and C. In a way that was good. When switching from Pascal to C the syntax was so different that you "knew" you were programming in a new language, and it required extra thought which is a Good Thing. Java and C++ are so similar that you would find yourself on autopilot coding Java constructs and wondering why your C++ is not working.

Dan East
That being said, I wouldn't use JAVA for PPC game development personally, but I'm sure some people do (presuming there is ways to run JAVA apps on PPC).


If you want to learn Java and use it for game programming for Pocket PC here are some disadvantages:

1. Java needs runtime/plugins to run your application. That means you can't compile it to .exe like C/C++ does. And it will compose of classes (.class) and multiple files which I find it messy. But you can zipped/jar all the classes to make a 1 file package.

2. Graphics/Memory handling in Java is hard and will often give you an 'out of memory' problems. Based on my experience in developing 'games' using Java. So you have to minimize/optimize the size of your graphics/images. Of course there's a garbage collection (GC) that will free up memory if needed but that wont help in GAME/GRAPHICS issues. [I might be wrong here, please correct me. This is just based on my experience]

3. Coding without IDE is hard. I'm using TEXTPAD and Visual Cafe before ;-)

There are IDEs such as Visual J++ (microsoft), Visual Cafe (symantec) or JBuilder (borland) but using these, you'll lose your codes 'portability' and '100% pure java' since each IDE have their own packages.


Advantages :

1. Online application developments
2. Mobile application developments

Conclusion : Try to learn Java if you have a chance and later one shift to other languages. This will help you a lot. Goodluck ;-)


*** Like Dan said, I also learned Pascal first in our school. ***
VERY interesting...

I don't know where to start with this Java business.

As of now, I just discovered by brother's C++ computer science book. It's very well written, and even includes well thought out exercises.

I'm going to try and shoot for an intermediate understanding of C++, so perhaps I can learn SDL or DirectX. As of now, I'm somewhere in the beginner level, and I've completed nearly two books. We shall see...