Saturday 9 May 2015

What Is Java?

 Java was developed at Sun Microsystems. Work on Java originally began with the goal of creating a platform-independent language and operating system for consumer electronics. The original intent was to use C++, but as work progressed in this direction, the Java developers realized that they would be better served by creating their own language rather than extending C++. The effort toward consumer electronics led the Java team, then known as FirstPerson, Inc., toward developing hardware and software for the delivery of video-on-demand with Time-Warner.

Unfortunately (or perhaps fortunately, depending on your perspective), Time-Warner selected Silicon Graphics as the vendor for its video-on-demand project. This setback left the FirstPerson team with an interesting piece of software (Java) but no market in which to place it. Eventually, the natural synergies of the Java language and the World Wide Web (WWW) were noticed, and Java found a market.

What we know today as Java is both a programming language and an environment for executing programs written in the Java language. Unlike traditional compilers, which convert source code into machine-level instructions, the Java compiler translates Java source code into instructions that are interpreted by the runtime Java Virtual Machine. So, unlike languages like C and C++, on which Java is based, Java is an interpreted language.

Although most of the current excitement and anticipated use of Java are related to the Internet, and the World Wide Web in particular, Java did not begin as an Internet project. Because of this, Java is suitable for many general-purpose programming tasks and, in fact, many of the Java tools themselves are written in Java. It is a compiler development custom that a language has come of age when its compiler can be written in the language. According to this custom, the Java language has come of age. 

Java as an Internet Language

The excitement over Java as an Internet development language is related to its capability to solve two key problems with Internet content:
  • Currently, the WWW content is passive and static.
  • Delivery of WWW content is dependent on the configuration of each user's Web browser.

Java as a General-Purpose Language

Of course, the use of Java extends beyond the Web, and there is much to recommend Java as a general-purpose development language. You've already seen that Java is completely portable to a variety of hardware platforms and operating systems. In this section, you'll learn about some of Java's attributes that make it a desirable general-purpose language.

For example, because Java borrows much of its syntax and many of its concepts from C and C++, there is a preexisting pool of programmers who could quickly learn Java. However, Java goes far beyond being a mere derivative of C++. It adds to C++ in the areas of automatic memory management and language-level support for multithreaded applications. On the other hand, Java remains easier to learn and simpler to use than C++ because of those C++ features that were left out of Java: multiple inheritance, pointers, and the goto statement, among others.

Because implementations of the Java Virtual Machine can be very efficient, it is possible for Java programs to run almost as quickly as C++ programs. This is a key feature in convincing developers that Java is a viable language for non-Internet development. Because of Java's strengths as an Internet language, many of these same strengths apply when Java is used as a language for client-server development. It is very likely that as corporations do more and more Internet development in Java, they will begin to apply these same Java developers to their client-server projects. Java's strengths in terms of network awareness, security, portability, and performance make it ideally suited for corporate client-server development, as well as Internet development.

Applications and Applets

In discussing Java programs, it has become standard to refer to Java programs that are embedded in another language as appletsand to stand-alone programs as applications. For example, when you use Java to augment a World Wide Web page, the Java code is embedded within HTML code. Therefore, this is referred to as an applet. On the other hand, a Java program that is not embedded within HTML or any other language and can stand on its own is referred to as an application.

Of course, there is a subtle implication here that applications are larger (and, therefore, presumably more complex) than applets. However, this is not necessarily true. Applications and applets alike can range from simple one-class programs to programs with hundreds of classes. The implication that an applet is somehow less than an application is unfortunately a connotation it is necessary to live with in an otherwise valid distinction. 

No comments:

Post a Comment