Ch 17: Use Case Realizations with GRASP Patterns

Slides:



Advertisements
Similar presentations
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Advertisements

Object Design Examples with GRASP
Jan 23, Ron McFadyen1 SSD for a samplePOS Use Case Figure 13.1 Input Events invoke a system operation of the same name same idea as in object-oriented.
Oct Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
Oct 2, Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m Function:
March Ron McFadyen1 Ch 17: Use Case Realizations with GRASP Patterns Assigning responsibilities to objects to achieve user goals Section 17.4.
Feb R. McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m Function:
Fall 2009AXS-3913 Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
Oct Ron McFadyen1 Ch 17: Use Case Realizations with GRASP Patterns P. 248: “The assignment of responsibilities and design of collaborations.
NJIT Object Design Examples with GRASP Chapter 18 Applying UML and Patterns Craig Larman Presented By : Ajay Alegonda.
February Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m.
Feb 4, Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – (interfaces,
Feb Ron McFadyen1 Use Case Realizations with GRASP Patterns “The assignment of responsibilities and design of collaborations are very important.
Object-Oriented Analysis and Design
GRASP : Designing Objects with Responsibilities
November Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
Fall 2009ACS-3913 Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Date: 1753 an interpretation.
Feb 4, Ron McFadyen1 founded on principles of good OO design idea was first put forth by Christopher Alexander (1977) in their work concerning.
9/18/011 Software Requirements Analysis and Design (Continued)
Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative Development Part III Elaboration Iteration I – Basic1.
CSSE 374: More GRASP’ing and Use Case Realization Steve Chenoweth Office: Moench Room F220 Phone: (812) These.
GRASP Pattern Zhen Jiang West Chester University
GRASP Principles. How to Design Objects The hard step: moving from analysis to design How to do it? –Design principles (Larman: “patterns”) – an attempt.
GRASP Patterns Presented By Dr. Shazzad Hosain. Patterns A pattern describes a problem and solution, and given a name. Examples are Singleton, Adapter,
Chapter 18 Object Design Examples with GRASP. Objectives Design use case realizations –A use-case realization describes how a particular use case is realized.
1 Ch 18. Object Design Examples With Grasp Objectives Design use case realizations. Apply GRASP to assign responsibilities to classes. Apply UML to illustrate.
1 Unified Modelling Language OOA/OOD a summary of the book: Applying UML and Patterns, Craig Larman D. Dranidis October 2000 CITY College.
GRASP: Designing Objects With Responsibilities Chapter 17 Applying UML and Patterns -Craig Larman.
Chapter 18 Object Design Examples with GRASP 1CS6359 Fall 2011 John Cole.
Object Design Examples with GRASP (Ch. 18)
17. GRASP—Designing Objects with Responsibilities III CSE5324 Lecture Quiz 17 due at 5 PM Thursday, 8 October 2015.
Design Patterns. Patterns “Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution.
Review ♦ System sequence diagram ♦ Domain model
Object-Oriented Analysis and Design 1 Mira Balaban & Arnon Sturm Object-Oriented Analysis and Design Session 4: Object-Oriented Software Construction.
1 Lecture 6: Operation Contracts. 2 Overview  What is contract ?  The guidelines for writing contracts for the system operations.  Use Case realizations.
Operation Contracts: Getting ready to open the “System” black box All material from Applying UML and Patterns, 3 rd Edition, Craig Larman, chapter 11.
Design Class Diagrams (DCDs)
Operation Contracts. Primary way to describe system behavior is with use cases Operation contracts provide more details in terms of state changes to objects.
OO Methodology Elaboration Iteration 2 - Design Patterns -
Fall 2009ACS-3913 Ron McFadyen1 Use Case Realizations with GRASP Patterns “The assignment of responsibilities and design of collaborations are very important.
TK2023 Object-Oriented Software Engineering CHAPTER 12 Introduction to Responsibility-Driven Design.
OO Design Roshan Chitrakar. Analysis to Design Do the RIGHT thing Do the RIGHT thing Requirement Analysis Requirement Analysis Domain Modeling with addition.
Copyright © Craig Larman All Rights Reserved COMP-350 Object-Oriented Analysis and Design GRASP: Designing Objects with Responsibilities Reference:
GRASP: Designing Objects With Responsibilities
OO Methodology Elaboration Phase Iteration 1- Part 3.
Design. 2 The Need for Software Blueprints Knowing an object-oriented language and having access to a library is necessary but not sufficient in order.
1 Chapter 9: Operation Contracts Chapter 13 in Applying UML and Patterns Book.
Use-Case Model: Adding Detail with Operation Contracts.
1 Design Model Use-Case realizations with GRASP Larman chapter 17.
Oct 3, Ron McFadyen1 GRASP Patterns 1.Expert 2.Creator 3.Controller 4.Low Coupling 5.High Cohesion.
INFO 620Lecture #101 Information Systems Analysis and Design Implementation Concerns, Review INFO 620 Glenn Booker.
Design Model: Determining Visibility CH-18. Objectives Identify four kinds of visibility. Design to establish visibility. Illustrate kinds of visibility.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
OO Methodology Elaboration Phase Iteration 1- Part 2.
Object Design Examples with GRASP
TK2023 Object-Oriented Software Engineering
System Sequence Diagrams and Operation Contracts
Chapter 12: Collaboration Diagram - PART2
Conception OBJET GRASP Patterns
DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS
TK2023 Object-Oriented Software Engineering
Presentation on GRASP Patterns Submitted by
GRASP : Designing Objects with Responsibilities
Chapter 10: Visibility Chapter 18 in Applying UML and Patterns Book.
Chapter 11: Class Diagram
CONTENTS Object-Oriented Modeling Using UML
Implementation Model: Mapping Designs to Code
Operation Contracts Ch. 11.
Chapter 11: Class Diagram
Design Model: Creating Design Class Diagrams
Presentation transcript:

Ch 17: Use Case Realizations with GRASP Patterns (assigning responsibilities to objects to achieve user goals) Section 17.3 makeNewSale 1st concern: who/what is going to be responsible for handling the system operation makeNewSale? Decision: Using the Controller Pattern … since there aren’t very many system operations and since Register (in our domain) represents the overall system, we choose Register as a “façade” controller.

Ch 17: Use Case Realizations with GRASP Patterns By “Controller”, Register is our “façade” controller. :Register makeNewSale()

Ch 17: Use Case Realizations with GRASP Patterns Page 314 public class Register { … public makeNewSale() { … } We have just decided that Register must have a method makeNewSale

Ch 17: Use Case Realizations with GRASP Patterns 2nd concern: who/what is going to be responsible for creating a Sale? Should Register delegate the responsibility or …? Since Register (in the domain) actually records a Sale then, by “Creator”, we decide that Register will do this. Register has the data and it needs to keep track of a Sale, so …

Ch 17: Use Case Realizations with GRASP Patterns By “Creator”, Register creates a Sale. :Register makeNewSale() create() :Sale

Ch 17: Use Case Realizations with GRASP Patterns Page 314 public class Register { … Private Sale sale; … public makeNewSale() { sale = new Sale(); } The method makeNewSale creates the sale object

Ch 17: Use Case Realizations with GRASP Patterns 3rd concern: Sale needs to know of its SalesLineItems. A container for these is required. Who/What should create this? Since Sale will contain the lines, by “Creator”, we decide that Sale will do this…

Ch 17: Use Case Realizations with GRASP Patterns By “Creator”, Register creates a Sale. :Register makeNewSale() create() :Sale : create() :SalesLineItem

Ch 17: Use Case Realizations with GRASP Patterns The constructor for Sale creates the container for the line items Page 315 public class Sale { private List lineItems = new ArrayList(); private Date date = new Date(); private boolean isComplete = false; private Payment payment; …

Ch 17: Use Case Realizations with GRASP Patterns Section 17.5 enterItem 1st concern: who/what is going to be responsible for handling the system operation enterItem? We continue using the Controller Pattern … Register is responsible for handling enterItem.

Ch 17: Use Case Realizations with GRASP Patterns Contract for enteritem specifies Preconditions: A Sale is underway Postconditions: salesLineItem is created It is associated with the current Sale Its quantity is set It is associated with a ProductSpecification By Creator, Sale can do this Sale stores the new sales line item in its collection The product specification will need to be found

Ch 17: Use Case Realizations with GRASP Patterns Message 2 … see later slide enterItem() 2:makeLineItem() :Register :Sale 2.1:create() 2.2:add() : SalesLineItem : :SalesLineItem

Ch 17: Use Case Realizations with GRASP Patterns Page 315 public class Sale { … public void makeLineItem (…, …) { lineItems.add ( new SalesLineItem (…, …) ) ; } The “create” message for a new sales line item The “add” message sent to the multiobject

Ch 17: Use Case Realizations with GRASP Patterns Page 316 public class SalesLineItem { private int quantity; private ProductSpecification productSpec; public void SalesLineItem (…spec, …quantity) { this.productSpec = spec ; this.quantity = quantity } The constructor for a sales line itemarranges that the sales line item knows its product specification and its quantity

Ch 17: Use Case Realizations with GRASP Patterns Section 17.5 enterItem 2nd concern: who/what is going to be responsible for finding a match for a product specification? For doing a lookup? Who has knowledge of product specifications? Who is capable of doing a lookup? Expert suggests the product catalogue is the best candidate. The product catalogue contains the product specifications … the product catalogue has the information, it is the expert.

:ProductSpecification Ch 17: Use Case Realizations with GRASP Patterns enterItem() :Register 1:getSpecification() :ProductCatalog 1.1:find() : :ProductSpecification

Ch 17: Use Case Realizations with GRASP Patterns Collection of product specifications Page 316 public class ProductCatalog { private Map productSpecifications = new HashMap(); … public ProductSpecification getSpecification (ItemID id) { Return( …. productSpecifications.get ( id ); } Method to find a specific item Handles the “find” message

:ProductSpecification Ch 17: Use Case Realizations with GRASP Patterns enterItem() 2:makeLineItem() :Register :Sale 1:getSpecification() 2.1:create() 2.2:add() :ProductCatalog :SalesLineItem 1.1:find() : :SalesLineItem : :ProductSpecification

Ch 17: Use Case Realizations with GRASP Patterns Given the previous collaboration, what methods/responsibilities have been assigned to the various classes? Register Sale ProductCatalog SalesLineItem