46
1 15-214 School of Computer Science Principles of Software Construction: Objects, Design, and Concurrency Designing (sub-) systems Responsibility assignment Charlie Garrod Michael Hilton

Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

115-214

SchoolofComputerScience

PrinciplesofSoftwareConstruction:Objects,Design,andConcurrency

Designing(sub-)systems

Responsibilityassignment

CharlieGarrod MichaelHilton

Page 2: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

215-214

Administrivia

• ReadingforToday:• UMLandPatternsChapter14,15,and16

• MidtermexamnextThursday(September28th)– Examreviewsession:Hamerschlag HallB103Wed7-9pm– PracticeExampostedonPiazza

• MuddiestPointFeedback

Page 3: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

315-214

Homework4

• Threeparts,partAdueOct5th

• Designreviewmeetingnextweek

Page 4: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

415-214

REVIEW:Sequenceandcommunicationdiagrams

Page 5: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

515-214

Problem Space

Domain Model

SolutionSpace

Object Model

Our path toward a more formal design process

• Real-worldconcepts• Requirements,concepts• Relationshipsamongconcepts• Solvingaproblem• Buildingavocabulary

• Systemimplementation• Classes,objects• Referencesamongobjectsand

inheritancehierarchies• Computingaresult• Findingasolution

Page 6: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

615-214

Artifactsofourdesignprocess

• Model/diagramtheproblem,defineobjects– Domainmodel(a.k.a.conceptualmodel)✓

• Definesystembehaviors– Systemsequencediagram– Systembehavioralcontracts

• Assignobjectresponsibilities,defineinteractions– Objectinteractiondiagrams

• Model/diagramapotentialsolution– Objectmodel

Understandingtheproblem

Definingasolution

Page 7: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

715-214

Buildingadomainmodelforalibrarysystem

Apubliclibrary typicallystoresacollectionofbooks,movies,orotherlibraryitems availabletobeborrowedbypeoplelivinginacommunity.Eachlibrarymember typicallyhasalibraryaccount andalibrarycard withtheaccount’sIDnumber,whichshecanusetoidentifyherselftothelibrary.

Amember’slibraryaccountrecordswhichitemsthememberhasborrowedandtheduedate foreachborroweditem.Eachtypeofitemhasadefaultrentalperiod,whichdeterminestheitem’sduedatewhentheitemisborrowed.Ifamemberreturnsanitemaftertheitem’sduedate,thememberowesalatefeespecificforthatitem,anamountofmoneyrecordedinthemember’slibraryaccount.

Page 8: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

815-214

Onedomainmodelforthelibrarysystem

Page 9: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

915-214

Notesonthelibrarydomainmodel

• Allconceptsareaccessibletoanon-programmer• TheUMLissomewhatinformal

– Relationshipsareoftendescribedwithwords

• Real-world"is-a"relationshipsareappropriateforadomainmodel• Real-wordabstractionsareappropriateforadomainmodel• Iterationisimportant

– Thisexampleisafirstdraft.Someterms(e.g.Itemvs.LibraryItem,Accountvs.LibraryAccount)wouldlikelyberevisedinarealdesign.

• Aggregatetypesareusuallymodeledasclasses• Primitivetypes(numbers,strings)areusuallymodeledasattributes

Page 10: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

1015-214

BuildadomainmodelforMonopoly

Page 11: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

1115-214

BuildadomainmodelforMonopoly

Monopolyisagameinwhicheachplayerhasapiecethatmovesaroundagameboard,withthepiece’schangeinlocationdeterminedbyrollingapairofdice.Thegameboardconsistsofasetofproperties(initiallyownedbyabank)thatmaybepurchasedbytheplayers.

Whenapiecelandsonapropertythatisnotowned,theplayermayusemoneytobuythepropertyfromthebankforthatproperty’sprice.Ifaplayerlandsonapropertyshealreadyowns,shemaybuildhousesandhotelsontheproperty;eachhouseandhotelcostssomepricespecificfortheproperty.Whenaplayer’spiecelandsonapropertyownedbyanotherplayer,theownercollectsmoney(rent)fromtheplayerwhosepiecelandedontheproperty;therentdependsonthenumberofhousesandhotelsbuiltontheproperty.

