1 / 10

Chapter 18

Chapter 18. Object Design Examples with GRASP. Use Case Realization. Describes how a particular use case is realized within the design model in terms of collaborating objects. Command-Query Separation.

jalen
Download Presentation

Chapter 18

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 18 Object Design Examples with GRASP CS6359 Fall 2011 John Cole

  2. Use Case Realization • Describes how a particular use case is realized within the design model in terms of collaborating objects CS6359 Fall 2011 John Cole

  3. Command-Query Separation • A method that changes the value of a variable (or the state of the object) should not also return (query) its value. • A method that returns the value of a variable should not also change it. CS6359 Fall 2011 John Cole

  4. Connect UI to Domain • An initializer object creates both the UI and the domain objects and passes the domain object to the UI • The UI object retrieves the domain object from a well-known source such as a factory object that creates domain objects CS6359 Fall 2011 John Cole

  5. Basic Patterns • Creator • Information Expert • Controller • Low Coupling • High Cohesion CS6359 Fall 2011 John Cole

  6. Realization • Look at the objects suggested by the use case • Determine who should create them • Decide how they should interact • Determine which patterns are being used. CS6359 Fall 2011 John Cole

  7. Example: Sell Something • Register could create the Sale object • Sale object creates SalesLineItem objects in list • SalesLineItem interacts with Product to get pricing and description CS6359 Fall 2011 John Cole

  8. Design makeNewSale • Register creates Sale instance s and stores the reference • Attributes of s are initialized CS6359 Fall 2011 John Cole

  9. Controller Class Design • Represents the overall system or “root object” • “Store” in the POS system is a root object because other objects exist within it • POSSystem is also a root object • Register could also be a root object CS6359 Fall 2012 John Cole

  10. Creating a New Sale • Register creates a Sale object • Sale object, as part of its initialization, creates an empty list of SalesLineItems • Register is, therefore, the Controller CS6359 Fall 2011 John Cole

More Related