
Dimensions of Object-Based Language Design Peter Wegner Department of Computer Science Brown University Providence RI 02912 Abstract: These features span the design space of object-based The design space of object-based languages is languages. Each relates to a different aspect of com- characterized in terms of objects, classes, inheritance, putational behavior. Objects are autonomous enti- data abstraction, strong typing, concurrency, and ties that respond to messages or operations and share persistence. Language classes (paradigms) associated a state. Classes classify objects by their common with interesting subsets of these features are operations. Inheritance serves to classify classes by identified and language design issues for selected their shared behavior. Data abstraction hides the paradigms are examined. Orthogonal dimensions representation of data and the implementation of that span the object-oriented design space are related operations. Strong typing imposes static constraints to non-orthogonal features of real languages. The on the appiicability of operations, both within and self-referential application of object-oriented metho- among objects. Concurrency allows objects to exe- dology to the development of object-based language cute concurrently with other objects and to have paradigms is demonstrated. internal concurrency. Persistence allows object iden- tity to persist across applications and to be indepen- Delegation is defined as a generalization of dent of values or keys used in object selection. inheritance and design alternatives such as non-strict, multiple, and abstract inheritance are considered. Language classes worthy of special study are Actors and prototypes are presented as examples of identified and the efficiency, simplicity, and methodol- classless (delegation based) languages. Processes are ogy of the associated paradigms is examined. We classified by their degree of internal concurrency. first consider just objects, classes, and inheritance, The potential inconsistency of object-oriented sharing then add data abstraction and strong typing, and and distributed autonomy is discussed, suggesting finally consider concurrency and persistence. Along that compromises between sharing and autonomy will the way global properties of design dimensions such be necessary in designing strongly typed object- as consistency and orthogonality are introduced and oriented distributed database languages. related to non-orthogonal features that occur in real languages. 1. Design Space for Object-Based Languages 2. Objects, Classes, and Inheritance In order to examine design alternatives for object-based languages the following “dimensions” of Objects have the following properties: language design are considered: object: An object has a set of “operations” and a that remembers the effect of operations. objects “state” classes Objects may be contrasted with functions, which have no memory. Function values are completely inheritance determined by their arguments, being precisely the data abstraction same for each invocation. In contrast, the value strong typing returned by an operation on an object may depend concurrency on its state as well as its arguments. An object may persistence learn from experience, its reaction to an operation Permission to copy without fee all or part of this material is granted provided being determined by its invocation history. that the copies are not made or distributed for direct commerical advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for The term “object-based language” may now be Computing Machinery. To copy otherwise, or to republish, requires a fee and/ defined as follows: or specific permission. ici 1987 ACM O-8979 l-247-0/87/00 10-0168 $1.50 168 OOPSLA ‘87 Proceedings October 4-8,1987 object-based language: A language is object-based The class of object-oriented languages is nar- if it supports objects as a language feature. rower than the class of object-based languages, excluding languages like Ada, Modula, and CLU but including languages like Smalltalk and C++. Support of objects is a necessary but not sufficient requirement for being object-oriented. Ada is object-based but is not object-oriented Object-oriented languages must additionally support according to our definition because its objects (pack- object classes and class inheritance: ages) do not have a class (type). CLU’s clusters are effectively classes since they serve as templates for object-oriented language: An object-based creating instances and allow instances to be “first- language is object-oriented if its objects belong to class objects” in the sense that they can be assigned classes and class hierarchies may be incrementally to variables, be passed as parameters, and be com- defined by an inheritance mechanism. That is: ponents of structures. But CLU does not have an inheritance relation for defining hierarchical relations object-oriented = objects + classes + inheritance between clusters, and is therefore not object-oriented. In accordance with our approach of naming The notions “class” and “inheritance” used in “interesting*’ language classes we call object-based the above definition can be defined as follows: languages which require every object to have a class “class-based” or “classical” languages. class: A class is a template (cookie cutter) from which objects may be created by “create” or “new” class-based (classical) languages: An object-based operations. Objects of the same class have common language is class-based (classical) if every object has operations and therefore uniform behavior. Classes a class. have one or more “interfaces” that specify the opera- tions accessible to clients through that interface. A Class-based languages are a proper subset of “class body” specifies code for implementing opera- object-based languages, while object-oriented tions in the class interface. languages are in turn a proper subset of class-based languages. Ada is an example of an object-based inheritance: A class may inherit operations from language that is not class-based while CLU is an “superclasses” and may have its operations inherited example of a class-based language that is not object- by “subclasses”. An object of the class C created by oriented. This hierarchy of language classes is illus- the operation “C new” has C as its “base class” and trated in Figure 1. may use operations defined in its base class as well as operations defined in superclasses. Inheritance from a single superclass is called single inheritance; inheri- tance from multiple superclasses is called multiple t classes inheritance. i @&y&.;;;;:, Ada, Actors Inheritance is here defined narrowly as a mechanism for resource sharing in class hierarchies. In the literature the term is used loosely to denote a variety of other forms of hierarchical resource shar- i Simula,Smalltalk ing. We will later define “delegation” as a more gen- eral class-independent term for dynamic hierarchical resource sharing. Figure 1: From Object-Based to Object- The class of object-based languages includes Oriented Languages Ada [DOD], Modula [Wi], CLU [LSAS], and Actor languages [Ag] but not Pascal, Algol, or Fortran. Figure 1 may be viewed as an inheritance Ada’s objects are realized by packages, Modula’s hierarchy which uses object-oriented techniques to objects are called modules, and CLU’s objects are classify object-based languages. We may think of instances of clusters. class-based languages as inheriting the attributes of object-based languages, and of object-oriented languages as in turn inheriting the attributes of both 0&&r 4-a, i 987 OOPSLA‘87 Proceedings 189 the class-based and the object-based languages. This strong typing: A language is strongly typed if type self-application of object-oriented methodology to compatibility of all expressions representing values object-based languages both illustrates its general can be determined from the static program represen- power in classifying and organizing knowledge and tation at compile time. provides substantive insight into the particular domain which is the subject of this paper. Object-oriented languages with data abstrac- It is not surprising that object-oriented inheri- tion and strong typing are a narrower class of tance surfaces as a technique for defining the relation languages with stronger structuring properties than between language classes. Figure 1 classifies the class we have chosen to call object-oriented. This languages into hierarchies by imposing progressively narrower class excludes Simula, whose objects are not stronger requirements on the features they possess. data abstractions because their instance variables Such classification is precisely the purpose of inheri- can be accessed by other objects, and Smalltalk, tance in object-oriented systems, as pointed out in which is not strongly typed because its variables may [we]. be assigned values of different type at different points We briefly consider the impact of objects, of execution. The term “object-oriented” has been classes, and inheritance on programming methodol- carefully defined to be sufficiently narrow to exclude ogy. Objects serve to group operations with the data languages like Ada, Modula, and CLU and sufficiently they will transform and provide a data-oriented prin- broad to include languages like Simula and ciple for program design. Classes serve to manage Smalltalk. collections of objects, allowing
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages15 Page
-
File Size-