Reasons to learn Java

If you need to write a program to perform a task, or you just want to learn a programming language, there are a few reasons why you should learn Java:

Java runs on any operating system
When Java code is compiled it is turned into Java bytecode. This is as near to native code as possible except that functions that are hardware-specific, such as reading from and writing to disk, are left in a non-specific format. When the program is run, software called the Java Virtual Machine or Runtime Environment converts this hardware code to native instructions on the fly. Therefore your bytecode should run on any computer with a Java Runtime Environment.
Java is completely object-oriented
Many programming languages such as C++, PHP and Perl started as procedural langauges and had support for objects added on top. The result is that the developer can mix object-oriented and procedural code. This negates many of the advantages (encapsulation, stable interfaces, scalability) of object-oriented programming (OOP). Java was designed from scratch to be completely object-oriented. Someone learning programming for the first time may well learn good OOP habits.
Java's development environment can be completely free of charge
For someone new to programming, finding the required software can be a daunting and expensive task. However, if you follow these steps, you could be writing Java code relatively quickly:
  1. Buy a decent Java book and have a good think about whether Java is right for you. If you fall asleep on the first page, you might not get far!. Tom Oakley recommends Ivor Horton's Beginning Java.
  2. Download the Java Software Development Kit (SDK) from Sun.
  3. If you're not always connected to the internet, download the Java Application Programming Interface (API) documentation. These pages are called JavaDocs and explain all of the methods and members in each class - which is invaluable when learning Java.
  4. Download a text editor. I recommend the free, open source jEdit, which happens to be written entirely in Java. If you're looking for an industrial-strength Integrated Development Environment (IDE) you may want to check out Eclipse or NetBeans. They're both free and open source too.
Java has a large and standard library of functions
Many libraries or "APIs" are included in the standard edition of Java. Therefore you can immediately use functions for generating graphical user interfaces (GUIs), networking, file input and output, parsing XML and much much more. Other programming languages often have "add-on" libraries that are non-standard or only work on certain operating systems.
Java has a standard and widely-used documentation system
When good developers write Java code, they include special comments called JavaDoc comments. They then use a free program from Sun called JavaDoc to create HTML web pages that explain what all the methods and members in their classes actually do. JavaDocs make it much much easier to use other peoples' code in your programs. All of the standard edition classes have JavaDocs.
Java has an established mechanism for writing programs to embed in web pages ("applets")
Since Netscape 2 was released in 1996, the major web browsers have supported Java applets. These are small programs that run within a web page. With the new JApplet class, you can even create full GUIs within your web page. Programs like Gallery use applets extensively.
Java has inbuilt libraries to generate web pages and web services
Many organisations are transerring a processing their data using web services. These are server-based programs that communicate via XML. Java has strong support for networking, XML and web services in general.
Java internally supports Unicode so languages and characters are not limited
If you want to use non-ASCII characters, some ASCII-based programming languages make this difficult. Howevever, Java uses Unicode so you can use non-ASCII characters in your code and make internationalisation easier.

Unfortunately, Java has a few disadvantages:

Java is regarded as slower than native compiled code
Java Runtime Environments are getting faster and the difference between modern Java code running on a modern JRE is not much slower than code written in C++ and compiled to native machine code.
Java may well require more memory than native compiled code
Java requires a JRE program to be running and so will probably always require more Random Access Memory (RAM) than an equivalent program compiled for a specific operating system and processor.
Many client machines have old versions of the Java Virtual Machine, or Microsoft's Java Virtual Machine
If you're writing Java code to be run on a client (such as a desktop computer or web browser rather than on your server), you can not be sure what version of JRE they are running, if any. This may lead to some users being unable to use your program.
Java may be considered bloated
The downside of having so many classes available to the Java standard edition is that it is a huge download and a large program in itself. Some developers want to "trim down" the standard edition to make it faster, and have more specialised classes saved as separate packages that can be installed when required.

Please comment on this article:


Message:

Privacy policy