Lecture 2 - History of OOP and Java

buninnateSoftware and s/w Development

Nov 18, 2013 (3 years and 7 months ago)

70 views

1

A BRIEF HISTORY OF OOP

AND

JAVA PROGRAMMING
LANGUAGE


Ziya Karakaya






Atılım University

Tel: (312) 4602020 / 5345 Faks: (312) 460 20 37

E
-
posta: ziya
@atilim.edu.tr



2

History of Object
-
Oriented
Programming Languages


Almost all major concepts of OOP, such as
objects, classes, and inheritance
hierarchies, were developed in the 1960s


Simula

language, by Norwegian Computing
Center


In the 1970s, Alan Kay developed
Smalltalk

language at Xerox PARC (the Palo Alto
Research Center)


targeted to be understandable to people
with no prior training in computer use


demonstrated by experiments conducted
using children as programmers

3

History (cont’d)


Bjarne Stroustrup at Bell Labs who had
learned Simula during his Ph.D. studies
developed C++ as an extension of C



Later many other OOP languages were
developed: Eiffel, Objective
-
C, Actor,
Object Pascal, etc.



Since 1986 (first OOPSLA conference)
OOP is a mainstream player in the PL
domain the rather than a revolutionary one.

4

Why Java ?


We w
ill explore the OOP in the context of
Java programming language.


OOP has been a hot topic for over a decade


Java has recently become the commonly
perceived embodiment of object
-
oriented
ideas


5

Java Programming Language


Java is a general purpose programming
language that can be used to create almost
any type of computer program.



Especially, it can be used to create
programs intended for execution across the
Internet.

6

The History of Java


It was named
Oak

in 1991 at Sun Microsystems.


A computer scientist, James Gosling, developed
Oak for use in embedded consumer electronic
applications, such as VCRs.


This development purpose has determined many
of the characteristics of the language.


Size

and
reliability

are key features.


The processors that run in embedded systems are
very small and has very little memory. A program
must be able to be translated into a very concise
encoding.


Embedded systems should almost never fail.

7


Java has these features.


Pointers and goto statement were
eliminated.


Exception
-
handling is enforced to handle
the unexpected in a graceful fashion



Unfortunately, Java (or Oak) as a language
for embedded consumer electronics
did not
materialize

at that time!

8

Evolution of World Wide Web


World Wide Web was developed in the
early 1990s by a small group of scientists
at a research lab in Switzerland.


As a mean of quickly communicating
research results to a physically far
-
flung
set of colleagues.


To understand how Java fits into the
WWW, one must understand about the
concepts of clients and servers and the
difference between
server
-
side computing

and
client
-
side computing
.


9

Client
-
Side Computing


The Internet is a classic example of a
client/server

system.


A person using the Internet works at his or her
own computer, which runs an Internet
-
aware
application, such as a
Web browser
. This is called
the
client

system
.


The client application communicates over the
Internet with another computer. For example, a
Web browser might request the information on a
Web page stored on a distant computer.


This computer is the
server

computer
.


The client computer then determines how to
display this information to the user.


10

Client
-
Side Computing


In the past these programs are executed on the
server computer. The client transmitted a
request, and the server responded by executing a
program and transmitting the result.



Several performance problems occur


There exists a delay between the moment when the
client asks that a program be executed and the time
the results are returned.


Server programs often deal with many clients at
once, reducing performance.

11

Client
-
Side Computing


In client
-
side computing, rather than
executing the program on the server side
and transmitting the result, the server will
transmit the
program

to the client.


The client will execute the program locally.


Advantages:


Program run on a less heavily loaded system


Only delay is the time to transmit the
program


user interactions take place
locally.

12

Bytecode Interpreter and Just
In Time Compilers


Client many not know what type of machine the
server is using.


The traditional concept of computer programs being
translated into machine code for a specific machine
will not work.


Java is translated into a device
-
independent
bytecode
.


This Bytecode is like a machine language for an
imaginary machine, a Java
-
specific machine, or
Java
Virtual Machine (JVM)


Each computer that runs Java programs then
processes these bytecodes into a form that works
correctly on the current system.

13

Interpreters vs. JIT Compilers


The easiest scheme is to have an
interpreter

that reads and executes
bytecodes one by one.


A better performance can be obtained by
using a
just
-
in
-
time

(
JIT
) compiler
.


This system takes the Java bytecodes and
translates them into the machine code
native to the client system.


These programs then run as fast as any
compiled program created specifically for
the client computer.


14

Security Issues


A program running on the client side could
have full access to the client computer
resources.


There is potential for such a program to do
significant damage, such as erasing files from
a hard drive.


