Gillius's Programming

This section has been "discontinued" for now, because I had to remove the code that was here and the rest of the content was out of date. The only content left here is a small blurb about Java that I wrote a some years ago.

Back to Main Page

About Java

Java is a programming language which is very similar in syntax to C++, and is an object oriented programming language. Java is a language which in my opinion is really great and suitable for small to medium sized applications which need to be developed quickly and very reliably. Java greatly shines over other languages as its basic library provides almost everything you could need: a fully-functional GUI system, internet sockets support, remote objects, data structures (like those in SGI's STL for C++), and much more in addition to the obvious basics. Java also assumes your program is multithreaded and since Java was developed with multiple threads in mind, multithreaded programming is easier to use.

Java runs on its own machine, so to speak, so you can write code once and it will work on any system which runs the Java Virtual Machine which runs the Java code and acts basically as an interpreter. You compile the source code in Java bytecode which is the "binary" file for the Java VM; so the VM is not an interpreter in the way a BASIC interpreter works. This VM is both a blessing and a curse -- your single file can be run on any computer with the VM without recompiling, but you will lose some performance. I have heard of some embedded systems which have processors which understand the Java binaries natively.

Java is a much more strict language than C++. Everything must be in an object, including all functions -- even the main function. Java uses exceptions very often, and execeptions MUST be caught, forcing the programmer to deal with the error, although this can be a pain when you have to create try/catch blocks constantly for a few lines of code when all you will do with the error is exit the program (for example file I/O can throw tons of exceptions which are very rarely thrown but you must be prepared to catch them).

Java also has garbage collection meaning you do not have to deallocate memory yourself, something which takes a long time to get used to for a C/C++ programmer -- linked list code screams at you when it looks short since it has no memory deallocation lines. The benefit of this is memory leak free programs every time.

The Javadoc program is a very useful utility. If you write your programs a certain way, you can use this program to create HTML pages in the same format as the Java documentation found on Sun's site. I have put up some of the documentations generated by Javadoc on my own programs on this site.