Whatever motivation lies behind the development of a programming
language, every language is meant to serve some purpose.
Whether implicitly or explicitly stated, a programming
language is characterized by its design goals and
the applications it is intended to support.
A fortiori this holds for object-oriented programming
languages.
The impetus to research in object-oriented programming
may be traced back to the development of Simula,
which was originally intended for discrete event simulation.
As observed in
Of the 69 (standalone) object-oriented languages surveyed,
53 were research projects and only 16 were commercial products.
Of these, 14 were extensions of either Lisp (10)
or C (4).
Among the remaining languages, quite a number were derived from
languages
such as Pascal, Ada or Prolog.
There is a great diversity between the different object-oriented languages.
However, following
POOL-T also supports the notion of active objects.
Active objects have a body which allows them to execute their
own activity in parallel with other active objects.
To answer a request to execute a method, an active object must
explicitly interrupt its activity (by means of an answer or
accept statement as in Ada).
POOL-T is interesting, primarily, because it is complemented
by extensive theoretical research into the semantical foundations
of parallel object-oriented computing.
See Alternative object models
Since the introduction of Smalltalk, the predominant
notion of objects has been based on the distinction
between classes and objects.
Classes serve to describe the functionality and behavior of objects,
while objects are instance of classes.
In other words, classes serve as templates to create objects.
Inheritance, then, may be regarded
as a means by which to share (descriptions of) object
behavior.
It is generally defined on classes in terms of a derivation mechanism,
that allows one to declare a class to be a subclass of another (super)
class.
The distinction between classes and objects leads to a number
of difficulties, both of a pragmatic and theoretical nature.
(See also sections dimensions and meta for a discussion of the theoretical
problems.)
For example, the existence of one-of-a-kind classes,
that is classes which have only one instance, is
often considered unnatural.
An example of a class-less language is the language Self.
Self has a Smalltalk-like syntax, but in contrast
to Smalltalk only supports objects (containing slots)
and messages, and hence no classes.
Slots may be designated to be parent-slots which means that
messages that cannot be handled by the object itself are delegated to the
parent object.
In contrast to inheritance, which is static since the inherited
functionality is computed at object creation time, delegation
to parent objects as in Self is dynamic, since parent slots
may be changed during the lifetime of an object.
Objects in Self may themselves be used to create other objects
(as copies of the original object) in a similar way as classes
may be used to create instances.
However, the changes made to an object are propagated when cloning
object copies.
Single objects, from which copies are taken, may in other words be regarded
as prototypes, approximating in a dynamic way the functionality of
their offspring,
whereas classes provide a more static, so to speak universal,
description of their object instances.
Self employs runtime compilation, which is claimed
to result in an efficiency comparable to C in
Alternative object models may also be encountered
in object-oriented database managements systems and in systems
embedding objects such as hypertext or hypermedia systems.
JPL Jacl, Tcl Blend JPython
Scripting has clear advantages for rapid prototyping.
Disadvantages of scripting concern the lack of efficiency,
and the absence of compile-time checks.
Script languages may be extended using C/C++,
and more recently Java.
The impact of Java becomes evident when considering
that there exists a Java implementation for almost
each scripting language, including Tcl/Tk, Perl and Python.
JPython, which is the realization of Python in Java,
even offers the possibility to integrate Python classes with Java
classes, and is announced as a candidate
scripting platform for Java in
Java has also in other respects stimulated programming language
research,
since it appears to be an ideal platform
for realising higher level programming languages.
Javascript is a somewhat special case, since it allows for
the use of built-in objects,
in particular the objects defined by the
Document Object Model (DOM),
and its precursors.
Nevertheless, due to its dynamic nature, Javascript also allows
for creating user-defined objects,
as indicated in the example
below.
Which objects are available as built-in objects
depends on the environment in which Javascript programs
are executed.
In the example, there is an invocation of
the write method for a document object.
The document object, as well as other objects
corresponding to the browser environment and the contents of
the page loaded, are part of the Document Object Model,
which is discussed in more detail
in section DOM.
As an aside, Javascript has become surprisingly popular for writing
dynamic HTML pages, as well
as for writing server-side scripts.
It is also supported by many VRML (Virtual Reality Modeling Language)
browsers to define script nodes.
See section DIVA.
A reference implementation of Javascript is available,
for embedding Javascript in C/C++ applications.
draft version 0.1 (15/7/2001) Object extensions of Lisp, C and Prolog
The notion of object is to a certain extent orthogonal
to, that is independent of, language constructs around
which programming languages may be constructed,
such as expressions, functions and procedures.
Hence, it should come as no surprise that a number of (popular)
object-oriented programming languages were originally
developed as extensions of existing languages or
language implementations.
See slide 5-extensions.
Object extensions
Commercial products -- languages
Lisp-based extensions
In C-based extensions
Another very important class of object extensions
is those of C-based object-oriented languages,
of which the most well-known are Objective-C and C++.
The concepts underlying these two extensions
are radically different.
Objective-C introduces objects as an add-on to
the constructs (including structs) available
in C,
whereas C++ realizes a close (and efficient)
coupling between the struct (record)
notion of C and the concept of a class.
In other words, in Objective-C there is a clear
distinction between conventional C values and data types
such as int, float and struct on the one hand, and
objects on the other hand.
Objects have a special data type (id) which allows
them to be treated as first class elements.
To define an object class, both an interface
and implementation description must be given.
These descriptions are preceded by a special sign
to designate Objective-C specific code.
Also, method declarations (in the interface description)
and method definitions (which are to be put in the
implementation section) must be preceded by a special sign
to designate them as methods available
for clients of object instances of that class.
The object model of Objective-C
is similar to
the object model of Smalltalk.
In contrast, C++ quite radically departs from this object
model in order to achieve an as efficient as possible implementation of
objects.
The key to an efficient implementation lies
in the integration of the struct (record) construct
originally provided by C with the class concept,
by allowing functions to be members of a struct.
As explained in Object structure -- efficient mapping
Prolog-based extensions
A quite different class of object-oriented extensions,
used primarily in research laboratories,
consists of attempts to incorporate object-oriented
features in (high-level) logic-based languages, such as Prolog.
Among these are languages such as SPOOL (developed
in the context of the Japanese fifth-generation computing
project, see Script languages -- integration with Java
Scripting has become a popular way to create applications,
in particular GUI-based applications and Web applications.
Tcl/Tk and Python are extensively used for GUI-based applications.
For Web applications, scripting may be used at the client-side,
for example to customize HTML pages using Javascript,
or at the server-side, for writing CGI-scripts in (for example)
Perl.
Script languages
Objects in Javascript
function object_display(msg) { // object method
return msg + ' (' + this.variable++ + ')';
}
function object() { // object constructor
this.variable=0;
this.display = object_display;
return this;
}
var a = new object(); // create object
document.write(a.display("a message"));
document.write(a.display("another message"));
</script>
[]
readme
course
preface
1
2
3
4
5
6
7
8
9
10
11
12
appendix
lectures
resources
eliens@cs.vu.nl