Java programs use a
security manager

provided by the client.


It limits the actions that can be performed by the
Java program provided by the server.


For example, no access to the file system or access to
other machines across the Internet.

15

Specialization of Interfaces


The sequences of commands needed to
perform graphical operations varies greatly
from one machine to another.


The solution to this problem requires a
careful coordination between the client and
server computers.


Portions of a Java program originating on
one machine, and other parts coming from
the second.


The server program is structured in terms
of generic classes, such as Window and
Button.

16


Generic classes

are the same regardless of
the type of system on which the Java
program is run.


When executed, these components create
a
peer

component
.


The peer component originates on the client
system and is not part of the server
program.


Thus, a button running on a PC will create a
PC
-
Button peer
, while the same program
running on a Macintoch will create a
Mac
-
Button peer
.

17

18

The White Paper Description


Java is a simple,
object
-
oriented
, network
-
savvy,
interpreted
, robust,
secure
,
architecture neutral,
portable
, high
-
performance,
multithreaded
, dynamic
language.



“A buzzyword heavy description”

19

Java is Simple


Simpler than C++:


No preprocessor.


Far fewer special cases.


No confusing features such as overloaded
operators, independent functions, global
variables, goto statement, structures, or
pointers
.


Augmented with a larger library of
high
-
level development tools.

20


A Remark on Pointers


In many languages, there is a distinction
between a
value

vs. a
pointer to a value
:


Values are static, fixed
-
size entities


Pointers are dynamic quantities filled at run
-
time.


There are important reasons why object
-
oriented
language should make heavy use of pointers.


Java does so, but implicitly. Everything is internally
a pointer.


Elimination of this construct removes common
errors, making it easier to construct reliable and
correct programs.

21

Java

is Object
-
Oriented


Java has no functions and no variables that
can exist outside of class boundaries.


Thus, all Java programs must be built out of
objects.


C++ and Object Pascal (Delphi) combine OO
features on top of an existing, non
-
object
-
oriented language.


Programmers can continue working in old,
non
-
object
-
oriented fashion.


By forcing all programs into an object
-
oriented structure, benefits of OO are
realized. (encapsulation, reusability)

22

Java is Network Savvy


The language provides a rich set of tools
for programming across a network.


The Java standard library provides classes
for describing universal resource locators
(URLs) and for execution in controlled
environments such as a World Wide Web
browser.


23

Java is Interpreted


Java was designed for a multicomputer execution
environment.


Any type of computer could be used as a Java
virtual machine.


Java programs were compiled into bytecodes ,
could be stored on any type of machine. An
interpreter would read the bytecodes and execute
them.


Interpreters are much slower in execution.


A
just
-
in
-
time

(
JIT
) compiler is a system that
read machine
-
independent bytecode and
translates them into actual machine instructions.

24

Java is Robust


The Java language and associated libraries
are designed to be
graceful

in the presence
of hardware and software errors.


The use of
exception handling
.


Programmers are forced into thinking about
potential source of errors.


Java has an
automatic memory
management
,
garbage collection
.


It detects and recovers memory that is no
longer being used by the current running
program.

25

Java is Secure


Multi
-
level Security System


First Level:


Eliminating pointers remove the most common errors.


The Java language insists that array index values are
cheked before the are referenced.


All variables must be assigned values before being
used.


Second Level:


Bytecodes are checked for common errors.


Such as they do not access classes incorrectly, overflow
or underflow the operand stack, or use illegal data
conversions


Java programs are restricted in the type of operations
they can perform.


When they execute a program brought over the network,
their local computers are safe from tampering.

26

Java is Architecture Neutral


Java bytecodes work with all machines.


A Java program is the same whether it runs
on a PC. a Macintosh, or a Unix system.


C++ libraries differ from one platform to
another.


Thus, it is difficult to move programs
designed for the PC onto a Macintosh.


Java hides these application
-
specific
details under a layer of abstraction in the
standard Java library.

27

Java is Portable


Java programs are portable because the
Java library hides architecture
-
specific
concepts and bytecodes are the same for
all machines.


The exact same program can be compiled
on one system, then executed on many
different types of systems.


28

Java is High
-
performance


Just
-
in
-
time compilers allow platform
-
dependent Java programs to be executed
with nearly the same run
-
time performance
as conventional compiled languages.

29

Java is Multithreaded


Java is one of the first languages to be
designed for multiple threads of execution
running in one program.


It is easy to set up multitasking.


The coordination of these parallel processes
is also relatively simple.

30

Java is Dynamic


Because Java programs move across the
Internet and execute on the user’s local
computer, they permit a degree of dynamic
behaviors impossible in older style systems.