Objects -- language characteristics
- object creation facility
- message-passing capability
- class capability
- inheritance features
Classification
- hybrid -- C, Lisp, Pascal, Prolog
- frame-based -- knowledge-based reasoning
- distributed, concurrent, actor -- parallel computing
- alternative object models -- prototypes, delegation
slide: A classification of languages
Actually, as we will see in section [dimensions], one may have
a lively debate on the proper design dimensions of object-oriented
programming languages.
An important issue in this respect is what makes a language
object-oriented as opposed to object-based.
Other issues in this debate are whether an object-oriented language
must support classes (in addition to a mechanism to create objects)
and whether (static) inheritance should be preferred above (dynamic) delegation.
This debate is reflected in a number of research efforts investigating
alternative object models and object communication mechanisms.
See section [prototypes].
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 [Sau89], they may be divided among subcategories reflecting
their origin or the area of application
for which they were developed (as shown above).
Hybrid languages
These, having originated out of (an object-oriented
extension of) an already existing language, are likely to be applied
in a similar area to their ancestor.
In practice, this category of languages (which includes C++ and CLOS) seems
to be quite important, partly because their implementation support is
as good as the implementation support for their base languages
and, more importantly, they allow potential software developers a smooth transition
from a non object-oriented to an object-oriented approach.
Frame-based languages
in contrast to the previous category, these were explicitly developed to
deal with one particular application area,
knowledge-based reasoning.
A frame is a structure consisting of slots that may either indicate a relation
to other frames or contain the value of an attribute of the frame.
In fact, the early frame-based languages such as FRL, [FRL],
and KRL, [KRL], may be
considered as object-oriented avant la lettre,
that is before object orientation gained its popularity.
Later frame-based systems, such as KEE, [KEE],
and LOOPS, [LOOPS],
incorporated explicitly object-oriented notions such
as classes and (multiple) inheritance.
Concurrent, distributed and actor languages
To promote the use of parallel processing architectures
a number of parallel object-oriented languages
have been developed, among which are the language Hybrid
(which supports active objects with their own thread of control, [Nierstrasz]),
Concurrent Smalltalk (a concurrent extension of Smalltalk),
Orient-K (a language for parallel knowledge processing)
and POOL-T (which may be characterized as a simplified version
of Ada), see [YT87].
More recently sC++, an extension of C++ with synchronous active objects
has been proposed in [Petitpierre98].
A realisation of the same concept in Java has also been
proposed, albeit without compiler support, in [Petitpierre99].
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 [BRR90] and
also section [semantics].
The idea of simultaneously active objects leads in a natural way
to the notion of distributed object-oriented languages
that support objects which may be located on geographically
distinct processors and which communicate by means of (actual)
message passing.
Examples of such languages are Distributed Smalltalk
(a distributed extension of Smalltalk that introduces so-called
proxy objects to deal with communication between
objects residing on different processors, [Bennett])
and Emerald (that supports primitives to migrate
objects across a processor network, [Black]).
All parallel/distributed object-oriented languages introduced
thus far are based on a traditional object model insofar as
an object retains its identity during its lifetime.
In contrast, the so-called actor languages support
a notion of object whereby the parallel activity of an object
is enabled by self-replacement of the object in response to a message.
Self-replacement proceeds as follows.
Each actor object has a mail-queue.
When a message arrives for the actor object,
the object invokes the appropriate method and subsequently
creates a successor object (which basically is a copy of itself
with some modifications that may depend upon
the contents of the message).
Message handling occurs asynchronously.
This scheme of asynchronous message passing enables an actor
system to execute in parallel,
since during the execution of a method the replacement object
may proceed to handle other incoming messages.
In actor systems, object identity is replaced by what
may be called mail-queue or address identity.
From a theoretical viewpoint this allows us to treat actor
objects as functions (in a mathematical sense) that
deliver an effect and another object in response
to a message.
However, pragmatically this leads to a complicated
and quite low-level object model which is hard to
implement in a truly parallel way.
Instructor's Guide
Alternative object models may also be encountered
in object-oriented database managements systems and in systems
embedding objects such as hypertext or hypermedia systems.
Script languages
Java embedding
- Javascript -- Dynamic HTML
- Perl -- CGI/Web library
JPL
- Tcl/Tk -- tclets
Jacl, Tcl Blend
- Python -- Grail
JPython
slide: Script languages
Most of the scripting languages,
including Tcl/Tk, Perl and Python,
have an extensive library for creating (server-side) Web applications.
For Tcl/Tk, there exists a Netscape plugin which allows
for the inclusion of so-called tclets (pronounce ticklets),
applets written in Tcl/Tk,
in a HTML Web page.
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 [JPython].
Java has also in other respects stimulated programming language
research,
since it appears to be an ideal platform
for realising higher level programming languages.
Originally, objects were not part of the languages Tcl/Tk and Perl.
For these languages, objects have been added in an ad hoc fashion.
In contrast, Python has been developed as an
object-oriented language from its inception.
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.
<script language=Javascript> 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>
The trick is to define a function that allocates the
storage for instance variables,
which may include references to functions.
Using the keyword new, a new structure is created
that may be used as an object.
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.
[5]
-
[up]
[top] -
[I]
[II]
[III]
[IV] -
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12] -
[A]
[R]