DESIGN MODEL: 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
Object-Oriented Analysis and Design CHAPTER 17, 25: GRASP PATTERNS 1.
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.
Feb R. McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m Function:
Oct Ron McFadyen1 Ch 17: Use Case Realizations with GRASP Patterns P. 248: “The assignment of responsibilities and design of collaborations.
Drawing System Sequence Diagrams
NJIT Object Design Examples with GRASP Chapter 18 Applying UML and Patterns Craig Larman Presented By : Ajay Alegonda.
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
February Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m.
6/8/991 Analysis Tuesday 09/14/99 Revised: September 11, 2000 (APM)
Feb Ron McFadyen1 Use Case Realizations with GRASP Patterns “The assignment of responsibilities and design of collaborations are very important.
Object-Oriented Software Engineering Practical Software Development using UML and Java Design Patterns Sources: Chapter 6: Using Design Patterns, and Chapter.
NJIT Drawing System Sequence Diagrams Chapter 10 Applying UML and Patterns Craig Larman Presented by Anuradha Dharani.
Object-Oriented Analysis and Design
GRASP : Designing Objects with Responsibilities
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.
Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative Development Part III Elaboration Iteration I – Basic1.
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.
Chapter 17. GRASP General Responsibility Assignment Software Patterns (Principles) OOD: after identifying requirements, create domain model, define responsiblities.
Architecture GRASP Realization of use cases in interaction diagrams Design class diagram Design ( how )
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 On to Object Design Chapter 14 Applying UML and Patterns.
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.
GRASP: Designing Objects With Responsibilities
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
1 Lecture 6: Operation Contracts. 2 Overview  What is contract ?  The guidelines for writing contracts for the system operations.  Use Case realizations.
GRASP: Designing Objects with Responsibilities
Chapter 9 Applying UML and Patterns -Craig Larman
IntellAgile Copyright © 2002 Craig Larman. All rights reserved. Object Design and Use- Case Realizations with GRASP Patterns.
What to remember from Chap 13 (Logical architecture)
Drawing System Sequence Diagrams
COMP-350 Object-Oriented Analysis and Design Drawing System Sequence Diagrams Reference: Larman, Chapter 9.
Object-Oriented Analysis and Design Mar 9, 2008.
Fall 2009ACS-3913 Ron McFadyen1 Use Case Realizations with GRASP Patterns “The assignment of responsibilities and design of collaborations are very important.
OO Design Roshan Chitrakar. Analysis to Design Do the RIGHT thing Do the RIGHT thing Requirement Analysis Requirement Analysis Domain Modeling with addition.
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.
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.
General Principles in Assigning Responsibilities Responsibilities Responsibility-Driven Design CRC Cards GRASP.
1 Object Oriented Analysis and Design System Events & Contracts.
OO Methodology Elaboration Phase Iteration 1- Part 2.
Object Design Examples with GRASP
TK2023 Object-Oriented Software Engineering
System Sequence Diagrams and Operation Contracts
TK2023 Object-Oriented Software Engineering
Chapter 12: Collaboration Diagram - PART2
Conception OBJET GRASP Patterns
Chapter 11: Collaboration Diagram - PART1
Apply Expert, Creator, Controller, Low Coupling, High Cohesion
GRASP : Designing Objects with Responsibilities
Sequence Diagrams Lecture 6.
System Sequence Diagrams(SSD)
Operation Contracts Ch. 11.
Design Model: Creating Design Class Diagrams
Presentation transcript:

DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS Chapter # 17 Craig Larman Applying UML and Patterns

Objectives Design use-case realizations. Apply the GRASP patterns to assign responsibilities to classes. Use the UML interaction diagram notation to illustrate the design of objects.

Use-Case Realizations "A use-case realization describes how a particular use case is realized within the design model, in terms of collaborating objects" [RUP].

Use-case realization is a UP term or concept used to remind us of the connection between the requirements expressed as use cases, and the object design that satisfies the requirements. UML interaction diagrams are a common language to illustrate use-case realizations. There are principles and patterns of object design, such as Information Expert and Low Coupling, that can be applied during this design work.

• The use case suggests the system events that are explicitly shown in system sequence diagrams. • Details of the effect of the system events in terms of changes to domain objects may optionally be described in system operation contracts. • The system events represent messages that initiate interaction diagrams, which illustrate how objects interact to fulfill the required tasks—the use case realization. • The interaction diagrams involve message interaction between software objects (whose names are sometimes inspired by the names of conceptual classes in the Domain Model) plus other classes of objects.

Interaction Diagrams and Use-Case Realizations In the current iteration we are considering various scenarios and system events such as: • Process Scale: makeNewSale, enterItem, endSale, makePayment If collaboration diagrams are used to illustrate the use-case realizations, a different collaboration diagram will be required to show the handling of each system event message. For example

