Overview of Java - A Brief History

concepcionsockΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 4 χρόνια και 11 μήνες)

237 εμφανίσεις

Overview of Java

CS 3250

A Brief History

January 1996:

first official release JDK 1.0

Web: applets, security, URL,
networking

GUI: Abstract Windows Toolkit (AWT)

"To be blunt, Java 1.0 was not ready for
prime time."

Core Java
, Vol. I, p. 9

A Brief History

(continued)

February 1997: JDK 1.1

Authentication: digital signatures,
certificates

Distributed computing: RMI, object
serialization, Java IDL/CORBA

Database connectivity: JDBC

Component architecture: JavaBean

Version 1.1 "filled in the most obvious gaps, greatly
improved the reflection capability, and added a new
event model for GUI programming. It was still rather
limited, though."

Core Java
, Vol. I, p. 9

December 1998:

Java 2 Platform (JDK 1.2)

Standard, Enterprise, and Micro
Editions

JFC: Swing, Java2D, Java3D

Java Cryptography Extension (JCE)

Enterprise computing: enterprise
JavaBean (EJB), servlets, Java server
page (JSP), Jini, XML

A Brief History

(continued)

More changes in 1.2 (Java 2):

Java Multimedia Framework (JMF)

Embedded systems: KVM, JavaCard

Performance enhancement: JIT,
HotSpot VM

A Brief History

(continued)

Version 1.2 "replaced the early toylike GUI and graphics
toolkits with sophisticated and scalable versions that
came a lot closer to the promise of 'Write Once, Run
Anywhere' than their predecessors."

Core Java
, Vol. I, p. 10

Versions 1.3 and 1.4:

incremental improvements to library,
performance

bug fixes

A Brief History

(continued)

"During this time, much of the initial hype about Java
applets and client
-
side applications abated, but Java
became the platform of choice for server
-
side
applications."

Core Java
, Vol. I, p. 10

Versions 5.0 (originally 1.5):

significant changes to
language
, not just
library

generic classes

features inspired by C#

"for each" loop, autoboxing, metadata

A Brief History

(continued)

"Language changes are always a source of compatibility
pain, but several of these new language features are so
seductive that we think programmers will embrace them
eagerly."

Core Java
, Vol. I, p. 10

Evolution of Java

Version

New Language Features

Classes and
Interfaces

1.0

The language itself

211

1.1

Inner classes

477

1.2

None

1524

1.3

None

1840

1.4

Assertions

2723

5.0

Generic classes, "for each" loop,
varargs, autoboxing, metadata,
enumerations, static import

3270

based on p. 10 of
Core Java
, Vol. I

Top 10 Reasons

for Using Java

Or, 10 ways to start an argument

10. Garbage Collected

C and C++ are not, but most other
modern languages are

9. Visual Studio

Platform
-
specific

Version problems

Impossible to write a small program

Lack of support for command
-
line tools


Emacs, make, javac, java

8. Multi
-
threaded

Runnable

synchronized


7. Distributed

Socket classes

Remote Method Invocation (RMI)

Serialization

6. GUI
-
less GUIs

Can make a GUI with just a text editor

Also, flexible GUIs (layouts)

5. Jobs

Personally, I haven’t heard of a good
way to measure this…

4. Pervasive

http://code.google.com/android




“The Open Handset Alliance, a group of more than
30 technology and mobile companies, is developing
Android: the first complete, open, and free mobile
platform.”

What does Microsoft think about
Android?

Also servlets, applets, JSP, current
phone platforms

3. Linux, OS X





Architecture neutral

Did I hear someone say “Mono”?

Convince me that it works, is free, and will
continue to work and be free, and I’ll take
back this slide…




2. Libraries

Thousands of classes

Comprehensive and useful
documentation

And the number one
reason is. . .



There’s nothing like ratcheting up
the suspense, right?

1. Portable, standard, and
free Graphics and GUIs


Near misses:

wxWidgets (not standard, not particularly
easy to use)

QT (not free or standard)

GTK (not standard)

.NET (not portable)


Top 10 reasons NOT to use
Java

You can’t say I’m biased…

10. Unity

Unity? Huh?

JavaScript, C#, Boo

9.
ReallyLongVariableNamesAn
dClassNamesForWhichJavaI
sFamousOrInfamous

8. Java is “hard to teach”

“Too many things that can’t be
explained at the beginning”

Do you believe it?

7. J2EE

But, some people think this is Java’s
niche

6. Java is the “new COBOL”

Do you believe it?

5. Bad press

Overhyped, misconceptions

See Professor Allison’s D paper

4. Sun’s follies

ME (and not working with Palm)

Java Media Framework

Java 3D

Quicktime for Java (OK, that’s Apple’s)

3. C# and the 900
-
pound
gorilla

2. Python, JavaScript

But, see Jython and Rhino

Maybe Ruby, D, and maybe even PHP,
but not Perl

1. Performance

Not as fast as C++ or C#

Is it fast enough?

What’s Missing

(vs. C++)

Explicit pointers

Delete operator

Destructors

References (pass
-
by
-
reference)

Default arguments

What’s Missing

(vs. C++)

Globals

Local static data

Operator overloading

Multiple (implementation)
inheritance

Separation of declaration and
definition

Templates (“generics” added in 1.5)

What’s New

Everything resides in a class

Data and functions

Garbage collection

Fewer memory management headaches

Exceptions not optional

Unicode encoding

Portable:

Threads

Networking

Data sizes

Java Architecture

Java code is compiled into platform
-
independent “byte code” (“javac.exe”)

Each class in its own .class file


The Java Virtual Machine runs in the
target environment (“java.exe”)

Interprets the byte code

Advantage: portability (“write
-
once
-
run
-
anywhere”)

Disadvantage: degraded performance

JIT Compilation

“Just
-
in
-
time” compilation

The JVM has the JIT compiler compile
the code into native machine code

10
-
20 times faster than classic JVM
interpretation

public class Hello

{


public static void main (String[] args)


{


System.out.println("Hello, world");


}

}

First Java Application

Every program must have at least one class

Source file must be class name plus ".java"


public class Hello

{


public static void main (String[] args)


{


System.out.println("Hello, world");


}

}

First Java Application

The famous "magic formula" for the main
method of a Java application:


Elements of Java Programs

Class:
Hello

Method:
main(...)

Statement:
System.out.println(...)

Comments:

// a comment

/* another comment */

/** document comment */

Source file:
Hello.java
(case sensitive)

Development Environments

Java SDK from Sun (java.sun.com)

command
-
line tools: javac, java, etc.

no editor included

netBeans (netbeans.org)

IDE, including Java beans (components)

Eclipses IDE (eclipse.org)

IDE


All of these are free

See Ch. 2 and the web sites for more information.

Compile and Run an App

using the Java SDK command
-
line tools


To compile:



javac Hello.java


To run:



java Hello