Upload
kwangshin-oh
View
1.124
Download
3
Embed Size (px)
DESCRIPTION
The Java(TM) Language - An Overview
Citation preview
The JavaTM Language - An Overview
2000. 3. 13.
Kwang Shin OhDept. of Research & Development
http://[email protected]
Copyright 2000 © Kwang Shin Oh
2JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Introduction Java Programming language
designed to solve a number of problems in modern programming practice
started as a part of a larger project to develop advanced software for consumer electronics
to devices are small, reliable, portable, distributed, real-time embedded systems
3JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java Java is a simple, object-oriented,
distributed, interpreted, robust, secure, architecture neutral, portable, high-performance, multithreaded, and dynamic language.
4JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Simple without a lot of esoteric training
and which leveraged today’s standard practice
designed as closely to C++ as possible in order to make the system more comprehensible
omits many rarely used, poorly understood, confusing features of C++
5JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Simple omitted features
operator overloading(although the Java language does have method overloading)
multiple inheritance extensive automatic coercions
added auto garbage collection simplifying the task of Java
Programming making the system somewhat more
complicated
6JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Simple complexity in many C and C++ applicat
ions storage management : the allocation and
freeing of memory automatic garbage collection benefits
makes the programming task easier dramatically cuts down on bugs
7JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Simple small
enable the construction of software that can run stand-alone in small machines
the size of the basic interpreter and class support about 40K bytes
basic standard libraries and thread support additional 175K bytes
8JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Object Oriented Object Oriented design
technique that focuses design on the data(=objects) and on the interfaces to it
OO design is very powerful facilitates the clean definition of interface makes it possible to provide reusable soft
ware
9JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Object Oriented analogy with carpentry
“object-oriented” carpenter mostly concerned with the chair he was buildi
ng secondarily with the tools used to make it
“non-object-oriented” carpenter think primarily of his tools
mechanism for defining how modules “plug and play”
10JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Distributed extensive library of routines
coping easily with TCP/IP protocols like HTTP and FTP
open and access objects across the net via URLs
same when accessing a local file system
11JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Robust must be reliable in a variety of ways a lot of emphasis
early checking for possible problems later dynamic(runtime) checking eliminating situations that are error prone
advantages of a strongly typed language(like C++) allows extensive compile-time checking s
o bugs can be found early
12JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Robust C++ inherits a number of
loopholes in compile-time checking from C relatively lax(particularly method /
procedure declarations) in Java
require declarations and do not support C-style implicit declarations
13JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Robust single biggest difference between
Java and C/C++ java has a pointer model that
eliminates the possibility of overwriting memory and corrupting data
not possible to turn an arbitrary integer into a pointer by casting
you don’t have to worry about freeing or corrupting memory
14JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Secure java enables the construction of virus-
free, tamper-free systems authentication technique are based on
public-key encryption changes to the semantics of pointers
make it impossible for applications to forge access to data structures to access private data in objects that they
do have access to closes the door on most activities of
viruses
15JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Architecture Neutral designed to support applications on network
s variety of systems with a variety of CPU and oper
ating system architectures to enable a Java application to execute anyw
here on the network the compiler generates an architecture neutral o
bject file format the compiled code is executable on many proces
sors, given the presence of the Java runtime system
16JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Architecture Neutral useful not only for networks but also fo
r single system software distribution makes the production of software that
runs on all platforms Java compiler generating bytecode inst
ructions easy to interpret on any machine easily translated into native machine code
on the fly
17JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Portable being architecture neutral is a big
chunk of being portable but there’s more to it than that
unlike C and C++, there are no “implementation dependent” aspects of the specification
sizes of the primitive data types are specified, as is the behavior of arithmetic on them(examples are int, float)
18JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Interpreted Java interpreter
execute Java bytecodes directly on any machine to which the interpreter has been ported
linking is a more incremental and lightweight process so, the development process can be muc
h more rapid and exploratory
19JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – High Performance bytecode format was designed with
generating machine codes in mind so, the actual process of generating
machine code is generally simple Reasonably good code is produced
does automatic register allocation and the compiler does some optimization when it produces the bytecodes
20JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – High Performance in interpreted code
about 300,00 method calls per second on an Sun Microsystems SPARCStation 1
0 performance of bytecodes converted to
machine code almost indistinguishable from native C or
C++
21JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Multithreaded there are many things going on at the same
time in the world around us multithreading
a way of building applications with multiple threads
Java has a sophisticated set of synchronization primitives that are based on the widely used monitor and condition variable paradigm that was introduced by C.A.R.Hoare
22JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Dynamic In a number of ways, Java is a more
dynamic language than C or C++ for example, one major problem with
using C++ in a production environment is a side-effect of the way that code is always implemented
company A produces a class library(a library of plug and
play components)
23JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Dynamic company B
buys it and uses it tin their product company A
changes its library and distributes a new release company B
will almost certainly have to recompile and redistribute their own software
problems can result when the end user gets A and B’s software independently (say A is an OS vendor and B is an application vendor)
24JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Dynamic A distributes an upgrade to its libraries
then all of the software from B will break it is possible to avoid this problem in C
++, but it is extraordinarily difficult it effectively means not using any of the l
anguage’s OO features directly
25JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Dynamic by making these interconnections
between modules later Java completely avoids these problems makes the use of the object-oriented
paradigm much more straightforward libraries can freely add new
methods and instance variables without any effect on their clients
26JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Dynamic Java uses interfaces
a concept borrowed from Objective C which is similar to a class
simply a specification of a set of methods that an object responds to
not include any instance variables or implementations
can be multiply-inherited(unlike classes) and they can be used in a more flexible way than the usual rigid class inheritance structure
27JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Dynamic classes have a runtime representation
there is a class named Class, instances of which contain runtime class definitions
in a C or C++ program have a pointer to an object don’t know that type of object it is there is no way to find out
28JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Dynamic in Java
finding out based on the runtime type information is straightforward
because casts are checked at both compile-time and runtime trust a cast in Java on the other
hand in C and C++ compiler just trusts that you’re
doing the right thing
29JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Java – Dynamic possible to look up the definition
of a class given a string containing its name
this means that you can compute a data type name and have it easily dynamically-linked into the running system
30JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Summary The Java language provides a
powerful addition to the tools that programmers have at their disposal
Java makes programming easier it is object-oriented has automatic garbage collection compiled Java code is architecture-
neutral Java applications are ideal for a
diverse environment like the Internet
31JavaTM Overview
©20
00 K
wan
g Sh
in O
h
Http://raytrust.pe.kr
Reference Sun Microsystems
The JAVATM Language:An Overview