How and Why of Java – An Overview and why it’s Important

What is Java?

  • One of the world’s most important and widely used programming language which has grown stronger with every passing year.
  • It is the language of preference when it come to developing web based applications. Most of the Enterprises run on Java.
  • As Computing has advanced Java has kept pace with it.
  • An example of how Java has kept pace can be seen by the features introduced in Java SE 9 which includes Modularity, JShell etc. The available packages have been organized as modules.

How and Why Java came about?

Let’s take a quick look at the history of programming languages.

Innovation in Language design was driven by the need to solve a fundamental problem. When C was introduced it had a massive impact. At that time we din’t had any structured languages. We had languages like Fortran and Basic but they relied heavily on use of GOTO. C filled the gap for an efficient, structured and high level language.

You may ask why thenĀ C++ was introduced?

Well C was good but as the software size grew it was not easy to manage. It grew complex. C++ was born out of this reason.
C++ enhanced C by adding Object Oriented Programming principles.

So when C++ was solving complexity why did we need a new language Java?

The problem with C and C++ was that both were not portable. By portable I mean Architecture Neutral.

You can write a C program which can then be compiled to an executable code. This code is machine specific. So a C program was written for a particular machine. For a machine with different Hardware the program had to be re-written.

Java was invented to solve this same issue. A language was needed which can be used to create software that can be embedded in electronic devices. As luck would have it at the very same time World Wide Web was making waves and a language was needed which was portable. And Java filled that gap.

Java was conceived by a team at Sun Microsystems in 1971. Java which was originally aimed to solve a small scale problem went on to solve a large scale problem.

It’s not an enhanced version of C++ but it was invented to solve a different problem. It was to Internet what C is to System programming.

So how did Java achieve Portability, how did it became platform neutral?

Thanks to Java Virtual Machine(JVM). Wait a second is it a different machine? No, JVM provides a runtime environment for a Java Program.

Unlike C, Java isn’t compiled to executable code. Instead Java Compiler transforms it to Byte Code.
Byte Code is a highly optimized set of instructions. This Byte Code is run by JVM. So what we need is a JVM for every environment.

As a Java programmer you don’t have to worry about the Hardware implementation. You write programs and JVM takes care of running it for a specific machine.

Hence Java is a Portable language. Running a program in JVM also makes it secure. JVM makes sure that the program doesn’t access resources it’s not supposed to.

You may be thinking that JVM won’t give you the same performance as running executable code. Thing is JVM is pretty fast, it actually exceeds expectations. And to add to that we have Just in Time Compiler, part of JVM.

What does Just in Time Compiler do?

This transforms certain parts of Byte Code to Native Code. Although this code also runs in JVM but it’s much faster.

Summary

I hope you get an idea why Java was invented and how it helps with Portability. There is much more to Java which we will explore in coming Lectures.

Author: codesmartly

I am Enthusiastic about Learning new things and sharing my Knowledge. I like programming and have a pretty good background in Computer Science.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s