Getting Started with Java

So you’ve decided you want to get into the world of Java programming.  Let me be the first to welcome you to the beautiful, object-oriented, and oh-so-portable world that is Java!  The following step-by-step list will tell you what you need and what you ought to have to get started programming with Java.

  1. A working and fully updated installation of Java.  Due to the prevalence of Java in today’s world of computing, odds are you already have this.  However, if you have been living under a rock hanging out in your own outdated and reclusive corner of the internet, you can find installation packages for Java here.
  2. The Java Development Kit (JDK).  This will include the Java compiler and everything else you’ll need to create Java programs. The can find the JDK here.
  3. (Optional) A Java-based or Java-supported integrated development environment.  That’s just a fancy term for a program specifically designed to make programming easier in a specified language.  I recommend either NetBeans or Eclipse.  I’ve used them both.  If IDE’s seem a bit too complicated for your speed, I would at least recommend something like Notepad++ if you’re a Windows user or TextWrangler if you’re a Mac user.  Both of these feature syntactic highlighting, encoding specification, and many other useful features for programmers.

There are many other things I could recommend other than these, but these (with the exception of the third) are the essentials.  I would also recommend looking up a Java tutorial for those of you especially new (I won’t be making any personal recommendations as I learned Java in college and therefore didn’t use a tutorial).  It’s also a good idea to have the Java API bookmarked for easy reference.  You should be all set and ready to jump into Java!  Happy programming!

Why Java Rocks My Freakin’ Socks!

Whether you’re a new programmer striking out on your own or a veteran looking to add another language to your arsenal, you doubtlessly must ask yourself, “Why should I learn Java?”  Frankly, there are a host of reasons to choose Java.

1. Java is Very Portable

One of the things Java is most legendary for is its portability.  What do I mean by portability?  To put it simply, when you write Java code for one system, it will (usually) work for any other system for which there exists a JVM (Java Virtual Machine).

You may be asking yourself, “How is this possible?”  The secret is in something I’ve already mentioned: the JVM.  The Java Virtual Machine is what handles Java’s interactions with the system.  The compiled java .class or .jar file communicates with the JVM which then translates for the local system.

A simple visualization of how Java works.

This is puts Java in a strange middle ground in terms of efficiency.  Compiled languages such as C++ run faster than most languages because they dictate everything the computer needs to know directly, allowing for easy optimization and efficient resource usage.  Scripting languages such as Python are on the other end of the spectrum.  Because they are not compiled, scripting languages are interpreted as they go.  The advantage they bring is unmatched flexibility and simplicity, but they are often difficult to debug and, because everything is being dictated to the computer as it is being interpreted, they can be abominably slow.

Java takes elements of both of these and creates a hybrid.  The files themselves are compiled in order to optimize their efficiency.  Then they are handled by a sort of virtual computer which then translates for the actual local computer.  Therefore, generally speaking, if a piece of Java code works on one system, it will work on any other.

2. Java is Object-Oriented

One reason many people like Java is because it is strongly object-oriented.  This means that properties like inheritance are a very prevalent feature in Java.  Therefore, programs in which there are many parent-child relationships can be structured very nicely in Java.  Object-oriented languages thrive on delegating specialized operations and constructs to “objects,” classes designed for a specific purpose.  This is different from procedural languages whose strength is handling everything in a straight-forward approach.

The reason object-oriented is so popular is because it help keep the code readable where as procedural approaches can often lead to convoluted code.  In addition, well-written, object-oriented code can lead to a large amount of self-documentation, an area in which procedural languages can often suffer.

3. Java is Popular

Okay.  This may seem like a copout reason to say Java is important to learn, but the fact of the matter is Java is one of the most widely used programming languages out there.  Knowing Java can be an important item on your resumé.  If you can show proficiency in a high number of obscure programming languages but not languages such as Java or C++, that can be a real turnoff for employers.  That is the equivalent of being a doctor who knows how to handle some exceptionally rare conditions but is at a loss when it comes to handling a simple cold.

I may be biased, but in my mind, Java is an exceptional programming language.  The bottom line is it’s portable, it’s elegant, and it’s a big name in the world of programming.  Enough said.