Introduction to Java 

Introduction to Java
  • Java was originally developed at Sun Microsystems in 1991 to provide a platform-independent programming language and operating system for consumer electronics (TV sets, toasters and VCRs). 
  • In syntax and execution, Java is a lot like a simplified version of C++. ("simplified" should be read in the previous sentence as "an improved"). It is a highly robust, distributed, high performance, object-oriented, multi-threaded language with all of the usual features. As such, it builds upon years of C++ development, taking the good and dispensing with the bad. 
  • As it so happened however, Java did not make it into the consumer electronics market. Instead it wound up in our web browsers. 
  • Java seemed to be a perfect fit for the web. The language itself was extremely small (as it was built to go inside toasters and alarm clocks with tiny amounts of memory). Thus it could quickly be transferred over the web. 
  • Further, Java was platform independent. That is, any computer with a Java virtual machine can run a Java program. Programs can be written anywhere and be run anywhere. This is crucial because if a language can not run on any machine, it cannot be used on the web that must service every machine, language, and environment imaginable. 
  • Platform independence works because Java is an interpreted rather than a compiled language. Unlike C or C++ code, when Java is compiled, it is not compiled into platform specific machine code, but into platform independent byte code. This byte code is distributed over the web and interpreted by a virtual machine (typically built right into a web browser these days) on whichever platform it is being run. Perhaps a picture would be useful... 
  • Thus, as a programmer, you need only concern yourself with the generic Java programming language and compile your applications into bytecode on whatever system you are using. You can then be assured that your bytecode will be executed correctly whether your clients are using Macs, Pcs, Unix boxes or anything else. 
  • Perhaps the best summary of the design goals and accomplishments of Java comes from Gary Cornell in the introduction to Core Java. In this introduction, Cornell outlines 12 design principles used in the development of the Java language. To do so, he quotes from the Java White Paper from Javasoft. I will duplicate the quotes here, but you should not consider your Java Library complete without a copy of Core Java. 
Java is Simple

"We wanted to build a system that could be programmed easily without a lot of esoteric training and which leveraged today's standard practices...So even though we found that C++ was unsuitable, we designed Java as closely to C++ as possible in order to make the system more comprehensible. Java omits many rarely used, poorly understood, confusing features of C++ that, in our experience, bring more grief than benefit."

Java is Small

"Another aspect of being simple is being small. One of the goals of Java is to enable the construction of software that can run stand-alone in small machines."

Java is Object Oriented

"Simply stated, object-oriented design is a technique that focuses design on the data (= objects) and on the interfaces to it...The object-oriented facilities of Java are essentially those of C++."

Java is Distributed

"Java has an extensive library of routines for coping with TCP/IP protocols like HTTP and FTP. Java applications can open and access objects across the net via URLs with the same ease as when accessing a local file system."

Java is Robust

"Java is intended for writing programs that must be reliable in a variety of ways. Java puts a lot of emphasis on early checking for possible problems, later dynamic (run time) checking, and eliminating situations that are error prone."

Java is Secure

"Java is intended to be used in networked/distributed environments. Towards that end, a lot of emphasis has been placed on security. Java enables the construction of virus-free, tamper-free systems."

Java is Architecture Neutral

"The Java compiler [generates] bytecode instructions which have nothing to do with a particular computer architecture. Rather, they are designed to be both easy to interpret on any machine and easily translated into native machine code on the fly."

Java is Portable

"Unlike C and C++, there are no 'implementation-dependent' aspects of the specification. [For example,] the sizes of primitive data types are specified, as is the behavior of arithmetic on them"

Java is Interpreted

"The Java interpreter can execute Java bytecode directly on any machine to which the interpreter has been ported. [Thus] the development process can be much more rapid and exploratory."

Java is High Performance

"While the performance of interpreted bytecode is usually more than adequate, there are situations where higher performance is required. The bytecode can be translated on the fly into machine code for the particular CPU the application is running on."

Java is Multithreaded

"The benefits of multithreading are better interactive responsiveness and real-time behavior. [This is because a program can do more than one thing at a time]"

Java is Dynamic

"In a number of ways, Java is a more dynamic language than C or C++. It was designed to adapt to an evolving environment...Libraries can freely add new methods and instance variables without any effect on their clients."

Introduction to Java Resources

Reading and Parsing Form Data with cgi-lib.pl
Table of Contents
Introduction to Object Oriented Design


Graphics & Media Lab. >> Библиотека | Курсы | Графикон

Hosted by Graphics & Media Lab
http://graphics.cs.msu.su
lab_logo
mailto: Laboratory