| | Analysis | Requirements & Principles |
architecture: Paradigms |
substance: Abstractions |
structure: Domains | building blocks: Features |
surface: Syntactics | Defining PLs |
Language List | |||||
| foundational | safety |
flexibilized
Features that extend or elaborate the model of computation[^], i.e., the "ontological foundation" of the programming language | ||||||||||||
| Feature | Description | Argument | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1. Class-based inheritance -- the reuse mechanism in classical OO. | Classes, the generators of object, are at a different level than their instances, the objects (see the following entries up to Delegation). | [C/OInh]
(+) clear distinction: inheritable classes with specialization interface, vs. objects with client interface. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 1.1 Subclassing
Common in Simula, Smalltalk, C++, Eiffel, Java etc | A new class C (the subclass) is defined by
a list of superclasses S (having members MS)
and own member definitions D (for members MD).
C inherits MS-MD from S;
overrides the intersection of MS and MD with D;
extends MS by MD-MS.
| (+) A class does not need to prepare for subclassing [Mix]
| (+) The behavior of an operation in a subclass can be completely different [Mix] (-) The superclass cannot control it [Mix] (-) The increments of a subclass cannot be reused independently from the superclass [Mix] (-) Cannot extend existing (persistent) instances, or instances created in legacy code [CombiInhHier]
| W.r.t. overriding, the following approaches can be distinguished
(c.f. [Strongtalk] Gilda Bracha, David Griswold:
Strongtalk: Typechecking Smalltalk in a Production Environment; 215-230 OOPSLA'93):
| a. invariant overriding
| in Modula-3 signature of new method must be unchanged to old one
| (-) most inflexible
| (+) modular type-safety b. covariant result overriding
| in Simula, C++ only result can be changed, to subtype
| (~) could be more flexible
| (+) modular type-safety c. subtype overriding
| in Trellis result can be changed to subtype, parameters to supertypes
| (-) relaxing parameters is not the ``natural'' direction
of program development ... c.f. Bertrand Meyer
| (+) modular type-safety d. F-bounded (e.g. matching) overriding
| in Strongtalk, PolyTOIL, TOOPL parameters (and results) can be MyType,
i.e. always the same type as self
| (+/-) only in conjunction with separation of subtyping and subclassing
| (+) modular type-safety e. Covariant overriding
| in Eiffel parameters and results can be changed to subtypes
| (~) type-save, but not modular: requires system-wide check
| f. Covariant overriding with dynamic overloading
| in O2(?), KOOL [OOPUA] as in (e), but if parameter at run-time is not of the subtype,
the the inherited method is executed.
| (-) runtime tags
| (+) type-save (+) easy to generalize to multiple dispatch g. Unlimited overriding
| in Smalltalk, Self all changes are allowed
| (+) most flexible
| (-) not type-save
| 1.2 Behavioral extension
| In Beta Like subclassing, but instead of overriding an operation,
the inherited operation calls the new code via inner.
| [Mix]:
| (-) A class needs to prepare for subpatterns. (+) A superclass controls at which point the behavior of an operation is ``extended.'' (-) The increments of a subclass cannot be reused independently from the superclass. 1.3 Mixins
| As an extension to Modula-3: [Mix] G Bracha, W Cook: Mixin-based Inheritance; OOPSLA/ECOOP'90 A mixin is a subclass without a fixed superclass
(virtual superclass).
| [Mix]:
| (+) A class does not need to prepare for subclassing. (+) The behavior of an operation can be changed completely. (+) A mixin can be reused with several superclasses. 1.4 Feature-oriented programming
| As an extension to Java: C Prehofer: Feature-Oriented Programming: A Fresh Look at Objects; ECOOP'97 Features are similar to mixins/subclasses.
Lifters define how the operations from two features
are merged when they are combined
for the instantiation of an object (or the definition of a class).
E.g. a stack lifted to a counter:
| feature Stack implements IStack {...} feature Counter implements ICounter {...} feature Counter lifts IStack { pop() { decr(); super.pop(); } } | 1.5 Type-oriented programming
(cf. type classes)
| As a proposal for Java: K De Volder, W De Meuter: Type Oriented Programming; [LSDF97] For Java:
An operation (contains) can be added to all types T
of enumerating containers with comparable elements El:
| any T implements Searchable<El> (+) Methods (e.g. contains)
can be added generically to existing classes
only requiring that they implement certain interfaces.
| 1.6 Extension hierarchies
| [CombiInhHier] Harald Ossher, Wiiliam Harrison: Combination of Inheritance Hierarchies; OOPSLA'92. Hierarchies of class extensions exist
in parallel to the (base) hierarchy of classes.
Adding an extension E for class C to the application
works like renaming C to C'
and adding class C inherit C' extendby E.
| (+) Possible extensions of a class collected in libraries
can be combined as needed.
| (+) Existing classes, their instances created in legacy code, and their persistent instances can be extended. | |||||||||||
| 2.1 Delegation (object-based inheritance)
In delegation-based languages
| Delegation is a method forwarding mechanism
entailing property sharing of methods and variables
(not just their declarations!) [SplitO].
Methods delegated from A to object B are executed in A's context (not in B's, as in Forwarding) [EnvAcq] (A) --super--> (B) ^------self----'[InhMod] | (+) sharing variables
useful for JoeAsSportsman delegating to JoeAsPerson
[SplitO]
(-) breaches encapsulation. ``Full access to an object's properties can be gained ... by creating a child of it'' [SplitO] No distinction between client and inheritor: A object cannot hilde its specialization interface [C/OInh]. |
| 2.2 Sound Delegation
In prototype systems (KR), actor systems (Act1), framebased systems (Y3) | [SplitO]: A kind of copy-on-write: Before the delegator writes an inherited variable a new variable is created for it. | [SplitO]:
(+) The frontiers between objects are clear. |
| 2.3 Encapsulated Inheritance | Only the object itself can define new objects inheriting from itself. For this mixin-methods are used. | (+) No client can access the specialization interface, it is encapsulated within the object. |
| 2.4 Viewpoints
[DelegInSplit] D Bardou, C Dony: Split Objects: a Disciplied Use of Delegation within Objects; OOPSLA'96. | Delegating objects are viewpoints (aspects, roles) organized in a property-sharing delegation hierarchy. Viewpoints and delegators together are the ``pieces'' (of the representation) of a ``split object''. ``Pieces do not have an objects status, whereas split objects do.'' In a message send the viewpoint must be named. self = the split object receiver, thisViewpoint = the used viewpoint. | (+) solves the question of the identity of viewpoint objects.
(+) ``may perhaps be a well-adapted tool for the implementation of role models'' |
| 2.5 Prototypes + Traits
[PWoC]
D Ungar et.al.: Organizing Programs Without Classes; Lisp and Symbolic Computation 4(3); 1991.
| Prototype objects are the objects replicated for cloning. Trait objects are parent objects, not cloned but shared among descendents; they represent classes. | (+) Traits requires no additional language support.
Concrete data type = prototype + trait;
abstract data type = trait;
singleton = prototype.
(+) dynamic migration to another class = redirecting the trait reference. |
| 2.6 Wixins
Sheldon Nicholi: Wixins: a new object model.; JOOP Nov/Dec'99. | A wrapper object corresponding to a mixin (static). The parent pointer `inner' (corresponding to a mixin's static `super' parameter) can be changed dynamically. | ... |
| 3 Forwarding |
Methods forwarded from A to object B
are executed in B's context (not in A's as in Delegation)
[EnvAcq]
(A) --fwd--> (B) ------.
^--self--'
| (+) B is reused as an encapsulated black-box.
(-) internal working of B's method cannot be adapted (by overriding methods). |
| 3.1 Environmental Acquisition (forwarding part -> whole) | An object (e.g a part) acquires attributes and methods from its environment (e.g its whole). Class defines (1) features mandatoryily or optionally to be acquired, (2) default implementation for optionally acquired feature, (3) specialization of acquired feature. | (+) supports graphics: when car changes color, so do its doors.
(+) forwarding to environment less complex than delegation. (!) the acquirer cannot substitute the acquiree. |
| 3.2 Fashioning (forwarding whole -> part) | Whole forwards requests to its part, if it used in place of a part without exposing the part. | (+) aGasStationAttendant .fillup (myPorsche)
more natural than
aGasStationAttendant .fillup (myPorsche .getGastank())
(+) A department object can substitute for an employee by forwarding to a representative. |
|
Some proposals describing new features for ISO C can be found in the ISO C Standard.
| Feature | Description | Argument | ||||||||||||
|
exception handling mechanism
[1] Wong, Ooi: Treating failure as a value; 29-32: SIGPLAN Notices 25/1, ACM Jan 1990. | When an exception is raised (throw in C++),
computation switches to "exceptional mode"
and continues with special "exception handling code" (catch in C++).
| | value-based reference schemes | vs OIDs [ORM1] «Because of reliance on oids, UML does not require entities to have a
value-based reference scheme.» ...
| ... «This can make it impossible to communicate
naturally at the instance level, and ignores the real world database application
requirement that humans have a verbal way of identifying objects.»
| should your MOC-with-nonlinear-control be based
on events or threads
| Why Threads Are A Bad Idea (for most purposes) (8 Slides PS) ...
| Concurrency is fundamentally hard.
Only use threads where true CPU concurrency is needed/
Use events for GUIs, distributed systems, low-end servers
| RPC - should different semantics be hidden from programmer?
| Some technical paper from sun? ...
| remote calls (distributed applications)
should not look like local calls
because failure semantics are totally different.
| weak references
| In Java 1.2: class Reference reifies references do not prevent to GC the referent
| --
| |
| | Analysis | Requirements & Principles | Paradigms | Abstractions | Domains | Features | foundational | safety | flexibile typing | Syntactics | Defining PLs | Language List |