IDE(s): Eclipse, Netbeans
Consider the vast communications gap between human and computer. The latter sees everything as a flow of current with subtly varying voltages (that we imagine as 1’s and 0’s) while the former uses a combination of mouth sounds, facial expressions, gestures, body language, context (time, day, weather, inside/outside) to convey meaning.
Now consider programming languages as existing in a multi-layer continuum bridging the gap between humans and computers. At one end we have machine code and at the other “Siri, where can I get a good cup of coffee?”
In between we have a choice of either compiled languages (which are converted to machine code before they can run) or interpreted languages (which are sent to an interpreter which then translates them into machine code on the fly). The closer a language gets to the hardware layer, the more a program needs to be modified when you want to run a program written in that language when you change hardware. Not only that but languages that are able to directly address the hardware are more vulnerable to malicious or insecure code.
So at the end of the 80’s the computer world found itself in a quandary. Scripting languages were very portable but didn’t have the power or efficiency to scale up for serious work. On the other hand, compiled languages were not readily portable and further didn’t protect the computer from a bad programmer. In addition, with the rise of the public Internet, networking and remote code execution were becoming terrifically useful but these capabilities weren’t readily available in existing programming languages.
In 1991, James Gosling developed a language called Oak (later renamed to Java). It combined the advantages of interpreted languages in that it was highly portable and compiled languages (the code is compiled to bytecode which is then quickly compiled to more efficient machine code at runtime.) In addition, it had built-in support for networking as well as remote procedure calls. Java was similar enough to existing languages like C/C++ so that it was fairly easy for experienced programmers to learn. Java programs run in the Java Virtual Machine (JVM) which adds a layer of protection for the underlying operating system.
I like Java. If you have an orderly (okay, maybe a little OCD) way of thinking, programming in Java feels very structured and organized. It’s sort of the programming equivalent to using Lego. Java has a substantial library of reusable code so you don’t have to re-invent the wheel.
Java is not without its disadvantages, however. The price of portability and protected code means that the JVM is the limiting factor in performance of your application and it uses more memory than native code.
The barrier to entry is Java programming is very low. The development kit is cross-platform and available free of charge. The documentation is readily available online and tutorials are easy to find. All you need to start coding in Java is a text editor (once you’ve downloaded the JDK). But I don’t recommend it unless you’re a fan of working at the command line. There are GUI IDEs available, however. Two of the best (free) ones are Netbeans and Eclipse.
I’m torn about Eclipse. It’s free, cross-platform and very powerful since it has a plug-in architecture that lets you easily add new capabilities, including support for C/C++, PHP and even COBOL. The problem is that Eclipse is not, shall we say, ‘for the weak’. With this power comes considerable complexity and even with available tutorials, getting started with Eclipse can be a very intimidating experience.
NetBeans, on the other hand, is a much friendlier experience, particularly for someone like me who hasn’t worked with Java for about five years or so. In any event, I don’t recommend Java for beginning programmers. You really need to be comfortable with object-oriented programming (OOP), plus the state of the art of programming has moved on since the 90’s, with friendlier languages such as Ruby and Python available today which are much more accessible to beginners.
My program this week was a simple animation, developed using code from Beginning Java SE 6 Game Programming (Harbour, Jonathan S. Beginning Java SE 6 Game Programming. 3rd ed. Boston, MA: Course Technology, 2012. Print.) This is a very well-done book which takes you from a basic introduction to the Java language to vector and bitmap-based graphics, 2D and 3D animation including sound effects and music. All of the examples come with sample code, which is very well documented.
This program simply renders a 2D animated sprite and bounces it around in a window on your desktop. All I did was replace the default animation with one of the word HELLO morphing into WORLD. (A link to the animation frame image is here.) The source code can be found here.