Data Abstraction And Hierarchy - Department Of Computer Science

Transcription

Data AbstractionMITand HierarchyBarbara LiskovLaboratoryfor ComputerScienceCambridge,Ma. 02139AbstractData abstraction is a valuable method for organizing programs to make them easier to modify andmaintain.Inheritance allows one implementation of a data abstraction to be related to anotherhierarchically. This paper investigates the usefulness of hierarchy in program development, and concludesthat although data abstraction is the more important idea, hierarchy does extend its usefulness in somesituations.This research was supported by the NEC Professorship of Software Science and EngineeringOctober1987OOPSLA‘87 Addendumto the Proceedings17

1. IntroductionAnimportantmaintenancegoalinand programgood way of achievingto the behaviorbe changeddesignmodificationsthis goal.they providelocallyis to identifya programmade to supportstructurechangingaffectingbecause they hide complicatedsimplifiesrequirements.thatuse the data.things (data structures)that are likelyof programsprogramsThey permitsimplifythe structurethatexample,they reduce the number of argumentsbothare particularlyof data toimportantto change in the future.use them because they presenta higherto procedures because abstractare aare implementedthe representationTheyprogramData abstractionsThey allow us to abstract from the way data structuresthat other programs can rely on.withoutthatThey alsoForlevel interface.objects are communicatedinstead of their representations.Object-orientedfrom this.programmingHowever,is primarilyit elaboratesthis techniqueused in a numberof ways,inheritancea useful additionprovidessome of whichThis paper discusses the relationshipbegin in Section 2 by definingbetween data abstractionand identifyInheritancecan beIn these cases,of data abstraction.and object-orientedprogramming.developmentprocess.two ways that it is used, for implementationreally adds somethingin programtype hierarchy.Then inhierarchyto data abstraction,design and development.We conclude with a summaryWeandso inNext we discuss someof our results.AbstractionThe purpose of abstractionprogrammingabstractionpartsin programmingmechanismof the programprogrammerprovidesof “inheritance.”and its role in the programOf the two methods, type hierarchyissues that arise in implementingotherthe notionand much of its power derivesto data abstraction.Section 4 we discuss uses of type hierarchy2. Datawithtechnique,enhance the powerdata abstractionSection 3 we discuss inheritancefor type hierarchy.a data abstractionis to separate behaviorwas the procedure.call the procedurecares only about whatthe needed functionwillA procedureto accomplishfrom implementation.performsthe task.it does and not how it is implemented.do, providedit implementsthe functionThe firstsome task or function;To use the procedure,Anyimplementationcorrectlyathatand is efficientenough.Procedurestheywereare a useful abstractionnot“connections”mechanism,enough [15, 16, 71 andbetween modules.but in the early seventies some researchers realized thatproposeda newwayof organizingprogramsaroundtheThe concept of data abstraction or abstract data type arose from theseideas [5, 121.Data abstractions18providethe same benefits as procedures, but for data.OOPSLA‘87 Addendumto the ProceedingsRecall that the main idea is toOctober1987

separatewhatabstractionan abstractioncan be substitutedobject is representedfor short.in the memory of a computer;withoutmanipulateso thatthis informationwithoutimplementationsof the sameof a data object is concerned withaffectinghow thatis called the representation,or repusers, we need a way of changingThis is achieved by encapsulatingto change all using programs.thatthe rep directly,the data abstraction,implementationshavinga set of operationsmanipulatehow it is implementedThe implementationfreely.To allow changingrepresentationwithis fromit and by restrictingusing programsThen,but instead must call the operations.it is necessary to define the rep and implementso thatto implementthe operationsthethe reptheycannotor reimplementin terms of it, butusing code is not affected by a change.Thus a data abstractionAn exampleis a set of objects that can be manipulatedof a data abstractionthe objectsis the integers:operationsto add two integers, to test them for eAnotheris 2’s complement.uxyz,M and operationsof integers, withshieldedfromimplementationexample is characteran integer is in a set.tables are not.implementedare discussed in Section 2.2.A data or procedureLinguisticabstractioncoded in some programmingaboutotherwisetechniqueof testing.mechanismslanguage.The specificationwithCorrectBy omittingby informalimplementationsdifferfromthey may have differentacceptableto the callerit meets the caller’sneed not be identicalensuringthatto one another;they remainthe behavioris writtenreasoningthey use, and thereforeprovidedA final example is setsto insert an element in aare built-indata types indata abstractionsuser-definedabstractsuch as stacksdata types to beby a programperformance.performancewe permitthe same where this is important.manydifferentdefined by the specification.in a languagewithpreciseunsatisfactoryin how they work,i.e., whatAny correct implementationrequirements.the whole pointmoduledoes, but omitsor by the somewhatone anothertheobjects such as ua” andstrings.such detail,if the specificationcorrectnessas whetherdescribes what the abstractionalgorithmswhilesuchand implementedis correct if it providesmathematicallywe establishthat permitis defined by a specificationAn implementationsemantics;differ,strings,Note that integers and stringshow it is implemented.can be provedimplementationsusing integers manipulatedetailslanguages, while sets and other application-orientedand symbolCorrectnessand so on. Programsobjects such as { } (the empty set) and (3, 7}, and operationsmost programmingimplementations.only by a set of operations.are 1, 2, 3, and so on and there areto select characters from strings and to concatenateset, and to test whetherany informationdirectlyNote thatcorrectis to allow implementationsThe specificationistodescribeswhat is important.For abstractionto work, implementationsmust be encapsulated.then no other module can depend on its implementationOctober1987OOPSLA‘87 Addendumdetails.If an implementationis encapsulated,Encapsulation 1 gll arantees that modulesto the Proceedings19

can be implementedhiding”advocatedand reimplementedindependently;it is relatedto the principleof “informationby Parnas [15].2.1. LocalityAbstractionLocalitywhen supportedallows a programby specificationsto be implemented,and encapsulationunderstood,providesor modifiedlocalitglwithina program.one module at a time:1. The implementerof an abstractionknows what is needed because this is described in thespecification.Therefore, he or she need not interact with programmers of other modules (orat least the interactions can be very limited).2. Similarly,the implementerof a using module knows whatnamely the behavior described by the specification.to expect froman abstraction,3. Only local reasoning is needed to determine what a program does and whether it does theright thing.The program is studied one module at a time. In each case we are concernedwith whether the module does what it is supposed to do, that is, does it meet its specification,However, we can limit our attention to just that module and ignore both modules that use it,and modules that it uses. Using modules can be ignored because they depend only on thespecificationof this module, not on its code. Used modules are ignored by reasoning aboutwhat they do using their specifications instead of their code. There is a tremendous saving ofForeffort in this way because specificationsare much smaller than implementations.example, if we had to look at the code of a called abstraction, we would be concerned not onlywith its code, but also with the code of any modules it uses, and so on.4. Finally,needs toextendedaffectingLocalityprogram modificationcan be done module by module.If a particularabstractionbe reimplementedto provide better performance or correct an error or providefacilities,the old implementingmodule can be replaced by a new one withoutother modules.providesperformancea firmbasis forof an algorithmcan be a shprogrambetterone thatperformance.correctness will be unaffectedLocalitysupportsForto a differentis to thinkprogramexample,this by inventingprototyping.and the speed reit is designedperformspoorly.-ProvidedbothLateris a tradeoffbetweenand implemented.itThe initialcan be replacedimplementationstheare correct,by anotherthecallingby the change.evolution.suppose we wantabstractionsAbstractionscana programto runthat hide the differencesmachine only those abstractionsabout expected modificationsand organizebe usedtoencapsulateon differentmachines.potentialWe canbetween machines so that to move theneed be reimplemented.A good design principlethe design by using abstractionsthat encapsulatethe changes.The benefits20of localityare particularlyOOPSLAimportant‘87 Addendumfor data abstractions.to the ProceedingsData structuresare oftenOctober1987

complicatedprogramand thereforethe simplersuch changes can be minimizedData”Supportabstractionsview providedAlso, changes to storage structuresto be simpler.2.2. Linguisticabstractby encapsulatingfor Dataare supportedcluster is shown in Figureoperations2-l.mechanismsare implementingsets as linkedprocedurecalled a cluster for implementingof the type; it serves to identifyThe “repfor each operation, in severalevolve; the effects oflanguages.those in CLU and Smalltalk,The header identifiesfrom the outside.as programsAbstractionby linguistica mechanismare likelyallows the rest of thethem inside data abstractions.language w&s Simula 67 [3]. T wo major variations,CLU [S, 111 providesby the specificationwhatan abstractThe earliestare discussed below.type.definitionsThe rest of the clusterand in addition,for aand also lists theinside the cluster” line defines how objects of the type are represented;lists.A templatethe data type being implementedproceduresuchcan be calledin the example, weconsists of procedures;there must be athere may be some procedures that can be used only insidethe cluster.int -set clusteris create, insert, is-in,size, . . .rep int-listcreate proc. . . end createinsert proc. . . end insertend int -setFigureIn Smalltalk[4], data abstractionsbut we ignore this for now.“rep ‘Iline,variables.’methodfor each operationmethods in Smalltalkcalled by “sending1We ignoreare implementedby classes.a data abstractionof the class consists of methods,of the data type implementedwhichClasses can be arrangedsimilarlyto a cluster.declarations;are procedureby the class.hierarchically,(ThereInstead of thethese are the instancedefinitions.cannotmessages,” which has the same effect as calling operationshere since theyOOPSLAare not importantvariables IS].‘87 Addendumfor the distinctionsto the ProceedingsThere is abe any internalclasses because it is not possible to preclude outside use of a method.)the class variables1987of a CLU Cluster.by a sequence of variableanalogousmechanism:a cluster can have some ‘own’OctoberTemplateA class implementsthe rep is describedThe remainder2-I:Methodsarein CLU.we are tryingto make.CLUhas an21

BothCLUSmalltalkcaughtand Smalltalkuses fore the programcheckingencapsulationruns,can limitguaranteedalthoughat all.by manualthe situationas modificationson withconfidenceAnotherdifferencethe operationsproceduresdescribed by Morristhe Smalltalkwithinhave, namely,by a compiler.at either runtimetypee.g., [I, 131, do notencapsulationcan beare error-prone,program,it willor compile-time,is found in the semantics of data objects.In CLU,variablesanddegradecan be reliedoperationswithdo not belong to the objectrespect to theirview was firstseveral objects ofcan see the reps of several objects at once,In CLU an operationmultiple(Thisthat manipulateThe Smalltalkthe union of two sets.buttype’s objects that nothey can see the reps of these objects.as well, since an operationIn Smalltalk,that make up the object’s repExamplesofview does notOn the other hand,can be inside of only one object.view works better when we want to have several implementationsof the same type runningcan see the rep of any object of its type, and thereforerepresentationsexplicitly.Smalltalkavoids this problemsince ancan see the rep of only one object.3. Inheritanceand HierarchyThis section discusses inheritancemeans to constructimplementationhierarchy,checking,are adding two integers or formingmust be coded to cope withoperationsupportthese techniquesThe CLU view works better for operationsthe same program.whilethe need to read any code at all.because an operationsuch operationslanguages,for a newly-implementedThis gives them special privileges[14].)the type simultaneouslysupportAutomaticare part of the object too.parts of the programsuch operationsmanageablebutare part of the object and can access the instanceinstead belong to a type.checking,language has a powerfulOther objectcorientedsuch as code reading,are made.typecode to be generatedin the absence of languagebetween CLU and Smalltalksince these variablesothermore efficientin Section 5.)It is true thatand withoutuses compile-timeexpressive power unless the programmingmay be somewhatrapidlyCLUchecking is better because it allows a class of errors to beand it permitssystem; this issue is discussed furtherenforce encapsulationbuta programhierarchyadds somethingand how it supportsusinginheritance.and type hierarchy;hierarchy.ThenWe begin by talkingwe discuss twosee [18] for a similarmajordiscussion.about what ituses of inheritance,Onlyone of these, typenew to data abstraction.3.1. InheritanceIn a language withto one another.theyAlthoughare all similar.mechanism22inheritance,variousThusa data abstractioncan be implementedlanguages providewe can illustratethemdifferentin several pieces that are relatedmechanismsby examiningfor puttinga singlethe pieces together,mechanism,the subclassin Smalltalk.OOPSLA‘87 Addendumto the ProceedingsOctober1987

In Smalltalka class can be declared to be a subclass of another class2, which is its superclass.thing that needs to be understoodquestionis importantThe firstabout the mechanism is what code results from such a definition.Thiswhat a subclass does. For example, if we were to reason aboutfor understandingits correctness, we would need to look at this code.From the point of view of the resultingshorthandnotationthe language,for buildingcode, saying that one class is a subclass of anotherThe exact program that is constructedprograms.the languageis to be sensibleimplementinga class containingFor ‘example,for our discussionThe pointand useful).the instance variablessuppose class T has operationsdeclared to be a subclass of T, has operationsSmalltalkis effectivelya class with(althoughis thatthey clearlythe resultcode thatdiscussed furtherOne problemextent.withalmost all inheritanceinheritance,There are the “outsiders”there are the “insiders.”Thereor and o2 and instance variablevr and class S, which isor and os and instancev2.variableWhenif S is reimplemented,mechanismsis that they compromiseencapsulationa data abstractionencapsulation(This last violationspecificationsunless’sor, 02, 03,by S. It is thisis restrictedasimplementationuse the objects by callingcan be violatedoperationto anpermittedBut in additionto violateencapsulation.access an instanceto superclasses of itsoperationsof the superclassWhen encapsulationis violated,using theirwe lose thecode of the sub- and superclass in reasoningthe subclass, and if the superclass needs to be reimplemented,subclass refers directlythe operations.[18]: the subclass mightwe can reason aboutWe must consider the combinedthis wouldabstraction(i.e., a class) has two kinds ofof its superclass, or refer directlyand we can ignore the rep of the superclass.For example,datais not possible in Smalltalk.)is not violated,benefits of locality.too.is suppliedor modifiedwho simplyof its superclass, call a privatesuperclass.Then the result inv1 and v2, and three operations,These are the subclasses, which are typicallyare three ways thatvariablethe rules.below.In languages withusers.ifto directlyand methods that result from applyingtwo instance variables,must be understood,Theare importantis equivalentwhere the code of o2 is supplied by T, and the code of the other two operationscombinedadepends on the rules ofmethods of the superclass.e.g., such things as when methods of the subclass overrideexact details of these rules are not importantis simplybe necessary if an instancewe may need to reimplementvariableof the superclassto a superclass of its superclass T and then T is reimplementedaboutits subclasseschanged,or if ato no longer havethis superclass.Violating2encapsulationWe ignore multiple inheritanceOctober1987can be useful in bringingto simplifyup a prototypequicklysince it allowscode to bethe discussion.OOPSLA ‘87 Addendumto the Proceedings23

producedby extensionmodificationsand modificationto the implementationPropagationof existingIt is unrealistic,code.of the superclass can be propagatedis useful only if the resultingcode works, whichanothersince it containswhetheradditionalUsing this additionalconstraints.the additionalspecificationis about detailsthat a new superclass implementationsubclass relies on a ropagateof the subclasscan be captureda programmersuperclassAlso, the situationof the superclass.to the subclass.byfrom that for outsiders,to the subclass.of the previouswill meet it.automaticallyThese expectationsfor the superclass; this is a differenta proposed change to the superclass can usefullyspecificlikelyspecificationto expect thatmeans that all expectationsabout the superclass must be satisfied by the new implementation.providinghowever,can determineNote that the moreimplementation,the lesswill be unmanageableif eachOne possible approachis to define a singlespecification for use by all subclasses that contains more detail than the specification for outsiders butstill abstractsfrom many implementation3.2. ImplementationThe firstsimilarway that inheritanceto other existingSuppose furtheroperationis used is simplytypes.as a techniqueis described in [l?].for implementingFor example, suppose we want to implementthat a list data type has already been implemented,as well ac a convenientdata types thatthe currentsize of theand that it providesa memberway of representingthe set.if an element were added to the set twice, it would be appear in the list only once.implementationsto make them vidingimplementationsinwould signal an exceptionthe .subclasswe might implementsets by using list as the rep.member operations;each of these wouldwritinganythingoperationssuppressedother operations,(Thiscan be done inoperations;suchanOn the othertype as the rep of another.In this case, we wouldcall the correspondingeven thoughhand,need to implementoperationon lists.the code is very simple,we need not do anythingFor example,the size andWritingis more workdownthan notto take away undesirablesuch as car.Since implementationdata abstraction,hierarchydoes not allow us to do anythingwe will not consider it further.benefits and problems24simplyfor these two operations,for them.theother operationsif called.)way of doing the same thing is to use one (abstract)implementationsforfor sets.i.e.,Then we would notAlso, we should suppress certainsince they are not meaningfulwe couldduplication,for member and sire, but we would need to implementsuch as one that inserts a new element into the set.such asThenset as a subclass of list; we might have the list hold the set elements withoutneed to provideareinteger sets, with operationsan element is a member of the set and to determineand a size operation,implementSome work in this directionHierarchy(among others) to tell whetherset.details.that ensue. However,OOPSLAIt does permitthis ability‘87 Addendumthat we could not alreadyus to violateencapsulation,do withwith both thecould also exist in the rep approach if desired.to the ProceedingsOctober1937

3.3. TypeHierarchyA type hierarchyobjects provideidea of a eubtypeplus somethingof objects of another type (th e supertype)all the behaviorwanted here is somethinglike the followingis an object o2 of type T such thatunchangedThe intuitiveis composed of subtypes and supertypes.substitutionpropertyfor all programsis one whoseextra.What is[S]: If for each object o1 of type S thereP definedin terms of T, the behaviorof P isfor oz, then S is a subtype of T. (See also [2, 171 for other work in thiswhen o1 is substitutedarea.)We are using the words ementlanguagesand gramssubtypes, but also, as mentionedWe begin withandare simply“superclass”to be builtin a particularway.linguisticTheyare not subtypesif the same elementexpectinga list mightpassed a list.is added twiceexampleto a list,of non-subtypesit occurs in the list twice.a programexpectingare stacks and queues.element is removed from a stack, the last item added (pushed) is removed.A using programis likelya simple differenceA subtype must have all the operations3enough.it depends on.(A ngsince otherwiseoperationsof subtypesubtypeshave these operationsoperations.Examplesconcatenated,and arrays can be modified3hierarchies.to access elements by index; e.g., there wouldAllBy contrast,Thus a programnot work ifwhen anqueues are FIFO.of subtypesare arrays,related operations,the using programof the rightcould not usenames and signaturesand outputFor example, stacks and queues mightto push or enqueue and rem -elwe give some examplesthe collection.the size of the set.Stacks are LIFO;defines the numbers and types of its inputare differentThe firstbe a fetchtoo, but,have operationsoperationsequences, and indexedTheof theare notfor them.is indexedin addition,is notarguments.)to pop or dequeue, but they stillsubtypes of one another because the meanings of the operationsoperationsa set is not aa set mightbetween the pairs of types, namelyof its supertypemust also do the same things.same names, e.g., add-e1Nowcan be used toto notice the difference between these two types.The above examples ignoredan operationinIf the same element is added to a set twice, the result is the samenot work if passed a set; similarlyAnotherconceptsFirst,of one another.as if it had been added only once and the element is counted only once in computingHowever,about aabove, in other ways.some examples of types thatsubtype of a list nor is the reverse true.here to emphasize that now we are talkingcollections,whichhaveto fetch the jth element ofeach wouldprovideextrasets; e.g., sequences can beby storing new objects in the elements.It needsthe instance methods but not the class methods.October1987OOPSLA‘87 Addendumto the Proceedings25

The second exampledevices.Particularbe those thatspecific.is abstractdevices might providea printeroperationssuch as get-char.operations,e.g., bothwoulda numberand get- char,put-chartest, whilehave modificationpossibilityof differentkinds of inputIn this case, abstractextra operations.AnotherIn this case, operationsthat allows exceptionsunifye.g., the end-of-fileall devices support,For example,operations.devices, whichsubtypeoperationsis thatand thusdevice operationsoperationswouldsuch as put-charabstractwouldhaveFor example, get- char wouldbe deviceall possiblehave the same set ofthat not all real devices can do must be specifiedto be signalled.wouldbut not readingdevices wouldall subtypesand outputin a general waysignal an exceptionwhen called ona printer.An inheritanceimplementmechanismthe supertypecan be used to implementand anotherwould declare the supertype’s4. BenefitsDataabstraction.program.section(A detailedDatatoolin its own right.discusses how subtypesdiscussiondiscusses their use in organizing4.1. Incrementaldesign is depictedpointingintoa programare usuallyin Figuremodules,abstraction,abstraction,type T).a subtypeTypehierarchyis a usefulcan be used in the developmentadjunctto dataof the design for acan be foundin [ll).)It nd a node withby a graph that illustratesT. P will be implementedis indicatedThusthe figurestages of aSuch a stage ofhow a programisa single bar on top representsa double bar on top representsmeans that the abstractionIn earlyand a part of its behavior.There are two kinds of nodes; a node withof the second node.(Recursionas a design progresses.The design is depictedfrom one node to anotherthe abstractionThe class implementingof design based on data abstractiondesign, we only know some of a data abstraction’sprocedurebe a class toDesignabstractionssubdividedeach subtype.There wouldHierarchyis a powerfulThisclass to implementhierarchy.class as its superclass.of Typeabstractiona subtypea data abstraction.An arrowof the first node will be implementedshows two procedures,ausingP and Q, and one datausing Q (i.e., its code calls Q) and T (i.e., its code uses objects ofby cycles in the graph.Thus if we expected the implementationof P tocall P, there would be an arrow from P to P.)Thisfigureimplementrepresentsan earlyP and has inventedstage of design,in whichthe designerQ and T. At this point, some operations26OOPSLAhow to implement‘87 Addendumaboutof T have been identified,designer has decided that an object of type T will be used to communicateThe next stage of design is to investigatehas thoughtQ. (It wouldto the Proceedingshow toand thebetween P and Q.not make sense to look at T’sOctober1987

PQ!?ITFigureimplementationat this point, because we do not know all its operationsto define additionalFigure4-2.operationsfor T. This can be viewedHere a double arrow points from a supertypedata abstractions(and there can be no cycles involvingFigureThe kind of refinementsubtypeThe Start of a Design.4-1:R and so on.illustrated4-2:as refiningyet.)In studyingT to a subtypeto a subtype;Q we are likelyS as is shown indouble arrows can only connectonly double arrows).Later in the Design.in the figures may happen several times; e.g., S in turn may have aAlso, a single type may have several subtypes,representingthe needs of differentsubparts of the program.Keepingtrackof these distinctionstype, for several reasons.investigationindicatesprovidedit can limitis betterthe group of types as a singleis unaffected,For example,suppose furtherWhen a problem of this sort occurs, it is necessary tothat uses the changed abstraction.T’s interfacethan treatingthe effect of design errors.a problem with S’s interface.look at every abstractionQ. However,Firstas subtypesFor the figure,this means we must look atwe need not look at P. If S and T had been treated asone type, then P would have had to be examined too.October1987OOPSLA‘87 Addendumto the Proceedings37

Anotheradvantageof distinguishingThe design rationalethe types is that it may help in organizingdescribes the decisions made at particularthey were made and what alternativesBy maintainingexist.they are made over time, we can avoid confusioncan identifypreciselyFinally,the distinctionFrequently,may help duringitmaycan stillthe distinctionbe localized,a single module,Relatedimplementation,be thatfor example,the hierarchyis notthan havingeven if implementationwe must reimplementmaintainedAn examplethen introducesFor example,Q but not P. However,that are similartypes.Even so,changesa change to the specificationif S and T are implementedThe designer may recognizebut different.The differencesis the generalizedabstractdevice mentionedthe supertypeasS.untilways.this is the situationrepresenta programvariantswilluseof the sameor some of them may extend theearlier.Sometimes the relationshipdiscussed above.several related types already exist.on each of the relatedthe module mightWhen the relationshipwant to use inheritanceTo accommodaterelatedandwhateveronlythe specificbe a sort routineHavingto implementthe relationshipthat relies on its argumentof thatmodulesthem all,subtype,may not becommon“collection”part of them.Forto allow it to fetcha ” ” operation,is a good way to describe it, and we probablymechanism.can be done in a subtype-independentseparateAlternatively,This happens because of the desire to define a moduleis defined in advance, hierarchybehavioris defined in advance, before anytypes but depends on only some smallas an implementationsupertype)single modulethatat the time the whole set of types is conceived,elements, and relies on the element type itself to providesubtypes.athe subtypes as they are needed later in design.types are invented;withand subtypes.because the effects of specificationchanges cannot.is for relatedRelated types arise in two differentexample,because implementingboth of them, instead of just reimplementingtypes in design, the designer introducesworksin the implementation.invented,general idea, where the subtypes may all have the same set of operations,thatlater, weTypesseveral data abstractionsrecognizedthe decisions asif S, but not T, needs to beseparate modules for the supertyperemains useful after implementation,The second use of subtypessupertype.to representIf an error is discoveredand be more precise.of S but not T means that we need to reimplement4.2.the hierarchythe end of the design is just a single type, the last subtypesingle module is more convenienthowever,in the design, and discusses whyat what point in the design it occurred.However,reimplemented.pointsthe design rationale.This permitsway.just once (in theThe module for a subtypeand is independentfor the super- and subtypesAlso, if a new subtypeus to implementof modulesgives betteris

Data Abstraction and Hierarchy Barbara Liskov MIT Laboratory for Computer Science Cambridge, Ma. 02139 Abstract Data abstraction is a valuable method for organizing programs to make them easier to modify and