Thegameisplayeduntilonlyoneremainingplayerhasmoneyandproperty,withalltheotherplayersbeingbankrupt.

Page 12: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

1215-214

Understandingsystembehaviorwithsequencediagrams

• Asystemsequencediagram isamodelthatshows,foronescenarioofuse,thesequenceofeventsthatoccuronthesystem’sboundary

• Designgoal:Identifyanddefinetheinterfaceofthesystem– Twocomponents:Auserandtheoverallsystem

Page 13: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

1315-214

Understandingsystembehaviorwithsequencediagrams

• Asystemsequencediagram isamodelthatshows,foronescenarioofuse,thesequenceofeventsthatoccuronthesystem’sboundary

• Designgoal:Identifyanddefinetheinterfaceofthesystem– Twocomponents:Auserandtheoverallsystem

• Input:Domaindescriptionandoneusecase• Output:Asequencediagramofsystem-leveloperations

– Includeonlydomain-levelconceptsandoperations

Page 14: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

1415-214

Onesequencediagramforthelibrarysystem

Usecasescenario:Alibrarymembershouldbeabletouseherlibrarycardtologinatalibrarysystemkioskandborrowabook.Afterconfirmingthatthememberhasnounpaidlatefees,thelibrarysystemshoulddeterminethebook’sduedatebyaddingitsrentalperiodtothecurrentday,andrecordthebookanditsduedateasaborrowediteminthemember’slibraryaccount.

Page 15: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

1515-214

Onesequencediagramforthelibrarysystem

Usecasescenario:Alibrarymembershouldbeabletouseherlibrarycardtologinatalibrarysystemkioskandborrowabook.Afterconfirmingthatthememberhasnounpaidlatefees,thelibrarysystemshoulddeterminethebook’sduedatebyaddingitsrentalperiodtothecurrentday,andrecordthebookanditsduedateasaborrowediteminthemember’slibraryaccount.

Page 16: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

1615-214

BuildonesystemsequencediagramforMonopoly

Usecasescenario:Whenaplayerlandsonanunownedpropertyandhasenoughmoneytobuytheproperty,sheshouldbeabletobuythepropertyfortheproperty’sprice.Thepropertyshouldnolongerbepurchasablefromthebankbyotherplayers,andmoneyshouldbemovedfromtheplayertothebank.

Page 17: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

1715-214

Formalizesystembehaviorwithbehavioralcontracts

• Asystembehavioralcontract describesthepre-conditionsandpost-conditionsforsomeoperationidentifiedinthesystemsequencediagrams– System-leveltextualspecifications,likesoftwarespecifications

Page 18: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

1815-214

Asystembehavioralcontractforthelibrarysystem

Operation: borrow(item)

Pre-conditions: Librarymemberhasalreadyloggedintothesystem.Itemisnotcurrentlyborrowedbyanothermember.

Post-conditions: Logged-inmember'saccountrecordsthenewly-borroweditem,orthememberiswarnedshehasanoutstandinglatefee.Thenewly-borroweditemcontainsafutureduedate,computedastheitem'srentalperiodplusthecurrentdate.

Page 19: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

1915-214

AsystembehavioralcontractforMonopoly

Operation: buy(property)

Pre-conditions: ?

Post-conditions: ?

Page 20: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

2015-214

Distinguishingdomainvs.implementationconcepts

• Domain-levelconcepts:– Almostanythingwithareal-worldanalogue

• Implementation-levelconcepts:– Implementation-likemethodnames– Programmingtypes– Visibilitymodifiers– Helpermethodsorclasses– Artifactsofdesignpatterns

Page 21: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

2115-214

Summary:Understandingtheproblemdomain

• Knowyourtoolstobuilddomain-levelrepresentations– Domainmodels– Systemsequencediagrams– Systembehavioralcontracts

• Befastand(sometimes)loose– Elideobvious(?)details– Iterate,iterate,iterate,…

• Getfeedbackfromdomainexperts– Useonlydomain-levelconcepts

Page 22: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

2215-214

Artifactsofourdesignprocess

• Model/diagramtheproblem,defineobjects– Domainmodel(a.k.a.conceptualmodel)✓