For Example On the other hand, if sequence diagrams are used, it may be possible to fit all system event messages on the same diagram,

For Example However, it is often the case that the sequence diagram is then too complex or long.

Contracts and Use-Case Realizations To reiterate, it may be possible to design use-case realizations directly from the use case text. In addition, for some system operations, contracts may have been written that add greater detail or specificity. For Example

for each contract, we work through the postcondition state changes and design message interactions to satisfy the requirements. For example, given this partial enterItem system operation, a partial interaction diagram is shown in Figure 17.4 that satisfies the state change of SalesLineItem instance creation.

Requirements are not perfect, or have changed Need to continuously engage customers and subject matter experts in review and feedback on the growing system's behavior.

The Domain Model and Use-Case Realizations The object developer has taken inspiration from the real-world domain in creating software classes. Therefore, the representational gap between the stakeholders perceive the domain, and its representation in software, has been lowered. It is appropriate to discover new conceptual classes during this design work that were missed during earlier domain analysis, and also to make up software classes whose names and purpose is completely unrelated to the Domain Model.

Conceptual vs. Design Classes

Object Design: makeNewSale The makeNewSale system operation occurs when a cashier requests to start a new sale, after a customer has arrived with things to buy. The use case may have been sufficient to decide what was necessary, but for this case study we wrote contracts for all the system events, for explanation and completeness.

Choosing the Controller Class Our first design choice involves choosing the controller for the system operation message enterItem. By the Controller pattern, here are some choices: Represents the overall "system," device, or subsystem Register, POSSystem Represents a receiver or handler of all system events of a use case scenario. ProcessSaleHandler, ProcessSaleSession

Choosing the Controller Class Choosing a facade controller like Register is satisfactory if there are only a few system operations and the facade controller is not taking on too many responsibilities Choosing a use-case controller is suitable when there are many system operations and we wish to distribute responsibilities in order to keep each controller class lightweight and focused

Cont… This Register is a software object in the Design Model. It is not a real physical register but a software abstraction whose name was chosen to lower the representational gap between our concept of the domain and the software. Thus, the interaction diagram begins by sending the makeNewSale message to a Register software object.

Creating a New Sale A software Sale object must be created, and the GRASP Creator pattern suggests assigning the responsibility for creation to a class that aggregates, contains, or records the object to be created.

Cont… Domain Model reveals that a Register may be thought of as recording a Sale; indeed, the word "register" in business has for many years meant the thing that recorded (or registered) account transactions, such as sales Register is a reasonable candidate for creating a Sale. And by having the Register create the Sale, the Register can easily be associated with it over time, so that during future operations within the session, the Register will have a reference to the current Sale instance.

In addition to the above, when the Sale is created, it must create an empty collection to record all the future SalesLineItem instances that will be added. This collection will be contained within and maintained by the Sale instance, which implies by Creator that the Sale is a good candidate for creating it. Therefore, the Register creates the Sale, and the Sale creates an empty collection, represented by a multi object in the interaction diagram. Conclusion : The design was not difficult, but the point of its careful explanation in terms of Controller and Creator was to illustrate that the details of a design can be rationally and methodically decided and explained in terms of principles and patterns, such as GRASP.

Do it by Yourself Object Design: enterltem The enterItem system operation occurs when a cashier enters the itemID and (optionally) the quantity of something to be purchased. Object Design: endSale The endSale system operation occurs when a cashier presses a button indicating the end of a sale. Object Design: makePayment The makePayment system operation occurs when a cashier enters the amount of cash tendered for payment.

The POS Application startup Operation The startUp system operation occurs when a manager powers on the POS system and the software loads. Assume that the initial domain object is not responsible for taking control of the process; control will remain in the UI layer (such as a Java JFrame) after the initial domain object is created. Therefore, the interaction diagram for the startUp operation may be reinterpreted solely as a cre-ate() message sent to create the initial object.

Choosing the Initial Domain Object Choose as an initial domain object a class at or near the root of the containment or aggregation hierarchy of domain objects. This may be a facade controller, such as Register, or some other object considered to contain all or most other objects, such as a Store. Choosing between these alternatives may be influenced by High Cohesion and Low Coupling considerations. In this application, the Store is chosen as the initial object.

Persistent Objects: Product Specification The Product Specification instances will reside in a persistent storage medium, such as relational or object database. During the startUp operation, if there are only a few of these objects, they may all be loaded into the computer's direct memory. However, if there are many, loading them all would consume too much memory or time. Alternately—and more likely—individual instances will be loaded on demand into memory as they are required.