Java Tutorials Core Java: Chapter 1. Introduction to Java
Section 1.1. How did Java Evolved?
This section explains about why Java language evolved even though there was other programming languages like B, C, C++ in the programming world.
How did Java Evolved?
Objective:
This section explains about why Java language evolved even though there was other programming languages like B, C, C++ in the programming world. Overview:
In order to understand why Java was developed we need to understand the needs of the software environment and why languages evolved.Computer language innovation is mainly driven by two major factors: 1. Changes in the environment
2. To implement refinements and improvements in the art of programming Before Java was released there was various languages in the market like BCPL, B, C and C++ which helped to resolve and satisfy the requirements of that age. As and when there was new requirement and limitation to each language new changes was done to existing language and released with new versions / names. Lets look at each of this language in detail and understand what was the purpose & drawback of each of this programming language innovation.
BCPL Language (1966):
BCPL (Basic/Bootstrap Combined Programming Language) is a procedural (specifying the steps the program must take to reach the desired state) and structured computer programming language designed by Martin Richards of the University of Cambridge in 1966.
What was the purpose of BCPL language?
BCPL was originally intended for writing compilers for other languages. What was the drawback of BCPL?
BCPL was designed to a specific type of data representation and adequate capacity to represent any valid storage address. There was a mismatch in how BCPL’s used to represent unit of data and internal hardware was processing it. End result was that there was large amount of space occupied due to this incompatibility between the language and hardware design.
Sample “Hello World!” using BCPL.
1
GET "LIBHDR"
2
LET START() = VALOF $(
3
WRITEF("Hello World!")
4
)$
B Language (1969):
B is a programming language that was developed at Bell Labs by Ken Thompson around 1969. B language is a polished / enhanced version BCPL language.
This was the language which introduced braces {} to the programming world.
What was the purpose of B language when BCPL was already there?
BCPL language was occupying large space in the memory and there was demand of programming language to be fit into smaller size of the memory capacity. In order to make program to fit within the memory capacity of the minicomputers of that time B language was developed. What was the drawback of B language?
The code of B language was not specific to any computers and was struggling to execute on advanced computers of that age. B language has typeless nature which supported many older computers but failed to adopt changes in the computers. Sample example of “Print Numbers” program written in B Language.
1
main()
2
{
3
auto a, b, c, sum;
4
a = 1; b = 2; c = 3;
5
sum = a+b+c;
6
putnumb(sum);
7
}
C Language (1969 – 1973):
C language is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories. This is named as C because it was derived from earlier language “B”. C provided low-level access to the memory and the language was simple to gain control on the machine. What was the purpose of C language when B was already there?
C language code was compiled to machine level instructions and thus the program execution in most of the advanced computer was smooth and accurate. C provided freedom to developer to gain virtually unlimited access to their systems. It was structured, efficient and high level language that replaced assembly code for creating system programs. What was the drawback of C language?
Once a C program exceeds somewhere between 25,000 and 100,000 lines of code, it becomes so complex that it is difficult to grasp as a totality. Maintenance, Extendibility and Support of the application was the biggest challenge. Sample example of “Hello World” program written in C Language.
1
/* Hello World program */
2
3
#include
4
5
main()
6
{
7
printf("Hello World");
8
}
C++ Language (1983):
C++ was invented by Bjarne Stroustrup in 1979, while he was working at Bell Laboratories in Murray Hill, New Jersey. Stroustrup initially called the new language “C with Classes.” However, in 1983, the name was changed to C++. C++ extends C by adding object-oriented features. What was the purpose of C++ language when C was already there?
C language developers were struggling to manage the complex C programs. C++ allows this barrier to be broken, and helps the programmer comprehend and manage larger programs.
C++ introduced Object Oriented Programming (OOP) methodology to organize the larger programs into relational smaller chunks.
What was the drawback of C++ language?
Similar to C language, C++ code was compiled to machine specific code (.exe) and thus with the invent of different operating system there was need for programs to write once and run on any platform. Portability of the program on multiple platform was the major challenge for C++. Program written in Windows cannot be executed in Mac OS. Sample example of “Hello World” program written in C++ Language.
// our the globally constructed application object.
20
int main()
21
{
22
return 0;
23
}
Java Language (1991):
Java was conceived by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan at Sun Microsystems, Inc. (which has since merged into Oracle Corporation) in 1991. It took 18 months to develop the first working version. This language was initially called “Oak” but was renamed “Java” in 1995. The first publicly available version of Java (Java 1.0) was released in 1995. James Gosling is remembered as Father of Java. So, Why did Java Evolved?
The trouble with C and C++ (and most other languages) is that they are designed to be compiled for a specific target. Java programming language was designed in such a way that it can be written once and executed in various OS like Mac, Unix, Windows and Linux. Thus a platform independent language was created. Apart from platform independent language there was a need for an powerful and secured language for World Wide Web. So, Java introduced a secured way of executing program on WWW called Applets.
Sample example of “Hello World” program
written in Java Language.
1
public class MyProgram
2
{
3
public static void main(String[] args)
4
{
5
System.out.println("Hello, World");
6
}
7
}
Summarize:
These were two main reason for creation of Java:
1. Platform Independent Language was required which allow developers to write program once and execute anywhere.
2. Secured program was required for World Wide Web