• Definesystembehaviors– Systemsequencediagram✓– Systembehavioralcontracts✓

• Assignobjectresponsibilities,defineinteractions– Objectinteractiondiagrams

• Model/diagramapotentialsolution– Objectmodel

Understandingtheproblem

Definingasolution

Page 23: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

2315-214

Object-orientedprogramming

• Programmingbasedonstructuresthatcontainbothdataandmethodspublic class Bicycle {private int speed;private final Wheel frontWheel, rearWheel;private final Seat seat;…

public Bicycle(…) { … }

public void accelerate() { speed++;

}

public int speed() { return speed; }}

Page 24: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

2415-214

Object-OrientedDesign

• Object-OrientedDesign:“Afteridentifyingyourrequirementsandcreatingadomainmodel,thenaddmethodstothesoftwareclasses,anddefinethemessagingbetweentheobjectstofulfilltherequirements.”

• Buthow?– Howshouldconceptsbeimplementedbyclasses?– Whatmethodbelongswhere?– Howshouldtheobjectsinteract?– Thisisacritical,important,andnon-trivialtask

Page 25: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

2515-214

Responsibilityinobject-orientedprogramming

• Data:– Privateorotherwiseencapsulateddata– Dataincloselyrelatedobjects

• Methods:– Privateorotherwiseencapsulatedoperations– Objectcreation,ofitselforotherobjects– Initiatingactionsinotherobjects– Coordinatingactivitiesamongobjects

Page 26: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

2615-214

Responsibilities

• Responsibilitiesarerelatedtotheobligationsofanobjectintermsofitsbehavior.

• Twotypesofresponsibilities:– knowing– doing

• Doingresponsibilitiesofanobjectinclude:– doingsomethingitself,suchascreatinganobjectordoingacalculation– initiatingactioninotherobjects– controllingandcoordinatingactivitiesinotherobjects

• Knowingresponsibilitiesofanobjectinclude:– knowingaboutprivateencapsulateddata– knowingaboutrelatedobjects– knowingaboutthingsitcanderiveorcalculate

Page 27: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

2715-214

Usinginteractiondiagramstoassignobjectresponsibility

• Foragivensystem-leveloperation,createanobjectinteractiondiagramattheimplementation-level ofabstraction– Implementation-levelconcepts:

• Implementation-likemethodnames• Programmingtypes• Helpermethodsorclasses• Artifactsofdesignpatterns

Page 28: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

2815-214

Exampleinteractiondiagram#1

Usecasescenario:Alibrarymembershouldbeabletouseherlibrarycardtologinatalibrarysystemkioskand…

Page 29: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

2915-214

Exampleinteractiondiagram#2

Usecasescenario:…andborrowabook.Afterconfirmingthatthememberhasnounpaidlatefees,thelibrarysystemshoulddeterminethebook’sduedatebyaddingitsloanperiodtothecurrentday,andrecordthebookanditsduedateasaborrowediteminthemember’slibraryaccount.

Page 30: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

3015-214

Interactiondiagramshelpevaluatedesignalternatives

Createtwopossibleinteractiondiagrams:1. Solvingacryptarithm,assumingthatthecryptarithm classhas

responsibilityforsolvingitself2. Solvingacryptarithm,assumingthatthemainmethod(oradelegated

methodorclass)hasresponsibilityforsolvingthecryptarithm

Page 31: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

3115-214

Goals,Principles,Guidelines

• DesignGoals– Desiredqualityattributesofsoftware– Drivenbycost/benefiteconomics– Examples:designforchange,understanding,reuse,…

• DesignPrinciples– Guidelinesfordesigningsoftware– Supportoneormoredesigngoals– Examples:Informationhiding,lowrepr.gap,lowcoupling,highcohesion,…

• DesignHeuristics– Rulesofthumbforlow-level designdecisions– Promotedesignprinciples,andultimatelydesigngoals– Example:Creator,Expert,Controller

• DesignPatterns– Generalsolutionstorecurringdesignproblems– Promotedesigngoals,butmayaddcomplexityorinvolvetradeoffs– Examples:Decorator,Strategy,TemplateMethod

• Goals,principles,heuristics,patternsmayconflict– Usehigh-levelgoalsofprojecttoresolve

Goals

Heuristics Patterns

