SIGPLAN Notices Vol . 26 , No. 11 , pages 299-313 , Phoenix , AZ , November 1991 . ACM Press . Object-Preserving Class Transformations Paul L. Bergstein Northeastern University , College of Computer Science Cullinane Hall , 360 Huntington Ave. , Boston MA 02115 pberg@corwin.CCS.northeastern.EDU Abstract Reorganization of classes for object-oriented programming and object-oriented database design has recently received considerable attention in the literature . In this paper a small set of primitive transformations is presented which forms an orthogonal basis for object-preserving class reorganizations . This set is proven to be correct , complete , and minimal . The primitive transformations help form a theoretical basis for class organization and are a powerful tool for reasoning about particular organizations . 1 Introduction Reorganization of classes for object-oriented programming and object-oriented database design has recently received considerable attention in the literature : -LSB- BCG +87 -RSB- , -LSB- LBSL90 -RSB- , -LSB- LBSL91 -RSB- , -LSB- AH87 -RSB- , -LSB- BMW86 -RSB- , -LSB- Cas89 -RSB- , -LSB- Cas90 -RSB- , -LSB- LM91 -RSB- , -LSB- Pir89 -RSB- , -LSB- PW89 -RSB- . A number of researchers have suggested algorithms and hueristics to produce \ good '' class organizations . A \ good '' class organization may be variously defined as one which promotes efficient reuse of code , one with a minimum of multiple-inheritance , a minimum of repeatedinheritance , or some other characteristics depending on the author 's point of view . Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial 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 Computing Machinery . To copy otherwise , or to republish , requires a fee and/or specific permission . ? 1991 ACM 89791-446-5 / 91/0010/0299 ... $ 1.50 In any case , it is usually desirable that reorganization of a class hierarchy should not change the set of objects which the classes define , that is the reorganization should be object-preserving . For object-oriented database design , this means that the database does not need to be repopulated . For object-oriented programming , this means that programs will still accept the same inputs and produce the same outputs . Furthermore , methods need not be rewritten -LRB- although they may need to be attached to different classes -RRB- . In this paper a small set of primitive transformations is presented which forms an orthogonal basis for object-preserving class organizations . This set is proven to be correct , complete , and minimal . The primitive transformations help form a theoretical basis for class organization and are useful in proving characteristics of particular organizations . The concept of a primitive set of objectpreserving class transformations was developed as part of the Demeter project to develop CASE tools for object-oriented design and programming . While the class model used in this paper is the simplified one of -LSB- LBSL91 -RSB- , the Demeter SystemTM actually uses an expanded model which includes optional parts , collection -LRB- repetition -RRB- classes , and the ability to specify concrete syntax used for parsing and printing objects . Each notation has the advantage of being programming language independent and is therefore useful to programmers who use object-oriented languages such as C++ -LSB- Str86 -RSB- , Smalltalk -LSB- GR83 -RSB- , CLOS -LSB- BDG +88 -RSB- or Eiffel -LSB- Mey88 -RSB- . The C++ Demeter System incorporates a C++ Wheel model motor Ident Gasoline_Engine Gas_tank fuel_tank LawnMower w1 w2 w3 w4 Figure 1 : Construction class code generation algorithm to translate the class definitions into C++ and generate methods for manipulating the application objects -LRB- e.g. parsing , printing , copying , comparing , traversing , etc. -RRB- . The primitive transformations discussed in this paper were very helpful in developing and analyzing the latest additions to the Demeter System : tools for the abstraction of optimal class organizations from object examples , and for the optimization of existing class organizations -LSB- LBSL91 -RSB- -LSB- BL91 -RSB- . The second section provides a brief description of the class notation . In section 3 the primitive transformations are presented along with related proofs . In section 4 some practical rules for class hierarchy optimization , which can be built from the primitive transformations , are given . 2 Class notation The class notation of -LSB- LBSL91 -RSB- uses two kinds of classes : construction and alternation classes . A construction class definition is an abstraction of a class definition in a typical statically typed programming language -LRB- e.g. , C++ -RRB- . A construction class does not reveal implementation information . Examples of construction classes are in Fig. 1 for : LawnMower , Wheel , etc. . Each construction class defines a set of objects which can be thought of as being elements of the direct product of the part classes . When modeling an application domain , it is natural to take the union of object sets defined by construction classes . For example , the motor of a lawn-mower can be either a gasoline engine or an electric motor . So the objects that can be stored in the motor part of a lawn-mower are either gasoline engine or electric Motor Electric Gasoline_Engine Figure 2 : Alternation class Motor Electric Gasoline_Engine Number DriveShaft horsepower shaft Figure 3 : Common parts motor objects . Alternation classes are used to define such union classes . An example of an alternation class is in Fig. 2 . Gasoline Engine and Electric are called alternatives of the alternation class . Often the alternatives have some common parts . For example , each motor has a drive shaft . The notation in Fig. 3 is used to express such common parts . Alternation classes have their origin in the variant records of Pascal . Because of the delayed binding of function calls to code in object-oriented programming , alternation classes are easier to use than variant records . Alternation classes which have common parts are implemented by inheritance . In Fig. 3 , Electric and Gasoline Engine inherit from Motor . Class Motor has methods and/or instance variables to implement the parts horsepower and shaft . Construction and alternation classes correspond to the two basic data type constructions in denotational semantics : cartesian products and disjoint sums . They also correspond to the two basic mechanisms used in formal languages : concatenation and alternation . The concept of a part class which is used throughout this paper needs further explanation . A part object does not have to be a physical part ; any attribute of an object is a part of it . Object o2 is said to be a part of object o1 if \ o1 knows about o2 '' . Therefore , the part-of relation is a generalization of the aggregation relation which only describes physical containment . For example , a car is part of a wheel if the wheel knows about the car . Definition 1 . A class dictionary graph OE is a directed graph OE = -LRB- V ; ? ; EC ; EA -RRB- with finitely many vertices V . ? is a finite set of labels . There are two defining relations EC ; EA . EC is a ternary relation on V ? V ? ? , called the -LRB- labeled -RRB- construction edges : -LRB- v ; w ; l -RRB- 2 EC iff there is a construction edge with label l from v to w. EA is a binary relation on V ? V , called the alternation edges : -LRB- v ; w -RRB- 2 EA iff there is an alternation edge from v to w. Next the set of vertices is partitioned into two subclasses , called the construction and alternation vertices . Definition 2 . ffl The construction vertices are defined by V C = fv j v 2 V ; 8w 2 V : -LRB- v ; w -RRB- 62 EAg . In other words , the construction vertices have no outgoing alternation edges . ffl The alternation vertices are defined by V A = fv j v 2 V ; 9w 2 V : -LRB- v ; w -RRB- 2 EAg . In other words , the alternation vertices have at least one outgoing alternation edge . Sometimes , it is more convenient to describe a class dictionary graph as a tuple which contains explicit references to V C and V A : OE = -LRB- V C ; V A ; ? ; EC ; EA -RRB- . The definition of a class dictionary graph is motivated by the interpretation in object-oriented design given in Figure 4 . During the programming process , the alternation classes serve to define interfaces -LRB- i.e. , they serve the role of types -RRB- and the construction classes serve to provide implementations for the interfaces . The standard interpretation implies that the labels on construction vertices are significant . Consider two class dictionary graphs each with only a Graph Object-oriented design Vertex Class construction alternation instantiable abstract Edge Class relationship construction alternation part-of relationship ? uses ? , ? knows ? , labels are part names inheritance relationship specialization , classification Figure 4 : Standard Interpretation single construction vertex and no edges . From a graph theoretic point of view , the graphs are equal regardless of the labels on the vertices , but if the construction vertex of one graph is labeled Integer and the vertex of the other graph is labeled String , then the two class dictionary graphs define different sets of objects in the standard interpretation . Since the mapping from construction vertices to labels is a bijection , its explicit inclusion in the definition of class dictionary graphs would only clutter the theory . When referring to an element of the construction vertices of a class dictionary graph , the reference is sometimes to a vertex and sometimes to the label of a vertex . The meaning should be clear from the context . The following graphical notation , based on -LSB- TYF86 -RSB- , is used for drawing class dictionary graphs : squares for construction vertices , hexagons for alternation vertices , thin lines for construction edges and double lines for alternation edges . Example 1 Fig. 5 shows a class dictionary graph for telephones . Telephones can either be standard or cordless and they also can be either rotary dial or touch-tone . Cordless phones have an antenna while standard phones have a handset cord . The dialer on a touch-tone phone is a keypad , whereas a rotary dial phone has a dial . For further illustration the components of the formal definition are given , i.e. : V = -LCB- Telephone , Cordless , Standard , Antenna , Handset_Cord , Dialer , Rotary , Dial , TouchTone , Keypad -RCB- VC = -LCB- Cordless , Standard , Antenna , Handset_Cord , Rotary , Dial , TouchTone , Keypad -RCB- VA = -LCB- Telephone , Dialer -RCB- EC = -LCB- -LRB- Telephone , Dialer , dialer -RRB- , -LRB- Rotary , Dial , dial -RRB- , -LRB- TouchTone , Keypad , dial -RRB- , -LRB- Cordless , Antenna , ant -RRB- , -LRB- Standard , Handset_Cord , cord -RRB- -RCB- EA = -LCB- -LRB- Telephone , Cordless -RRB- , -LRB- Telephone , Standard -RRB- , -LRB- Dialer , Rotary -RRB- , -LRB- Dialer , TouchTone -RRB- -RCB- ? = -LCB- dialer , ant , cord , dial -RCB- . Definition 3 In a class dictionary graph OE = -LRB- V ; ? ; EC ; EA -RRB- , a vertex w 2 V is alternationreachable from vertex v 2 V -LRB- we write v ? -RRB- w -RRB- : ffl via a path of length 0 , if v = w ffl via a path of length n + 1 , if 9u 2 V such that -LRB- v ; u -RRB- 2 EA and u ? -RRB- w via a path of length n . A legal class dictionary graph is a structure which satisfies 2 independent axioms . Definition 4 A class dictionary graph OE = -LRB- V ; ? ; EC ; EA -RRB- is legal if it satisfies the following two axioms : 1 . Cycle-free alternation axiom : There are no cyclic alternation paths , i.e. , f -LRB- v ; w -RRB- j v ; w 2 V ; v < > w ; and v ? -RRB- w ? -RRB- vg = ; . 2 . Unique labels axiom : 8u ; v ; v0 ; w ; w0 2 V ; l 2 ? such that v ? -RRB- u , v0 ? -RRB- u , and -LRB- v ; w -RRB- < > -LRB- v0 ; w0 -RRB- : f -LRB- v ; w ; l -RRB- ; -LRB- v0 ; w0 ; l -RRB- g 6 ? EC The cycle-free alternation axiom is natural and has been proposed by other researchers , e.g. , -LSB- PBF +89 , page 396 -RSB- , -LSB- Sno89 , page 109 : Class names may not depend on themselves in a circular fashion involving only -LRB- alternation -RRB- class productions -RSB- . The axiom says that a class may not inherit from itself . The unique labels axiom guarantees that \ inherited '' construction edges are uniquely labeled . Other mechanisms for uniquely naming the construction edges could be used , e.g. , the renaming mechanism of Eiffel -LSB- Mey88 -RSB- . Throughout the rest of this paper , the term class dictionary graph refers to a legal class dictionary graph . 3 Primitive Object-Preserving Transformations An informal definition of object-preserving has already been given in the introduction . For a formal definition we first need a definition of objectequivalence . 1 Definition 5 Given a class dictionary graph OE = -LRB- V C ; V A ; ? ; EC ; EA -RRB- , for v 2 V let PartClustersOE -LRB- v -RRB- = f -LRB- l ; A -LRB- w -RRB- -RRB- j 9v0 : v0 ? -RRB- v and -LRB- v0 ; w ; l -RRB- 2 ECg where A -LRB- w -RRB- = fw0 j w ? -RRB- w0 and w0 2 V Cg : Then , class dictionary graphs OE1 and OE2 are object-equivalent if : ffl V COE1 = V COE2 ffl 8v 2 V C : PartClustersOE1 -LRB- v -RRB- = PartClustersOE2 -LRB- v -RRB- . Intuitively , two class dictionary graphs are object-equivalent if they define sets of corresponding construction classes with the same names , and for each construction class defined by one class dictionary graph the parts are the same as those defined for the corresponding class in the other class dictionary graph . 1The most straight-forward definition would be : Two class dictionary graphs , OE1 and OE2 , are object-equivalent if Objects -LRB- OE1 -RRB- = Objects -LRB- OE2 -RRB- , where Objects -LRB- OE -RRB- is formally defined in -LSB- LBSL91 -RSB- . The equivalent definition of objectequivalence given here is more appropriate for this paper . Telephone Dialer dialer Cordless Standard ant Antenna Rotary dial Dial TouchTone dial Keypad Handset_Cord cord Figure 5 : Telephones Example 2 The two class dictionary graphs in Fig. 6 , OE1 and OE2 , are object-equivalent since : V COE1 = V COE2 = fUndergrad , Grad , Prof , TA , Admin asst , Coach , Num , Real Numg PartClustersOE1 -LRB- Undergrad -RRB- = PartClustersOE2 -LRB- Undergrad -RRB- = f -LRB- ssn , fNumg -RRB- , -LRB- gpa , fReal Numg -RRB- g PartClustersOE1 -LRB- Grad -RRB- = PartClustersOE2 -LRB- Grad -RRB- = f -LRB- ssn , fNumg -RRB- , -LRB- gpa , fReal Numg -RRB- g PartClustersOE1 -LRB- TA -RRB- = PartClustersOE2 -LRB- TA -RRB- = f -LRB- ssn , fNumg -RRB- , -LRB- salary , fReal Numg -RRB- , -LRB- assigned , fCourse , Committeeg -RRB- g PartClustersOE1 -LRB- Prof -RRB- = PartClustersOE2 -LRB- Prof -RRB- = f -LRB- ssn , fNumg -RRB- , -LRB- salary , fReal Numg -RRB- , -LRB- assigned , fCourse , Committeeg -RRB- g PartClustersOE1 -LRB- Admin asst -RRB- = PartClustersOE2 -LRB- Admin asst -RRB- = f -LRB- ssn , fNumg -RRB- , -LRB- salary , fReal Numg -RRB- g PartClustersOE1 -LRB- Coach -RRB- = PartClustersOE2 -LRB- Coach -RRB- = f -LRB- ssn , fNumg -RRB- , -LRB- salary , fReal Numg -RRB- g PartClustersOE1 -LRB- Course -RRB- = PartClustersOE2 -LRB- Course -RRB- = ; PartClustersOE1 -LRB- Committee -RRB- = PartClustersOE2 -LRB- Committee -RRB- = ; PartClustersOE1 -LRB- Real Num -RRB- = PartClustersOE2 -LRB- Real Num -RRB- = ; PartClustersOE1 -LRB- Num -RRB- = PartClustersOE2 -LRB- Num -RRB- = ; Definition 6 A class dictionary graph transformation , T , is a rule which defines an allowable modification of class dictionary graphs . Let RT = f -LRB- OE1 ; OE2 -RRB- j OE2 can be obtained from OE1 by a single application of Tg : Then T is called object-preserving if OE1 is object-equivalent to OE2 for all -LRB- OE1 ; OE2 -RRB- 2 RT . 3.1 Primitive Transformations The following five primitive transformations form an orthogonal basis for object-preserving transformations : 1 . Deletion of \ useless '' alternation . An alternation vertex is \ useless '' if it has no incoming edges and no outgoing construction edges . If an alternation vertex is useless it may be deleted along with it 's outgoing alternation edges . Intuitively , an alternation vertex is useless if it is not a part of any construction class , and ssn Num Univ_employee Grad TA Prof Coach Undergrad Adminasst Univ_student salary gpa Real_Num ssn Course assigned Occupation ssn Num Employee Grad TA Prof Coach Undergrad Adminasst Student salarygpa assigned Real_Num Faculty f1 -LRB- a -RRB- Class Dictionary Graph f2 -LRB- b -RRB- Class Dictionary Graph assigned Committee Faculty_Assignment Course Committee Assignment Figure 6 : Object-equivalent Class Dictionary Graphs it has no parts for any construction class to inherit . 2 . Addition of \ useless '' alternation . An alternation vertex , v , can be added along with outgoing alternation edges to any set of vertices already in the class dictionary graph . This is the inverse of transformation 1 . 3 . Abstraction of common parts . If 9v ; w ; l such that 8v0 , where -LRB- v ; v0 -RRB- 2 EA : -LRB- v0 ; w ; l -RRB- 2 EC , then all of the edges , -LRB- v0 ; w ; l -RRB- , can be deleted and replaced with a new construction edge , -LRB- v ; w ; l -RRB- . Intuitively , if all of the immediate subclasses of class C have the same part , that part can be moved up the inheritance hierarchy so that each of the subclasses will inherit the part from C , rather than duplicating the part in each subclass . 4 . Distribution of common parts . An outgoing construction edge , -LRB- v ; w ; l -RRB- can be deleted from an alternation vertex , v , if for each -LRB- v ; v0 -RRB- 2 EA a new construction edge , -LRB- v0 ; w ; l -RRB- is added . This is the inverse of transformation 3 . 5 . Part replacement . If the set of construction vertices which are alternation-reachable from some vertex , v 2 V , is equal to the set of construction vertices alternation-reachable from another vertex , v0 2 V , then any construction edge -LRB- w ; v ; l -RRB- 2 EC can be deleted and replaced with a new construction edge , -LRB- w ; v0 ; l -RRB- . Intuitively , if two class C1 and C2 have the same set of instantiable -LRB- construction -RRB- subclasses then the defined objects do not change when C1 is replaced by C2 in a part definition . The set of primitive object-preserving transformation given in this section is correct , i.e. any sequence of primitive transformations preserves object-equivalence ; complete , i.e. for any two object-equivalent class dictionary graphs , OE1 ; OE2 , there is a sequence of primitive operations which transforms OE1 to OE2 ; and minimal , i.e. none of the primitive transformations can be derived from any set of the others . 3.2 Proofs 3.2.1 Correctness Each primitive operation preserves objectequivalence . 3.2.2 Completeness Given two object-equivalent class dictionary graphs , OE1 and OE2 , OE1 can be transformed to OE2 using only primitive operations as follows : 1 . Use primitive operation 2 -LRB- addition of useless alternation -RRB- to \ superimpose '' the alternation subgraph of OE2 onto OE1 . Since there are no alternation cycles in OE2 , there must be some v 2 V AOE2 with outgoing alternation edges only to construction vertices -LRB- if there are any alternation vertices at all -RRB- . For each such alternation vertex , add a new alternation vertex to OE1 with alternation edges to the corresponding construction vertices . Now continue adding new alternation vertices corresponding to alternation vertices in OE2 that have outgoing alternation edges only to construction vertices and alternation vertices which have already been added in OE1 until all the alternation vertices in OE2 are duplicated in OE1 . 2 . Use primitive operation 4 -LRB- distribution of common parts -RRB- to remove the outgoing construction edges from all of the original alternation vertices in OE1 . Distribution of common parts is applied repeatedly until all of the parts are attached directly to construction vertices . 3 . Use primitive operation 3 -LRB- abstraction of common parts -RRB- to move construction edges up the \ new '' inheritance hierarchy in OE1 until they are all attached to vertices corresponding to the vertices where they are attached in OE2 . This must be possible since OE1 and OE2 are object-equivalent . At this point OE1 and OE2 have the same number of construction edges and the construction edges have the same labels and the same sources , but may have different targets . 4 . Use primitive number 5 -LRB- part replacement -RRB- to move any construction edge with an \ old '' alternation vertex or construction vertex as its target so that its target corresponds to the proper vertex in OE2 . 5 . Use primitive transformation 1 -LRB- deletion of useless alternation -RRB- to delete the \ old '' alternation subgraph from OE1 . At this point there are no construction edges -LRB- either incoming or outgoing -RRB- attached to any of the \ old '' alternation vertices . Also , since there are no cycles in the old alternation subgraph , and since we have not added any edges from \ new '' alternation vertices to \ old '' alternation vertices or vice versa , at least one of the \ old '' alternation vertices must be \ useless '' -LRB- if there are any at all -RRB- . After deleting that useless alternation vertex the condition still holds , so we can continue deleting the \ old '' alternation vertices until there are none left . Now OE1 = OE2 . 3.2.3 Minimality No primitive transformation can be derived from any set of the others since : ffl No sequence of primitive operations can reduce the number of alternation vertices without deletion of useless alternations . ffl No sequence of primitive operations can increase the number of alternation vertices without addition of useless alternations . ffl No sequence of primitive operations can reduce the number of construction edges without abstraction of common parts . ffl No sequence of primitive operations can increase the number of construction edges without distribution of common parts . ffl No sequence of primitive operations can change the construction edge in-degree of a vertex from to 1 or from 1 to without part replacement . Example 3 This example illustrates the construction of the completeness proof with the class dictionary graphs of Figure 6 . Note that although the labels on construction vertices are significant , the labels on the alternation vertices are only provided as a means of referring to particular vertices in the following discussion . Addition of Useless Alternations . In OE2 there are three alternation vertices which have outgoing alternation edges only to construction vertices : Faculty , Assignment , and Student . These are added to OE1 along with their outgoing alternation edges . Next , the Employee vertex is added with its outgoing alternation edges , including an edge to Faculty . Finally , the Occupation vertex is added along with its edges to Student and Employee . At this point OE1 has been transformed to the class dictionary graph shown in Figure 7 . Distribution of Common Parts . The ssn and gpa parts are distributed from class Univ student to classes Undergrad and Grad where they are inherited . Similarly , parts ssn and salary are distributed from Univ employee to TA , Prof , Admin asst , and Coach . The result is the class dictionary graph shown in Figure 8 . In a deeper inheritance hierarchy some parts might need to be distributed repeatedly until they are attached directly to construction classes . Abstraction of Common Parts . Parts ssn and gpa are abstracted from Undergrad and Grad to Student . Next , parts ssn , salary , and assigned are abstracted from TA and Prof to Faculty . Parts ssn and salary are then abstracted from Faculty , Admin asst , and Coach to Employee . Finally , part ssn is abstracted from Employee and Student to Occupation . The result is shown in Figure 9 . ssn Num Univ_employee Grad TA Prof Coach Undergrad Adminasst Univ_student salary gpa Real_Num ssn Course assigned Committee Faculty_Assignment Assignment assigned Faculty Student Employee Occupation Figure 7 : Addition of Useless Alternations ssn Num Univ_employee Grad TA Prof Coach Undergrad Adminasst Univ_student salary gpaReal_Num ssn Course assigned Committee Faculty_Assignment Assignment assigned Faculty Student Employee Occupation gpa ssn salary salary salary ssnssnssn Figure 8 : Distribution of Common Parts Univ_employee Grad TA Prof Coach Undergrad Adminasst Univ_student Course Committee Faculty_Assignment Assignment assigned Faculty Student Employee Occupationssn Num Real_Num salary gpa Figure 9 : Abstraction of Common Parts Part Replacement . The \ old '' alternation vertex Faculty Assignment still has an incoming construction edge from the new vertex Faculty . In OE2 the corresponding edge is to vertex Assignment , so the edge is moved accordingly in OE1 . This is allowed since the set of construction vertices alternation reachable from Assignment is equal to the set alternation reachable from Faculty Assignment . Such a part replacement must always be possible since OE1 is object-equivalent to OE2 . The result is shown in Figure 10 . Deletion of Useless Alternations . The alternation vertices Faculty Assignment , Univ student , and Univ employee are now \ useless '' since they have no incoming edges and no outgoing construction edges . These vertices and their outgoing alternation edges are deleted , and the transformation from OE1 to OE2 is complete . 4 Practical Applications There are many useful rules which can be derived from the primitive transformations and are therefore guaranteed object-preserving . The following examples show how object-preserving transformations can be used to improve class organization by reducing the number of construction edges , the number of alternation edges , or the degree of multiple inheritance in a class dictionary graph . 1 . Elimination of redundant parts . If a vertex , v , has two incoming construction edges with the same label , -LRB- u ; v ; l -RRB- and -LRB- u0 ; v ; l -RRB- , then those edges should be replaced by a single edge -LRB- w ; v ; l -RRB- where w is an alternation vertex with exactly u and u0 as alternation successors , by abstraction of common parts . If necessary , w is first introduced by addition of useless alternation . -LRB- See Fig. 11 . -RRB- 2 . Removal of singleton alternation vertices . If an alternation vertex , v , has only one outgoing alternation edge , -LRB- v ; w -RRB- , then that vertex should be removed . Incoming construction edges -LRB- u ; v ; l -RRB- , and alternation edges , -LRB- u ; v -RRB- , are replaced by edges -LRB- u ; w ; l -RRB- and -LRB- u ; w -RRB- respectively . Outgoing construction edges , -LRB- v ; x ; l -RRB- , are replaced by edges -LRB- w ; x ; l -RRB- . The incoming construction edges can be moved by part replacement and the outgoing construction edges by distribution of common parts . Moving the incoming alternation edges can be accomplished by alternation replacement which is analogous to part replacement but is not primitive . It is easy to see how alternation replacement can be accomplished using only primitive transformations . Finally , the vertex v is deleted by deletion of useless alternation . -LRB- See Fig. 12 . -RRB- 3 . Complete Cover If a subset , S , of the outgoing alternation edges from a vertex , u , completely cover the alternatives of another alternation vertex , v , then replace the edges in S with a single alternation edge to v . We say the alternatives of an alternation vertex , v , are completely covered by a set of edges , S , if every vertex which is the target of an outgoing alternation edge from v is also the target of an edge in S . This rule can be derived from the primitive transformations using a construction similar to that given in section 3.2.2 . -LRB- See Fig. 13 . -RRB- 4 . Partial Cover This rule applies if two alternation vertices , u and v , cover a common set of alternatives , but neither contains a subset of outgoing alternation edges that completely covers the alternatives of the other . In this case , a new alternation vertex , w , is created with an outgoing alternation edge to each of the vertices that is a target of outgoing alternation edges from both u and v , and incoming alternation edges -LRB- u ; w -RRB- and -LRB- v ; w -RRB- . For each edge -LRB- w ; x -RRB- which is added , the corresponding edges -LRB- u ; x -RRB- and -LRB- v ; x -RRB- are deleted . -LRB- See Fig. 14 . -RRB- 5 . MI Minimization If there are alternation edges , -LRB- u ; w -RRB- and -LRB- v ; w -RRB- such that for all other alternation edges from v , -LRB- v ; w0 -RRB- , w0 is alternation reachable from u , Univ_employee Grad TA Prof Coach Undergrad Adminasst Univ_student Course Committee Faculty_Assignment Assignment assigned Faculty Student Employee Occupationssn Num Real_Num salary gpa Figure 10 : Part Replacement v l u l w u ' l u u ' v Figure 11 : Elimination of redundant parts v l u c x w l' c l u c x w l' c Figure 12 : Removal of singleton alternation vertex u x c1 c2 y v c3 c4 c5 c6 u x c1 c2 y c3 v c4 c5 c6 Figure 13 : Complete Cover u x c1 c2 y v c3 c4 c5 c6 x c1 c2 y v c3 w c4 c5 c6 c7 u c7 Figure 14 : Partial cover x c1 c2 y v u a1 w c3 c4 x c2 y v u a1 wc3 c4 c1 Figure 15 : MI minimization then replace the edge -LRB- u ; w -RRB- with the edge -LRB- u ; v -RRB- . This rule reduces the amount of multiple inheritance without changing the edge size . However , it introduces repeated inheritance . -LRB- See Fig. 15 . -RRB- 5 Conclusion The primitive object-preserving class transformations presented in this paper are a powerful tool for reasoning about object-preserving transformations and optimizations . In order to determine whether a transformation is guaranteed to be object-preserving it is only necessary to show whether it can be derived from the primitive transformations . To prove that a particular class organization is in some sense optimal -LRB- see , for example , -LSB- LBSL91 -RSB- -RRB- , it is only necessary to consider improvements that might be possible through the primitive transformations . An area for further research is the study of object-extending class reorganizations -LSB- LHX91 -RSB- . An object-extending transformation is one which adds to the set of defined objects or adds part classes to previously defined objects . For object-oriented data base design this means that the objects can be updated automatically . For object-oriented programming it means that the programs will still accept similar inputs and produce similar outputs . Acknowledgments : I would like to thank Karl Lieberherr for his generous support and feedback . Additional thanks go to Cun Xiao for his help in polishing some of the definitions . References -LSB- AH87 -RSB- S. Abiteboul and R. Hull . A formal semantic database model . ACM Transactions on Database Systems , 12 -LRB- 4 -RRB- :525 -LCB- 565 , Dec. 1987 . -LSB- BCG +87 -RSB- Jay Banerjee , Hong-Tai Chou , Jorge F. Garza , Won Kim , Darrell Woelk , and Nat Ballou . Data model issues for object-oriented applications . ACM Transactions on Office Information Systems , 5 -LRB- 1 -RRB- :3 -LCB- 26 , January , 1987 . -LSB- BDG +88 -RSB- D.G. Bobrow , L.G. DeMichiel , R.P. Gabriel , S.E. Keene , G. Kiczales , and D.A. Moon . Common Lisp Object System Specification . SIGPLAN Notices , 23 , September 1988 . -LSB- BL91 -RSB- Paul Bergstein and Karl Lieberherr . Incremental class dictionary learning and optimization . In European Conference on Object-Oriented Programming , pages 377 -LCB- 396 , Geneva , Switzerland , 1991 . Springer Verlag . -LSB- BMW86 -RSB- Alexander Borgida , Tom Mitchell , and Keith Williamson . Learning improved integrity constraints and schemas from exceptions in data and knowledge bases . In Michael L. Brodie and John Mylopoulos , editors , On Knowledge Base Management Systems , pages 259 -LCB- 286 . Springer Verlag , 1986 . -LSB- Cas89 -RSB- Eduardo Casais . Reorganizing an object system . In Dennis Tsichritzis , editor , Object Oriented Development , pages 161 -LCB- 189 . Centre Universitaire D'Informatique , Gen?eve , 1989 . -LSB- Cas90 -RSB- Eduardo Casais . Managing class evolution in object-oriented systems . In Dennis Tsichritzis , editor , Object Management , pages 133 -LCB- 195 . Centre Universitaire D'Informatique , Gen?eve , 1990 . -LSB- GR83 -RSB- A. Goldberg and D. Robson . Smalltalk80 : The Language and its Implementation . Addison Wesley , 1983 . -LSB- LBSL90 -RSB- Karl J. Lieberherr , Paul Bergstein , and Ignacio Silva-Lepe . Abstraction of object-oriented data models . In Hannu Kangassalo , editor , Proceedings of International Conference on EntityRelationship , pages 81 -LCB- 94 , Lausanne , Switzerland , 1990 . Elsevier . -LSB- LBSL91 -RSB- Karl J. Lieberherr , Paul Bergstein , and Ignacio Silva-Lepe . From objects to classes : Algorithms for optimal objectoriented design . Software Engineering Journal , 1991 . Accepted for publication . -LSB- LHX91 -RSB- Karl J. Lieberherr , Walter L. H?ursch , and Cun Xiao . Object-extending class transformations . Technical Report NU-CCS-91-8 , Northeastern University , July 1991 . -LSB- LM91 -RSB- Qing Li and Dennis McLeod . Conceptual database evolution through learning . In Rajiv Gupta and Ellis Horowitz , editors , Object-oriented Databases with applications to CASE , networks and VLSI CAD , pages 62 -LCB- 74 . Prentice Hall Series in Data and Knowledge Base Systems , 1991 . -LSB- Mey88 -RSB- Bertrand Meyer . Object-Oriented Software Construction . Series in Computer Science . Prentice Hall International , 1988 . -LSB- PBF +89 -RSB- B. Pernici , F. Barbic , M.G. Fugini , R. Maiocchi , J.R. Rames , and C. Rolland . C-TODOS : An automatic tool for office system conceptual design . ACM Transactions on Office Information Systems , 7 -LRB- 4 -RRB- :378 -LCB- 419 , October 1989 . -LSB- Pir89 -RSB- Fiora Pirri . Modelling a multiple inheritance lattice with exceptions . In Proceedings of the Workshop on Inheritance and Hierarchies in Knowledge Representation and Programming Languages , pages 91 -LCB- 104 , Viareggio , February 1989 . -LSB- PW89 -RSB- Winnie W. Y. Pun and Russel L. Winder . Automating class hierarchy graph construction . Technical report , University College London , 1989 . -LSB- Sno89 -RSB- Richard Snodgrass . The interface description language . Computer Science Press , 1989 . -LSB- Str86 -RSB- B. Stroustrup . The C++ Programming Language . Addison Wesley , 1986 . -LSB- TYF86 -RSB- T.J. Teorey , D. Yang , and J.P. Fry . A logical design methodology for relational data bases . ACM Computing Surveys , 18 -LRB- 2 -RRB- :197 -LCB- 222 , June 1986 .

O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O

class library organization
object-oriented database design
object-oriented programming and design