Sei sulla pagina 1di 16

Handouts

Evolution of the Major Programming languages


Ada (After Ada Lovelace) A Pascal-descended language, designed by Jean Ichbiah's team at CII
Honeywell in 1979, made mandatory for Department of Defense software projects by the
Pentagon. The original language was standardized as "Ada 83", the latest is "Ada 95".

Ada is a large, complex, block-structured language aimed primarily at embedded


applications. It has facilities for real-time response, concurrency, hardware access and
reliable run-time error handling. In support of large-scale software engineering, it
emphasizes strong typing, data abstraction and encapsulation. The type system uses name
equivalence and includes both subtypes and derived types. Both fixed and floating-point
numerical types are supported.

Control flow is fully bracketed: if-then-elsif-end if, case-is-when-end case, loop-exit-end


loop, goto. Subprogram parameters are in, out, or inout. Variables imported from other
packages may be hidden or directly visible. Operators may be overloaded and so may
enumeration literals. There are user-defined exceptions and exception handlers.

An Ada program consists of a set of packages encapsulating data objects and their related
operations. A package has a separately compilable body and interface. Ada permits
generic packages and subroutines, possibly parametrised.

Ada support single inheritance, using "tagged types" which are types that can be extended
via inheritance.

Ada programming places a heavy emphasis on multitasking. Tasks are synchronised by


the rendezvous, in which a task waits for one of its subroutines to be executed by another.
The conditional entry makes it possible for a task to test whether an entry is ready. The
selective wait waits for either of two entries or waits for a limited time.

Ada is often criticised, especially for its size and complexity, and this is attributed to its
having been designed by committee. In fact, both Ada 83 and Ada 95 were designed by
small design teams to be internally consistent and tightly integrated. By contrast, two
possible competitors, Fortran 90 and C++ have both become products designed by large
and disparate volunteer committees.

ALGOL A portable language for scientific computations. ALGOL 60 was small and elegant. It
was block-structured, nested, recursive and free form. It was also the first language to be
described in BNF.

There were three lexical representations: hardware, reference, and publication. The only
structured data types were arrays, but they were permitted to have lower bounds and
could be dynamic. It also had conditional expressions; it introduced :=; if-then-else; very
general "for" loops; switch declaration (an array of statement labels generalizing Fortran's
computed goto). Parameters were call-by-name and call-by-value. It had static local
"own" variables. It lacked user-defined types, character manipulation and standard I/O.

