Fall 2009ACS-3913 Ron McFadyen1 Use Case Realizations with GRASP Patterns “The assignment of responsibilities and design of collaborations are very important.

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 15, Ron McFadyen1 Ch 9. Use-case model: drawing System Sequence Diagrams Iteration: a simple cash-only success scenario of Process Sale.
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:
Jan Ron McFadyen1 Consider a simple cash-only Process Sale scenario 1. Customer arrives at a POS checkout with goods and/or services to purchase.
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.
Object-Oriented Analysis and Design
January Ron McFadyen1 Ch 9. Use-case model: drawing System Sequence Diagrams Elaboration Iteration 1: a simple cash-only success scenario of.
NJIT Object Design Examples with GRASP Chapter 18 Applying UML and Patterns Craig Larman Presented By : Ajay Alegonda.
Fall 2009ACS Ron McFadyen1 The context maintains an instance of a concrete state subclass State Pattern Each subclass (concrete state) implements.
February Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m.
ACS-3913Fall 2009 Ron McFadyen1 Contracts Used to help understand requirements more completely (and so may not always be necessary) based on assertions;
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.
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.
Fall 2009ACS-3913 R. McFadyen1 Protected Variations Principle: How do you design so that variations in the future do not have an undesirable affect on.
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.
Sept Ron McFadyen1 Extend Relationship.
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.
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.
Chapter 7: Object Design Examples with GRASP. Objective Design use case realizations. Apply GRASP to assign responsibilities to classes. Apply UML to.
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)
Object-Oriented Analysis and Design Mar 11, 2008.
17. GRASP—Designing Objects with Responsibilities III CSE5324 Lecture Quiz 17 due at 5 PM Thursday, 8 October 2015.
Chapter 17 GRASP: Designing Objects with Responsibilities. 1CS6359 Fall 2011 John Cole.
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.
Larman ch. 131 Use-Case Model : Adding Detail with operation contracts Larman ch. 13.
Operation Contracts. Primary way to describe system behavior is with use cases Operation contracts provide more details in terms of state changes to objects.
TK2023 Object-Oriented Software Engineering CHAPTER 12 Introduction to Responsibility-Driven Design.
Object-Oriented Analysis and Design Week 11, 2009.
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.
OO Methodology Elaboration Phase Iteration 1- Part 2.
Ch 17: Use Case Realizations with GRASP Patterns
Object Design Examples with GRASP
TK2023 Object-Oriented Software Engineering
Conception OBJET GRASP Patterns
DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS
GRASP : Designing Objects with Responsibilities
CONTENTS Object-Oriented Modeling Using UML
Implementation Model: Mapping Designs to Code
Operation Contracts Ch. 11.
Design Model: Creating Design Class Diagrams
Presentation transcript:

Fall 2009ACS-3913 Ron McFadyen1 Use Case Realizations with GRASP Patterns “The assignment of responsibilities and design of collaborations are very important and creative steps during design” “there is no ‘magic’ or unjustifiable decisions in object design” “A use-case realization describes how a particular use case is realized within the design model, in terms of collaborating objects” makeNewSale enterItem endSale makePayment startUp read these sections

Fall 2009ACS-3913 Ron McFadyen2 Ch 17: Use Case Realizations with GRASP Patterns makeNewSale 1 st 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.

Fall 2009ACS-3913 Ron McFadyen3 Use Case Realizations with GRASP Patterns By “Controller”, Register is our “façade” controller. makeNewSale() :Register

Fall 2009ACS-3913 Ron McFadyen4 Use Case Realizations with GRASP Patterns public class Register {… public makeNewSale() { … } We have just decided that Register must have a method makeNewSale Here, we are looking ahead to some code written to support the design Register makeNewSale() …

Fall 2009ACS-3913 Ron McFadyen5 Use Case Realizations with GRASP Patterns 2 nd 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 …

Fall 2009ACS-3913 Ron McFadyen6 Use Case Realizations with GRASP Patterns By “Creator”, Register creates a Sale. makeNewSale() :Register create() :Sale

Fall 2009ACS-3913 Ron McFadyen7 Use Case Realizations with GRASP Patterns public class Register {… Private Sale sale; … public makeNewSale() { sale = new Sale(); } The method makeNewSale creates the sale object Here, we are looking ahead to some code written to support the design

Fall 2009ACS-3913 Ron McFadyen8 Use Case Realizations with GRASP Patterns 3 rd 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…

Fall 2009ACS-3913 Ron McFadyen9 Use Case Realizations with GRASP Patterns By “Creator”, Register creates a Sale. makeNewSale() :Register create() :Sale create() lineItems: List

Fall 2009ACS-3913 Ron McFadyen10 Use Case Realizations with GRASP Patterns public class Sale {private List lineItems = new ArrayList (); private Date date = new Date(); private boolean isComplete = false; private Payment payment; … The constructor for Sale creates the container for the line items. Sale contains a list of line items

Fall 2009ACS-3913 Ron McFadyen11 Use Case Realizations with GRASP Patterns enterItem 1 st 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.

Fall 2009ACS-3913 Ron McFadyen12 Use Case Realizations with GRASP Patterns Contract for enteritem specifies Preconditions: A Sale is underway Postconditions: salesLineItem created It is associated with the current Sale Its quantity is set It is associated with a ProductDescription By Creator, Sale can do this Sale stores the new sales line item in its collection The product description will need to be found

Fall 2009ACS-3913 Ron McFadyen13 Use Case Realizations with GRASP Patterns enterItem() :Register:Sale : SalesLineItem 2:makeLineItem() 2.1:create() 2.2:add() Message 2 … see later slide lineItems: List

Fall 2009ACS-3913 Ron McFadyen14 Use Case Realizations with GRASP Patterns enterItem 2 nd 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.

Fall 2009ACS-3913 Ron McFadyen15 Use Case Realizations with GRASP Patterns enterItem() :Register :Map :ProductCatalog 1:desc=getProductDesc(id) 1.1:desc=get(id)

Fall 2009ACS-3913 Ron McFadyen16 Use Case Realizations with GRASP Patterns enterItem() :Register:Sale :ProductCatalog :SalesLineItem 1:desc=getProductDesc(id) 1.1desc=get(id) 2:makeLineItem() 2.1:create() 2.2:add() : Map lineItems: List

Fall 2009ACS-3913 Ron McFadyen17 Use Case Realizations with GRASP Patterns Given the previous collaboration, what methods/responsibilities have been assigned to the various classes? RegisterSale ProductCatalog SalesLineItem