Perfect Quote You know youve achieved perfection in




















- Slides: 20
“Perfect Quote” You know you've achieved perfection in design, Not when you have nothing more to add, But when you have nothing more to take away. - Antoine de Saint Exupery. CS 884 (Prasad) Java Goals 1
Language Design • One thing the language designer should not do is to include untried ideas of ones own. The task is one of consolidation, not innovation. - C. A. R. Hoare • In language design, the central problem is to organize a variety of concepts in a way which exhibits uniformity and generality. - J. C. Reynolds CS 884 (Prasad) Java Goals 2
• Conflicting goals lead to difficult trade-offs. – Safety checks “burden” the compiler and/or the run-time. – Safety and machine independence may exclude efficient low-level operations. – Type systems restrict programming style in exchange for strong guarantees. CS 884 (Prasad) Java Goals 3
A language addition should whenever possible solve new problems beyond its original purpose --- not create new problems through its interaction with other mechanisms. A prudent language designer, having toyed with a possible new facility, and encountering incompatibilities with more important properties of the design, quickly retreats. -- Bertrand Meyer CS 884 (Prasad) Java Goals 4
Language Specification Programs – (dynamic) Software Machinery – (static) Naming Environments • What entities can be named? • How are the names organized into groups? • How are the names made known where ever they are needed? Conventions are no substitute for enforced constraints. CS 884 (Prasad) Java Goals 5
Java : Design Goals A general-purpose concurrent object-oriented language for the Internet. CS 884 (Prasad) Java Goals 6
Top Ten Design Goals CS 884 (Prasad) Java Goals 7
Simplicity • Programmer Perspective – Automatic garbage collection. – “Unconstrained” array type. • Implementer Perspective – Only “single” class inheritance. – Restricted overloading. • E. g. , Pascal > Modula-2 > Modula-3. CS 884 (Prasad) Java Goals 8
Portability – Hardware Independence • Java source => “Architecture Neutral” Byte code – Operating System Independence • Java APIs for I/O, networking, GUI, concurrent programming, etc. CS 884 (Prasad) Java Goals 9
Portability • Architecture-neutral. – Size of integer, char, etc and meaning of floating point operations fixed by the language (not by an implementation). • All “behavioral” aspects of a Java program defined by the Java language spec. – Order of evaluation of operands fixed. – Error and Exception handling. CS 884 (Prasad) Java Goals 10
Object-Oriented Programming • Programming with abstract data types – Data Abstraction • Separation of Spec. and Impl. – Modularity • Logically related entities are textually close. – Encapsulation • Controlling visibility of names. • Code and Interface Reuse – Inheritance ; Dynamic binding CS 884 (Prasad) Java Goals 11
Java • Class-based language. • Has object types (based on classes). • Subclassing implies subtyping – but there is subtyping independent of subclassing. • Static typing CS 884 (Prasad) Java Goals 12
Reliability and Robustness • Strong Typing – every variable and every expression has a type known at compile-time. – type limits the values a variable can hold and the values an expression can produce at runtime. • Exceptions – signaling violation of semantic constraints. CS 884 (Prasad) Java Goals 13
Java : Compiler and Interpreter source code javac byte code java mips CS 884 (Prasad) native code pentium Java Goals sparc alpha 14
CS 884 (Prasad) Java Goals 15
Interpretation and Security • Java programs are compiled into byte codes for a (hardware-independent) Java Virtual Machine, and is executed by an interpreter. • Just-In-Time compiler converts byte codes into native codes, for efficiency. • An interpreter for JVM verifies and then executes Java byte codes. This step incorporates Security Checks. CS 884 (Prasad) Java Goals 16
Evolution of Sun’s JDK • Java 1. 0: Interpreter • Java 1. 1: Interpreter + JIT Compiler • Java 2 : Hotspot • Profiling and Adaptive Dynamic Compilation of “hot” code • Method in-lining and other aggressive optimizations, and Decompilation • Improved Memory Management for long-running (server) programs • Fast Thread Synchronization CS 884 (Prasad) Java Goals 17
Concurrent Programming • Threads can share address space. In Java, threads are modeled after Hoare’s monitors. • Java is a multi-threaded system, which is very convenient for coding interactive or multi-media applications. – Doing I/O concurrently with reading a document. (downloading via browser) – Periodic updating of the screen with data acquired in real-time. (sports/stocks ticker) CS 884 (Prasad) Java Goals 18
Distributed Processing • HTML and WWW contributed immensely to the sharing of (distributed) static data. • CGI scripts enabled customization of responses based on user input (client-server). • A Java applet can further react to user input and change behavior dynamically. It can provide an alternative to client-server model in that it runs on the client machine. CS 884 (Prasad) Java Goals 19
(cont) • Java supports network programming. • Java supports mobile computing. – Compiled to compact, platform independent byte codes – Dynamic linking. – KVM CS 884 (Prasad) Java Goals 20




















