Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Chapter 18 Object Design Examples with GRASP 1CS6359 Fall 2011 John Cole."— Presentation transcript:

1 Chapter 18 Object Design Examples with GRASP 1CS6359 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 Cole2

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 Cole3

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 Cole4

5 Basic Patterns Creator Information Expert Controller Low Coupling High Cohesion CS6359 Fall 2011 John Cole5

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 Cole6

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 Cole7

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

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 Cole9

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 Cole10


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

Similar presentations


Ads by Google