Principles

X

Page 32: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

3215-214

Heuristicsforresponsibilityassignment

• Controllerheuristic• Informationexpertheuristic• Creatorheuristic

Goals

Heuristics Patterns

Principles

Page 33: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

3315-214

Thecontrollerheuristic

• Assignresponsibilityforallsystem-levelbehaviorstoasinglesystem-levelobjectthatcoordinatesanddelegatesworktootherobjects– Alsoconsiderspecificsub-controllersforcomplexuse-casescenarios

• Designprocess:Extractinterfacefromsystemsequencediagrams– Keyprinciples:Lowrepresentationalgapandhighcohesion

Page 34: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

3415-214

Informationexpertheuristic

• Assignresponsibilitytotheclassthathastheinformationneededtofulfilltheresponsibility– Initialization,transformation,andviewsofprivatedata– Creationofcloselyrelatedorderivedobjects

Page 35: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

3515-214

Responsibilityinobject-orientedprogramming

• Data:– Privateorotherwiseencapsulateddata– Dataincloselyrelatedobjects

• Methods:– Privateorotherwiseencapsulatedoperations– Objectcreation,ofitselforotherobjects– Initiatingactionsinotherobjects– Coordinatingactivitiesamongobjects

Page 36: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

3615-214

Informationexpertheuristic

• Assignresponsibilitytotheclassthathastheinformationneededtofulfilltheresponsibility– Initialization,transformation,andviewsofprivatedata– Creationofcloselyrelatedorderivedobjects

• Designprocess:Assignmentfromdomainmodel– Keyprinciples:Lowrepresentationalgapandlowcoupling

Page 37: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

3715-214

Usetheinformationexpertheuristic

• InHomework3,whatobjectshouldhavetheresponsibilitytosolveacryptarithm?

• Whatistherelevantinformation?

Page 38: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

3815-214

Usetheinformationexpertheuristic

• InHomework3,whatobjectshouldhavetheresponsibilitytosolveacryptarithm?

• Whatistherelevantinformation?– Whoknowsthe#ofdigits(e.g.base10)inthecryptarithm?– Whoknowsthelettersofthecryptarithm?– Whocanevaluatethecryptarithm expressionstocheckforequality?

Page 39: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

3915-214

Anotherdesignprinciple:Minimizeconceptualweight

• Labeltheconceptsforaproposedobject– Relatedtorepresentationalgapandcohesion

Page 40: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

4015-214

Creatorheuristic:WhocreatesanobjectFoo?

• AssignresponsibilityofcreatinganobjectFootoaclassthat:– HasthedatanecessaryforinitializinginstancesofFoo– Contains,aggregates,orrecordsinstancesofFoo– CloselyusesormanipulatesinstancesofFoo

• Designprocess:Extractfromdomainmodel,interactiondiagrams– Keyprinciples:Lowcouplingandlowrepresentationalgap

Page 41: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

4115-214

Usethecreatorheuristic

• InHomework3,whatobjectshouldhavetheresponsibilityforcreatingthepermutationgenerator?

Page 42: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

4215-214

Object-levelartifactsofthisdesignprocess

• Objectinteractiondiagrams addmethodstoobjects– Caninferadditionaldataresponsibilities– Caninferadditionaldatatypesandarchitecturalpatterns

• Objectmodel aggregatesimportantdesigndecisions– Isanimplementationguide

Page 43: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

4315-214

Creatinganobjectmodel

• Extractdata,methodnames,andtypesfrominteractiondiagrams– Includeimplementationdetailssuchasvisibilities

Page 44: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

4415-214

Page 45: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

4515-214

Createanobjectmodelforyourcryptarithm solver

Page 46: Charlie Garrod Michael Hilton - cs.cmu.educharlie/courses/15-214/2017-fall/slides/20170926... · 26/09/2017  · Solving a cryptarithm, assuming that the cryptarithmclass has responsibility

4615-214

Summary:

• Object-levelinteractiondiagramsandobjectmodelsystematicallyguidethedesignprocess– Convertdomainmodel,systemsequencediagram,andcontractsto

object-levelresponsibilities

• Useheuristicstoguide,butnotdefine,designdecisions• Iterate,iterate,iterate…