1!University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 1 Lecture 14:!Robustness Analysis"Good Object Oriented Design"Robustness Analysis"Allocating Behaviour"University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 2 Starting Point"Youʼve done the Requirements Analysis"You have:"""""""Challenge:"Allocate responsibility for the use cases to classes in the system"Document!Dictionary!Word!misspelling!1..*!Alphabetic!character!correct spelling!Suggestion list!1..*!1..*!1!1!Has!!Non-Alphabetic!character!ends!!1!have an !automated !spelling checker!reduce the !number of !spelling mistakes!save time looking!up words in!my dictionary!help me learn!to spell better!+!++!++!have custom !dictionaries!spot errors!as I write!allow me to!ignore mispellings!suggest correct!spellings!and!writer!technical!writer!ignore a mispelling add word to dictionary spell check as you write spell check document auto-suggest invokes!A 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)"2!University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 3 Diversion: Whatʼs wrong with this?"Customer!PayPal!Account!CreditCard!Bookstore!class Bookstore {! …!!void settlebill (int total) {! …! Customer.PayPalAccount.CreditCard.subtract(total)! …! }!}!University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 4 the Law of Demeter"Basically:"“Only talk to your friends”"More specifically:"A method, m, of an object, O, can only call methods of:"1. O itself"2. mʼs parameters"3. any object created by m"4. 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)"3!University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 5 Robustness Analysis"Boundary Objects"Used by actors when communicating with the system"Only these can initiate events"(usually major User Interface elements, eg screens)""Entity Objects"Usually objects from the domain model"Things we need to keep track of""Control Objects"The “glue” between boundary objects & entity objects"Capture business rules and policies"(note: often implemented as methods of other objects)"University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 6 Why do Robustness Analysis?"Bridges the gap between Requirements and Design"Sanity Check"Tests the language in the Use Case description"Nouns from the Use Case get mapped onto objects"Verbs from the Use Case get mapped onto actions"Completeness Check"Discover the objects you need to implement the use cases"Identify alternative courses of action"Object Identification"Decide which methods belong to which objects"4!University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 7 Rules for Robustness Diagrams"Allowed! Not Allowed!University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 8 Example"Customer!Home Page!click login!Login Page!click OK!Display !Generator!account table!validate login!generate !error!message!5!University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 9 Intended for the whiteboard…"Source: Scott Ambler, Robustness Diagrams!University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 10 Constructing a Robustness Diagram"Add a boundary element for each major UI element"(not at the level of individual widgets though!)"Add controllers:"One to manage each Use Case"One for each business rule"Another for each activity that involves coordination of several other elements"Add an entity for each business concept"(most domain objects!)"6!University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 11 Compare against each Use Case"Source: Matt Stephens, Robustness Analysis in Practice!University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 12 Improved Diagram…"Source: Matt Stephens, Robustness Analysis in Practice!7!University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 13 ICONIX process"University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 14 Basic Design Steps"8!University of Toronto Department of Computer Science © 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 15 Benefits of Robustness Analysis"1. Forces a consistent style for use cases"2. Forces correct ʻvoiceʼ for use cases"3. Sanity and completeness check for use cases"4. Syntax rules for use case descriptions"e.g. actors only
View Full Document