1University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 1Lecture 14:Robustness AnalysisGood Object Oriented DesignRobustness AnalysisAllocating BehaviourUniversity of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 2Starting PointYou’ve done the Requirements AnalysisYou have:Challenge:Allocate responsibility for the use cases to classes in the systemDocum entDictiona ryWordmisspe lling1..*Alphab eticcharact ercorrect spellingSugges tion list1..*1..*11HasNon-Alp habeticcharact erends1have an automa ted spelling checke rreduce the number of spelling mistak essave tim e lookingup word s inmy dict ionaryhelp me learnto spell better+++++have cu stom dictiona riesspot err orsas I wri teallow m e toignore m ispellingssugges t correc tspelling sandwritertechnic alwriterignore amispellingadd wo rdto dict ionaryspell ch eckas you writespell ch eckdocume ntauto-suggestinvokesA set of Use Cases(explaining how users will use the system)A Domain Model(to keep track of key domain concepts)Stakeholder Goal Models(explaining how the use cases will meet the stakeholders’real needs)2University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 3Diversion: What’s wrong with this?Job*1Everything ControllergetJC(j:Job) : JobController JobController 1**1University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 4Or this?CustomerPayPalAccountCreditCardBookstoreclass Bookstore { …void settlebill (int total) { … Customer.PayPalAccount.CreditCard.subtract(total) … }}3University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 5the Law of DemeterBasically:“Only talk to your friends”More specifically:A method, m, of an object, O, can only call methods of:1. O itself2. m’s parameters3. any object created by m4. O’s direct component objects[m cannot call methods of an object returned by another method call]Programmer’s rule of thumb:“use only one dot”e.g. instead of: Customer.PayPalAccount.CreditCard.subtract(total)use: Customer.GetPayment(total)University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 6Robustness AnalysisBoundary ObjectsUsed by actors when communicating with the systemOnly these can initiate events(usually widgets on the UI)Entity ObjectsUsually objects from the domain modelThings we need to keep track ofControl ObjectsThe “glue” between boundary objects & entity objectsCapture business rules and policies(note: often implemented as methods of other objects)4University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 7Why do Robustness Analysis?Bridges the gap between Requirements and DesignSanity CheckTests the language in the Use Case descriptionNouns from the Use Case get mapped onto objectsVerbs from the Use Case get mapped onto actionsCompleteness CheckDiscover the objects you need to implement the use casesIdentify alternative courses of actionObject IdentificationDecide which methods belong to which objectsUniversity of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 8Rules for Robustness DiagramsAllowed Not Allowed5University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 9Intended for the whiteboard…University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 10Contructing a Robustness DiagramAdd a boundary element for each major UI elementAdd a controller to manage each Use CaseAdd a controller for each business ruleAdd a controller for any activity that involvescoordination of several other elementAdd an entity for each business concept6University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 11ExampleCustomerHome Pageclick loginLogin Pageclick OKDisplay Generatoraccount tablevalidate logingenerate errormessageUniversity of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 12ICONIX process7University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 13Basic Design StepsUniversity of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 14Benefits of Robustness Analysis1. Forces a consistent style foruse cases2. Forces correct ‘voice’ for usecases3. Sanity and completenesscheck for use cases4. Syntax rules for use casedescriptionse.g. actors only talk to boundary objects5. Quicker and easier to readthan sequence diagrams6. Encourages use ofModel-View-Controller (MVC)pattern7. Helps build layeredarchitecturese.g presentation layer, domain layer,repository layer8. Checks for reusability acrossuse cases before doingdetailed design9. Provides traceability betweenuser’s view and design view10. Plugs semantic gap betweenrequirements and
View Full Document