APL (A Programming Language) A language designed originally by Ken Iverson at Harvard University
in 1957-1960 as a notation for the concise expression of mathematical algorithms. It went
unnamed (or just called Iverson's Language) and unimplemented for many years. Finally
a subset, APL\360, was implemented in 1964.
APL is an interactive array-oriented language with many innovative features. It was
originally written using a non-standard character set but now can use ISO8485. It is
dynamically typed with dynamic scope. APL introduced several functional forms but is
not purely functional.

Dijkstra got the size of it when he said that APL was a language designed to perfection -
in the wrong direction. IBM once adopted APL - can one be ruder?

Versions: APL\360, APL SV, VS APL, Sharp APL, Sharp APL/PC, APL*PLUS,
APL*PLUS/PC, APL*PLUS/PC II, MCM APL, Honeyapple, and DEC APL.

B A systems language written by Ken Thompson in 1970 mostly for his own use under Unix on the
PDP-11. B was later improved by Kerninghan(?) and Ritchie to produce C. B was used as
the systems language on Honeywell's GCOS-3.

B was, according to Ken, greatly influenced by BCPL, but the name B had nothing to do
with BCPL. B was in fact a revision of an earlier language, bon, named after Ken
Thompson's wife, Bonnie.

BASIC Beginner's All-purpose Symbolic Instruction Code. A simple language designed by John
G. Kemeny and Thomas E. Kurtz at Dartmouth College in 1963. It first ran on an IBM
704 on 1964-05-01. It was designed for quick and easy programming by students and
beginners. BASIC exists in many dialects, and is popular on microcomputers with sound
and graphics support. Most micro versions are interactive and interpreted, but the original
Dartmouth BASIC was compiled.

BASIC was originally designed for Dartmouth's experimental time-sharing system and
has since become the leading cause of brain-damage in proto-hackers. This is another
case (like Pascal) of the cascading lossage that happens when a language deliberately
designed as an educational toy gets taken too seriously. A novice can write short BASIC
programs (on the order of 10--20 lines) very easily; writing anything longer is (a) very
painful, and (b) encourages bad habits that will make it harder to use more powerful
languages well. This wouldn't be so bad if historical accidents hadn't made BASIC so
common on low-end micros. As it is, it ruins thousands of potential wizards a year.

Originally, all references to code, both GOTO and GOSUB (subroutine call) referred to
the destination by its line number. This allowed for very simple editing in the days before
text editors were considered an essential tool on every computer. Just typing the line
number deleted the line and to edit a line you just typed the new line with the same
number. Programs were typically numbered in steps of ten to allow for insertions. Later
versions, such as BASIC V, allow GOTO-less structured programming with named
procedures and functions, IF-THEN-ELSE-ENDIF constructs and WHILE loops etc.

Early BASICs had no graphic operations except with graphic characters. In the 1970s
BASIC interpreters became standard features in mainframes and minicomputers. Some
versions included matrix operations as language primitives.

BCPL (Basic CPL) A British systems language developed by Richards in 1969 and descended from CPL
(Combined Programming Language). BCPL is low-level, typeless and block-structured,
and provides only one-dimensional arrays. Case is not significant, but conventionally
reserved words begin with a capital. Flow control constructs include: If-Then, Test-Then-
Else, Unless-Do, While-Do, Until-Do, Repeat, Repeatwhile, Repeatuntil, For-to-By-Do,
Loop, Break and Switchon-Into-Case-Default-Endcase. BCPL has conditional
expressions, pointers, and manifest constants. It has both procedures: 'Let foo(bar) Be
command' and functions: 'Let foo(bar) = expression'. 'Valof $(..Resultis..$)' causes a
compound command to produce a value. Parameters are call-by-value.

Program segments communicate via the global vector where system and user variables
are stored in fixed numerical locations in a single array.

The first BCPL compiler was written in AED. BCPL was used to implement the TRIPOS
operating system, which was subsequently reincarnated as AmigaDOS.

BLISS Basic Language for Implementation of System Software. (BLISS, or allegedly, "System Software
Implementation Language, Backwards") A language designed by W.A. Wulf at CMU
around 1969.

BLISS is an expression language. It is block-structured, and type-less, with exception


handling facilities, co-routines, a macro system, and a highly optimizing compiler. It was
one of the first non-assembly languages for operating system implementation. It gained
fame for its lack of a goto and also lacks implicit dereferencing: all symbols stand for
addresses, not values.

Versions: CMU BLISS-10 for the PDP-10; CMU BLISS-11, DEC BLISS-32 for
VAX/VMS.

C A programming language designed by Dennis Ritchie at AT&T Bell Labs ca. 1972 for systems
programming on the PDP-11 and immediately used to reimplement Unix.

It was called "C" because many features derived from an earlier compiler named "B". In
fact, C was briefly named "NB". B was itself strongly influenced by BCPL. Before
Bjarne Stroustrup settled the question by designing C++, there was a humorous debate
over whether C's successor should be named "D" or "P" (following B and C in "BCPL").

C is terse, low-level and permissive. It has a macro preprocessor, cpp.

Partly due to its distribution with Unix, C became immensely popular outside Bell Labs
after about 1980 and is now the dominant language in systems and microcomputer
applications programming. It has grown popular due to its simplicity, efficiency, and
flexibility. C programs are often easily adapted to new environments.

C is often described, with a mixture of fondness and disdain, as "a language that
combines all the elegance and power of assembly language with all the readability and
maintainability of assembly language".

Ritchie's original C, known as K&R C after Kernighan and Ritchie's book, has been
standardized (and simultaneously modified) as ANSI C.

C++ One of the most used object-oriented languages, a superset of C developed primarily by Bjarne
Stroustrup <bs@alice.att.com> at AT&T Bell Laboratories in 1986.

In C++ a class is a user-defined type, syntactically a struct with member functions.


Constructors and destructors are member functions called to create or destroy instances.
A friend is a nonmember function that is allowed to access the private portion of a class.
C++ allows implicit type conversion, function inlining, overloading of operators and
function names, and default function arguments. It has streams for I/O and references.

C++ 2.0 (May 1989) introduced multiple inheritance, type-safe linkage, pointers to
members, and abstract classes.
C++ 2.1 was introduced in ["Annotated C++ Reference Manual", B. Stroustrup et al, A-
W 1990].

COBOL COmmon Business Oriented Language. A programming language for simple


computations on large amounts of data designed by the CODASYL Committee in April
1960. It is the most widely used programming language of its today. The natural language
style is intended to be largely self-documenting. It introduced the record structure.

Major revisions in 1968 (ANS X3.23-1968), 1974 (ANS X3.23-1974) and 1985.

For many hackers, COBOL is synonymous with evil, for being a weak, verbose, and
flabby language used by card wallopers to do boring mindless things on dinosaur
mainframes. Many believe that all COBOL programmers are suits or code grinders, and
would never admit to having learned the language. However, as most haven't indeed,
their judgment is somewhat questionable.

CPL (Combined Programming Language) A very complex language, syntactically based on ALGOL
60, with a pure functional subset. Provides the ..where.. form of local definitions.
Strongly typed but has a "general" type enabling a weak form of polymorphism.
Functions may be defined as either normal or applicative order. Typed array and
polymorphic list structures. List selection is through structure matching. Partially
implemented on the Titan (Atlas 2) computer at Cambridge. Led to the much simpler
BCPL. "The Main Features of CPL", D.W. Barron et al, Computer J 6(2):134-143 (Jul
1963).

Eiffel An object-oriented language produced by Bertrand Meyer in 1985. Eiffel has classes with multiple
inheritance and repeated inheritance, deferred classes (like Smalltalk's abstract class), and
clusters of classes. Objects can have both static types and dynamic types. The dynamic
type must be a descendant of the static (declared) type. Dynamic binding resolves
multiple inheritance clashes. It has flattened forms of classes, in which all of the inherited
features are added at the same level and generic classes parametrized by type.

Other features are persistent objects, garbage collection, exception handling, foreign
language interface. Classes may be equipped with assertions (routine preconditions and
post-conditions, class invariants) implementing the theory of "Design by Contract" and
helping produce more reliable software.

Eiffel is compiled to C. It comes with libraries containing several hundred classes: data
structures and algorithms (EiffelBase), graphics and user interfaces (EiffelVision) and
language analysis (EiffelLex, EiffelParse).

The first release of Eiffel was release 1.4, introduced at the first OOPSLA in October
1986. The language proper was first described in a University of California, Santa
Barbara report dated September 1985.

Eiffel is available, with different libraries, from several sources including Interactive
Software Engineering, USA (ISE Eiffel version 3.3); Sig Computer GmbH, Germany
(Eiffel/S); and Tower, Inc., Austin (Tower Eiffel).

The language definition is administered by an open organization, the Nonprofit


International Consortium for Eiffel (NICE). There is a standard kernel library.

FORTRAN (Formula Translation) The first and, for a long time, the most widely used programming
language for numerical and scientific applications. The original versions lacked recursive
procedures and block structure and had a line-oriented syntax in which certain columns
had special significance. There have been a great many versions.

The name is often written "FORTRAN", harking back to the days before computers were
taught about lower case, but ANSI decreed (circa. 1985 via the ANSI FORTRAN
Technical Committee TC that it should be "Fortran".

ICON A descendant of SNOBOL4 with Pascal-like syntax, produced by Griswold in the 1970's. Icon is a
general-purpose language with special features for string scanning. It has dynamic types:
records, sets, list, strings, and tables. It has some object-oriented features but no modules
or exceptions. It has a primitive Unix interface.

The central theme of Icon is the generator: when an expression is evaluated it may be
suspended and later resumed, producing a result sequence of values until it fails.
Resumption takes place implicitly in two contexts: iteration that is syntactically loop-like
('every-do'), and goal-directed evaluation in which a conditional expression automatically
attempts to produce at least one result. Expressions that fail are used in lieu of Booleans.
Data backtracking is supported by a reversible assignment. Icon also has co-expressions,
which can be explicitly resumed at any time.

Java (After the Indonesian island, a source of programming fluid) A simple, object-oriented,
distributed, interpreted, robust, secure, architecture-neutral, portable, multithreaded,
dynamic, buzzword-compliant, general-purpose programming language developed by
Sun Microsystems in 1995(?). Java supports programming for the Internet in the form of
platform-independent Java "applets".

Java is similar to C++ without operator overloading (though it does have method
overloading), without multiple inheritance, and extensive automatic coercions. It has
automatic garbage collection.

Java programs can run stand-alone on small computers. The interpreter and class support
take about 40 kilobytes; adding the standard libraries and thread support (essentially a
self-contained microkernel) adds an additional 175Kb.

Java extends C++'s object-oriented facilities with those of Objective C for dynamic
method resolution.

Java has an extensive library of routines for TCP/IP protocols like HTTP and FTP. Java
applications can access objects across the Internet via URLs as easily as on the local file
system.

The Java compiler and linker both enforce strong type checking - procedures must be
explicitly typed. Java supports the creation of virus-free, tamper-free systems with
authentication based on public-key encryption.

The Java compiler generates an architecture-neutral object file executable on any


processor supporting the Java runtime system. The object code consists of bytecode
instructions designed to be both easy to interpret on any machine and easily translated
into native machine code at load time.

The Java libraries provide portable interfaces. For example, there is an abstract Window
class and implementations of it for Unix, Microsoft Windows and the Macintosh. The
runtime system is written in POSIX-compliant ANSI C. Java applets can be executed as
attachments in World-Wide Web documents using either Sun's HotJava browser,
Netscape Navigator, or Microsoft Internet Explorer.
LISP LISt Processing language. (Or mythically "Lots of Irritating Superfluous Parentheses"). Artificial
Intelligence's mother tongue, a symbolic, functional, recursive language based on the
ideas of lambda-calculus, variable-length lists and trees as fundamental data types and the
interpretation of code as data and vice-versa.

Data objects in Lisp are lists and atoms. Lists may contain lists and atoms. Atoms are
either numbers or symbols. Programs in Lisp are themselves lists of symbols which can
be treated as data. Most implementations of Lisp allow functions with side-effects but
there is a core of Lisp which is purely functional.

All Lisp functions and programs are expressions that return values; this, together with the
high memory use of Lisp, gave rise to Alan Perlis's famous quip (itself a take on an Oscar
Wilde quote) that "Lisp programmers know the value of everything and the cost of
nothing".

The original version was LISP 1, invented by John McCarthy <jmc@sail.stanford.edu> at


MIT in the late 1950s. Lisp is actually older than any other high level language still in use
except Fortran. Accordingly, it has undergone considerable change over the years.
Modern variants are quite different in detail. The dominant HLL among hackers until the
early 1980s, Lisp now shares the throne with C.

One significant application for Lisp has been as a proof by example that the newest
languages, such as COBOL and Ada, are full of unnecessary crocks. When the Right
Thing has already been done once, there is no justification for bogosity in newer
languages.

Modula (MODUlar Language) Wirth's 1977 predecessor of Modula-2. The original Modula was, more
oriented towards concurrent programming, but otherwise quite similar.

["Modula - A Language for Modular Multiprogramming", N. Wirth, Soft Prac & Exp
7(1):3-35, Jan 1977].

Oberon A strongly typed procedural programming language and an operating environment evolved from
Modula-2 by Nicklaus Wirth in 1988. Oberon adds type extension (inheritance),
extensible record types, multidimensional open arrays, and garbage collection. It
eliminates variant records, enumeration types, subranges, lower array indices and for
loops.

A successor called Oberon-2 by H. Moessenboeck features a handful of extensions to


Oberon including type-bound procedures (methods).

Seneca is a variant of Oberon focussing on numerical programming under development


by R. Griesemer in April 1993 (to be renamed).

Pascal (After the French mathematician Blaise Pascal (1623-1662)) A programming language designed
by Niklaus Wirth around 1970. Pascal was designed for simplicity and for teaching
programming, in reaction to the complexity of ALGOL 68. It emphasises structured
programming constructs, data structures and strong typing. Innovations included
enumeration types, subranges, sets, variant records and the case statement. Pascal has
been extremely influential in programming language design and has a great number of
variants and descendants.

Perl A high-level programming language, started by Larry Wall in 1987 and developed as an open
source project. It has an eclectic heritage, deriving from the ubiquitous C programming
language and to a lesser extent from sed, awk, various Unix shell languages, Lisp, and at
least a dozen other tools and languages. Originally developed for Unix, it is now
available for many platforms.

Perl's elaborate support for regular expression matching and substitution has made it the
language of choice for tasks involving string manipulation, whether for text or binary
data. It is particularly popular for writing CGI scripts.

The language's highly flexible syntax and concise regular expression operators, make
densely written Perl code indecipherable to the uninitiated. The syntax is, however, really
quite simple and powerful and, once the basics have been mastered, a joy to write.

Perl's only primitive data type is the "scalar", which can hold a number, a string, the
undefined value, or a typed reference. Perl's aggregate data types are arrays, which are
ordered lists of scalars indexed by natural numbers, and hashes (or "associative arrays")
which are unordered lists of scalars indexed by strings. A reference can point to a scalar,
array, hash, function, or filehandle. Objects are implemented as references "blessed" with
a class name. Strings in Perl are eight-bit clean, including nulls, and so can contain binary
data.

Unlike C but like most Lisp dialects, Perl internally and dynamically handles all memory
allocation, garbage collection, and type coercion.

Perl supports closures, recursive functions, symbols with either lexical scope or dynamic
scope, nested data structures of arbitrary content and complexity (as lists or hashes of
references), and packages (which can serve as classes, optionally inheriting methods from
one or more other classes). There is ongoing work on threads, Unicode, exceptions, and
backtracking. Perl program files can contain embedded documentation in POD (Plain Old
Documentation), a simple markup language.

The normal Perl distribution contains documentation for the language, as well as over a
hundred modules (program libraries). Hundreds more are available from The
Comprehensive Perl Archive Network. Modules are themselves generally written in Perl,
but can be implemented as interfaces to code in other languages, typically compiled C.

The free availability of modules for almost any conceivable task, as well as the fact that
Perl offers direct access to almost all system calls and places no arbitrary limits on data
structure size or complexity, has led some to describe Perl, in a parody of a famous
remark about lex, as the "Swiss Army chainsaw" of programming.

The use of Perl has grown significantly since its adoption as the language of choice of
many World-Wide Web developers. CGI interfaces and libraries for Perl exist for several
platforms and Perl's speed and flexibility make it well suited for form processing and on-
the-fly web page creation.

Perl programs are generally stored as text source files, which are compiled into virtual
machine code at runtime; this, in combination with its rich variety of data types and its
common use as a glue language, makes Perl somewhat hard to classify as either a
"scripting language" or an "applications language" -- see Ousterhout's dichotomy. Perl
programs are usually called "Perl scripts", if only for historical reasons.

Version 5 was a major rewrite and enhancement of version 4, released sometime before
November 1993. It added real data structures by way of "references", un-adorned
subroutine calls, and method inheritance.

The spelling "Perl" is preferred over the older "PERL" (even though some explain the
language's name as originating in the acronym for "Practical Extraction and Report
Language"). The program that interprets/compiles Perl code is called "perl", typically
"/usr/local/bin/perl" or "/usr/bin/perl".

Prolog Programming in Logic or (French) Programmation en Logique. It is the first of a huge family of
logic programming languages.

Prolog was invented by Alain Colmerauer and Phillipe Roussel at the University of Aix-
Marseille in 1971. It was first implemented 1972 in ALGOL-W. It was designed
originally for natural-language processing but has become one of the most widely used
languages for artificial intelligence.

It is based on LUSH (or SLD) resolution theorem proving and unification. The first
versions had no user-defined functions and no control structure other than the built-in
depth-first search with backtracking. Early collaboration between Marseille and Robert
Kowalski at University of Edinburgh continued until about 1975.

Early implementations included C-Prolog, ESLPDPRO, Frolic, LM-Prolog, Open Prolog,


SB-Prolog, UPMAIL Tricia Prolog. In 1998, the most common Prologs in use are
Quintus Prolog, SICSTUS Prolog, LPA Prolog, SWI Prolog, AMZI Prolog, SNI Prolog.

PL/I Programming Language One (PL/S a dialect). An attempt to combine the best features of Fortran,
COBOL and ALGOL 60. Developed by George Radin of IBM in 1964. Originally named
NPL and Fortran VI. The result is large but elegant. PL/I was one of the first languages to
have a formal semantic definition, using the Vienna Definition Language. EPL, a dialect
of PL/I, was used to write almost all of the Multics operating system. PL/I is still widely
used internally at IBM. The PL/I standard is ANS X3.53-1976.

PL/I has no reserved words. Types are fixed, float, complex, character strings with
maximum length, bit strings, and label variables. Arrays have lower bounds and may be
dynamic. It also has summation, multi-level structures, structure assignment, un-typed
pointers, side effects and aliasing. Control flow constructs include goto; do-end groups;
do-to-by-while-end loops; external procedures; internal nested procedures and blocks;
generic procedures and exception handling. Procedures may be declared recursive. Many
implementations support concurrency ('call task' and 'wait(event)' are equivalent to
fork/join) and compile-time statements.

LPI is a PL/I interpreter.

Scheme (Originally "Schemer", by analogy with Planner and Conniver). A small, uniform Lisp dialect with
clean semantics, developed initially by Guy Steele and Gerald Sussman in 1975. Scheme
uses applicative order reduction and is lexically scoped. It treats both functions and
continuations as first-class objects.

Self A small, dynamically typed object-oriented language, based purely on prototypes and delegation.
Self was developed by the Self Group at Sun Microsystems Laboratories, Inc. and
Stanford University. It is an experimental exploratory programming language.

Release 2.0 introduces full source-level debugging of optimized code, adaptive


optimization to shorten compile pauses, lightweight threads within Self, support for
dynamically linking foreign functions, changing programs within Self and the ability to
run the experimental Self graphical browser under OpenWindows. Designed for
expressive power and malleability, Self combines a pure, prototype-based object model
with uniform access to state and behavior. Unlike other languages, Self allows objects to
inherit state and to change their patterns of inheritance dynamically. Self's customizing
compiler can generate very efficient code compared to other dynamically-typed object-
oriented languages.

Smalltalk The pioneering object-oriented programming system developed by the Software


Concepts Group, led by Alan Kay, at Xerox PARC in 1972. It includes a language
(usually interpreted), a programming environment, and an extensive object library.

Smalltalk took the concepts of class and message from Simula-67 and made them all-
pervasive. Innovations included the bitmap display, windowing system and use of a
mouse.

Two pseudo-variables are defined: "self" - the receiver of the current message and
"super" - an object of the current class's superclass. Smalltalk does not have multiple
inheritance so each class can have at most one superclass.

Early versions: Smalltalk-72, Smalltalk-74, Smalltalk-76 (inheritance taken from Simula,


and concurrency), and Smalltalk-78, Smalltalk-80. Other versions: Little Smalltalk, GNU
Smalltalk, Smalltalk/V.

SNOBOL String Oriented Symbolic Language - A string processing language for text and formula
manipulation written by David Farber, Ralph Griswold, and I. Polonsky of Bell Labs in
1962-3.

SNOBOL had only simple control structures but provided a rich string-matching
formalism of power comparable to regular expressions but implementated differently.
People used it for simple natural language processing analysis tasks well into the 1980s.
Since then, Perl has come into favour for such tasks.

SNOBOL was originally called "SEXI" - String EXpression Interpreter. In spite of the
suggestive name, SNOBOL is not related to COBOL.

Implementations include (in no particular order): SNOBOL2, SNOBOL3, SNOBOL4,


FASBOL, SITBOL, MAINBOL, SPITBOL and vanilla.

VisualBasic (VB) A popular event-driven visual programming system from Microsoft Corporation for
Microsoft Windows. VB is good for developing Windows interfaces, it invokes
fragments of BASIC code when the user performs certain operations on graphical objects
on-screen. It is widely used for in-house application program development and for
prototyping. It can also be used to create ActiveX and COM components.
Version 1 was released in 1991. Current version: 6, as of 1999-11-26.

Support for Object-Oriented Programming

Object Orientation
• Abstraction
• Abstract Data Type (ADT)
• Object Oriented Programming
• Object Characteristic
• Object Persistency
• Messages, Message Protocol, and Methods
• Classes
• Variables
• Inheritance
• Polymorphism
• Encapsulation
• Object Oriented Environment
Abstraction
It corresponds to the ability of human beings to focus their thinking on an element of a representation or a
concept, denoting their full attention to it while neglecting all others. The process of abstraction starts with
the identification of the common characteristics of a set of elements, and proceeds to the concise
description of these characteristics of a set of elements, and proceeds to the concise description of these
characteristics in what is conventionally called a class. The abstraction process is arbitrary, it is defined
with respect to a particular viewpoint. As a result, a real world object may be seen through different
abstractions, which implies that it is important to establish sensible criteria in the application domain of
interest.

Generalization. Abstraction ignoring and/or hiding details to capture commonality between different
instances (objects). Examples are abstract data types (the representation details are hidden), abstract syntax
(the details of the concrete syntax are ignored), and abstract interpretation (details are ignored to analyze
specific properties).

An abstraction is a view or representation of an entity that includes only the attributes of significance in a
particular context.

Abstraction is opposite of concretization.

Abstract Data Type (ADT)


A data type which internal form is hidden the set of access functions. Objects of the type are created and
inspected only by calls to the access functions. This allows the implementation of the type to be changed
without requiring any changes outside the module in which it is defined.

Data Abstraction An abstract data type, simply put, is an encapsulation that includes only the data
representation of one specific data type and the subprogram that provide the
operations for that type. Through access control, unnecessary details of the type
can be hidden from units outside the encapsulation that use the type. Program
units that use an abstract data type can declare variables of that type, even
though the actual representation is hidden from them. An instance of an abstract
data type is called an object.

Object Oriented Programming (OOP)


Writing programs in one of a class of programming languages and techniques based on the concept of an
"object" which is a data structure (abstract data type) encapsulated with a set of routines, called "methods"
which operate on the data. Operations on the data can only be performed via these methods, which are
common to all objects that are instances of a particular "class". Thus the interface to objects is well defined,
and allows the code implementing the methods to be changed so long as the interface remains the same.

Each class is a separate module and has a position in a "class hierarchy". Methods or code in one class can
be passed down the hierarchy to a subclass or inherited from a superclass.

Procedure calls are described in term of message passing. A message names a method and may optionally
include other arguments. When a message is sent to an object, the method is looked up in the object's class
to find out how to perform that operation on the given object. If the method is not defined for the object's
class, it is looked for in its superclass and so on up the class hierarchy until it is found or there is no higher
superclass. Procedure calls always return a result object, which may be an error, as in the case where no
superclass defines the requested method.
OOP started with SIMULA-67 around 1970. Popular examples of object-oriented programming languages
(OOPL) are Smalltalk, from Xerox's Palo Alto Research Center (PARC) and C++. Others include Ada,
Object Pascal, Objective C, DRAGOON, BETA, Emerald, POOL, Eiffel, Self, Oblog, ESP, POLKA and
Loops.

Object Characteristic
• State
• Behavior
• Identity

An object has an identity that characterized its own existence. The identity makes it
possible to distinguish any object in an unambiguous way, and independently from its
state. This allows, among other things, the differentiation of two objects for which all
attributes has identical values.

Object Persistency
• Persistence refers to an object's ability to transcend time or space. A persistent
object saves its state in a permanent storage system to make it possible for the
process that created the object to terminate, without losing the information
represented by the object. Later, the object may be reconstructed by another
process and will behave in exactly the same way as it did in the initial process.
• Non-persistent objects are said to be transient or ephemeral. By default, objects
are not considered persistent.

Messages, Message Protocol, and Methods


All computing in a pure object-oriented language is done by the same uniform technique: sending message
to an object to invoke one of its methods. A reply to a message is an object that returns the value of the
computation of the method.

Message A request sent to an object to invoke a method. A message is similar to a


function call, but different in that an object only responds to a
predetermined set of messages defined by its class.

Message Categories

Constructors: Create objects


Destructors: Delete Objects
Getters: (Accessors / Selectors) Return all or part of the state of an object
Setters: (Mutators / Modifiers) Change all or part of the state of an object
Iterators: Visit the state of an object or the content of a data structure that includes
several objects
Methods The subprograms that define the operations on objects of a class are called
methods. The calls to methods are often called messages.

Protocol The entire collection of methods of an object is called the message


protocol, or message interface, of the object.

A message must have at least two parts, the specific object to which it is being sent and
the name of a method that defines the request action on the object. So computations in an
object-oriented program are specified by messages sent from objects to other objects.

Class
An implementation creates multiple objects with the same behavior. An object is an instance of a class.
Types classify objects according to a common interface; classes classify objects according to a common
implementation.

A class that is defined through inheritance from another class is a derived class or subclass. A class from
which the new class is derived is its “parent class” or “superclass”

Superclass The class from which subclass inherits. It is also called base class.

Subclass A class that is derived from superclass by inheritance. The subclass contains all the
features of the superclass, but may have new features added or redefine existing features.

Variables
Class can have two kinds of methods and two kinds of variables. The most commonly used methods and
variables are called instance methods and variables. Every object of a class has its own set of instance
variables, which store the object’s state. The only difference between two objects of the same class is the
state of their instance variables. Instance methods operate only one the objects of the class. Class variables
belong to the class, rather than its object, so there s only one copy for the class. Class methods can perform
operations on the class, and possibly also on the objects of the class.

Global Variables Variables are those that are visible in all program units.

Local Variables Variables that are defined inside subprograms are called local variables because
access to them is usually restricted to the subprogram in which they are defined.

Instance Variables Variables that are per instance (object) only

Class Variables Variables that are shared among all the object of the same class (or superclasses)

Inheritance
It is the subclasses’ acquisition of its superclass state and behavior definitions. In object-oriented
programming, the ability to derive new classes from existing classes. A derived class ("subclass") inherits
the instance variables and methods of the base class ("superclass"), and may add new instance variables and
methods. New methods may be defined with the same names as those in the base class, in which case they
override the original one.

For example, bytes might belong to the class of integers for which an "add" method might be defined. The
byte class would inherit the "add" method from the integer class.

Single Inheritance Inherit from a single superclass.

Multiple Inheritances Inherit from a multiple superclasses.


Behavior Override In addition to inheriting entities from its superclass, a subclass can add new
entities and modify inherited methods. A modified method has the same name,
and often the same protocol, as the one of which it is a modification. The new
method is said to override the inherited version, which is then called an
overridden method. The most common purpose of an overriding method is to
provide an operation that is specific for objects of the subclass but is not
appropriate for objects of the superclass.

Polymorphism
The term polymorphism describe the characteristic of an element that may take on different forms, like
water that can be found in either solid, liquid, or gaseous state. In computer science, polymorphism
pertains top a concept of type theory, according to which an object name can designate instances of
different classes within a single hierarchy.

Encapsulation
Object state protection. The ability to provide users with a well-defined interface to a set of functions in a
way that hides their internal workings. In object-oriented programming, the technique of keeping data
structures and methods (procedures) together, which act on them.

Object Oriented Environment

Virtual Machine A self-contained operating environment that behaves as if it is a separate


computer. For example, Java applets run in a Java virtual machine (VM) that has
no access to the host operating system. This design has two advantages:

System Independence: A Java application will run the same in any Java VM,
regardless of the hardware and software underlying the system. Security:
Because the VM has no contact with the operating system, there is little
possibility of a Java program damaging other files or applications.

The second advantage, however, has a downside. Because programs running in a


VM are separate from the operating system, they cannot take advantage of
special operating system features.

1. An abstract machine for which an interpreter exists. Virtual machines are


often used in the implementation of portable executors for high-level languages.
The HLL is compiled into code for the virtual machine (an intermediate
language) which is then executed by an interpreter written in assembly language
or some other portable language like C.

Examples are Core War, Java Virtual Machine, OCODE, OS/2, POPLOG,
Portable Scheme Interpreter, Portable Standard Lisp, Parallel Virtual Machine,
Sequential Parlog Machine, SNOBOL Implementation Language, SODA.

2. A software emulation of a physical computing environment.

The term gave rise to the name of IBM's VM operating system whose task is to
provide one or more simultaneous execution environments in which operating
systems or other programs may execute as though they were running "on the
bare iron", that is, without an eveloping Control Program. A major use of VM is
the running of both outdated and current versions of the same operating system
on a single CPU complex for the purpose of system migration, thereby obviating
the need for a second processor.
Java Virtual Machine (JVM)
A specification for software which interprets Java programs that have been
compiled into byte-codes, and usually stored in a ".class" file. The JVM
instruction set is stack-oriented, with variable instruction length. Unlike some
other instruction sets, the JVM's supports object-oriented programming directly
by including instructions for object method invocation (similar to subroutine call
in other instruction sets).

The JVM itself is written in C and so can be ported to run on most platforms. It
needs thread support and I/O (for dynamic class loading). The Java byte-code is
independent of the platform.

There are also some hardware implementations of the JVM.

Byte-Code A binary file containing an executable program, formed by a sequence of op


code/data pairs. Byte-code op codes are most often fixed size binary patterns,
but can be variable size. The data portion consists of zero or more bits, the
format of the data portion may be determined by the identifier. The data is most
often variable in size.

In some cases, by clever design, (e.g. some RISC instruction sets) the
identifier/data pair is a fixed size. This can provide performance benefits.

A byte-code program is normally interpreted by a byte-code interpreter. The


advantage of this technique compared with outputing machine code for a
particular processor is that the same byte-code can be executed on any processor
on which the byte-code interpreter runs. The byte-code may be compiled to
machine code ("native code") for speed of execution but this usually requires
significantly greater effort for each new target architecture than simply porting
the interpreter.

For example, Java is compiled to byte-code which runs on the Java Virtual
Machine.

Object Engine

Garbage Collection The process by which dynamically allocated storage is reclaimed during the
execution of a program. The term usually refers to automatic periodic storage
reclamation by the garbage collector (part of the run-time system), as opposed
to explicit code to free specific blocks of memory.

Automatic garbage collection is usually triggered during memory allocation


when the amount free memory falls below some threshold or after a certain
number of allocations. Normal execution is suspended and the garbage collector
is run. There are many variations on this basic scheme.

Languages like Lisp represent expressions as graphs built from cells which
contain pointers and data. These languages use automatic dynamic storage
allocation to build expressions. During the evaluation of an expression it is
necessary to reclaim space which is used by subexpressions but which is no
longer pointed to by anything. This reclaimed memory is returned to the free
memory pool for subsequent reallocation.

Without garbage collection the program's memory requirements would increase


monotonically throughout execution, possibly exceeding system limits on virtual
memory size.
The three main methods are mark-sweep garbage collection, reference counting,
and copying garbage collection.

Mark-sweep garbage collection


Each cell has a bit reserved for marking which is clear initially. During garbage
collection all active cells are traced from the root and marked. Then all cells are
examined. Unmarked cells are freed.

Reference counting
A garbage collection technique where each memory cell contains a count of the
number of other cells which point to it. If this count reaches zero the cell is freed
and its pointers to other cells are followed to decrement their counts, and so on
recursively.

This technique cannot cope with circular data structures. Cells in such structures
refer (indirectly) to themselves and so will never have a zero reference count.
This means they would never be reclaimed, even when there are no references
from outside the structure.

Copying garbage collection


A garbage collection method where memory is divided into two equal halves,
known as the "from space" and "to space". Garbage collection copies active cells
from the from space to the to space and leaves behind an invisible pointer (an
"indirection") from the old position to the new copy. Once all active cells have
been copied in one direction, the spaces are swapped and the process repeated in
the opposite direction.

Memory Leak An error in a program's dynamic store allocation logic that causes it to fail to
reclaim discarded memory, leading to eventual collapse due to running out of
memory. Also (especially at CMU) called core leak. These problems were
severe on older machines with small, fixed-size address spaces, and special
"leak detection" tools were commonly written to root them out.

With the advent of virtual memory, it is unfortunately easier to be sloppy about


wasting a bit of memory (although when you run out of virtual memory, it
means you've got a “real” leak!).

Potrebbero piacerti anche