17. GRASP—Designing Objects with Responsibilities III CSE5324 Lecture Quiz 17 due at 5 PM Thursday, 8 October 2015.

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-Oriented Analysis and Design
Object Design Examples with GRASP
Object-Oriented Analysis and Design CHAPTER 17, 25: GRASP PATTERNS 1.
GRASP Patterns M Taimoor Khan
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:
February Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m.
Low Coupling High Cohesion
Object-Oriented Analysis and Design
Software Design Yashvardhan Sharma.
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.
CSSE 374: More GRASP’ing and Use Case Realization Steve Chenoweth Office: Moench Room F220 Phone: (812) These.
GRASP Design Patterns: Designing Objects with Responsibilities
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.
GRASP PATTERNS Information Expert (Expert) Creator Controller © Lethbridge/Laganière 2001 Chapter 6: Using design patterns1.
Chapter 17. GRASP General Responsibility Assignment Software Patterns (Principles) OOD: after identifying requirements, create domain model, define responsiblities.
1 Chapter 17 GRASP Design Patterns: Designing Objects with Responsibilities.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
1 SAD2 - UML 4 th Lecture Class Diagram in Construction Phase Patterns Case Study Lecturer: Dr Dimitrios Makris
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
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.
INFO 620Lecture #61 Information Systems Analysis and Design More Class Modeling; Patterns INFO 620 Glenn Booker.
BTS430 Systems Analysis and Design using UML Design 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.
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.
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
Object-Oriented Design Part 2
Next Gen POS Example GRASP again. Same Patterns Different Example!
GRASP: Designing Objects with Responsibilities
What to remember from Chap 13 (Logical architecture)
Object-Oriented Analysis and Design Mar 9, 2008.
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.
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
Chapter 17 Designing with Responsibilities. Fig
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.
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.
OO Methodology Elaboration Phase Iteration 1- Part 2.
TK2023 Object-Oriented Software Engineering
Object Design Examples with GRASP
TK2023 Object-Oriented Software Engineering
TK2023 Object-Oriented Software Engineering
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
GRASP Design Patterns: Designing Objects with Responsibilities
Next Gen POS Example GRASP again.
Object Oriented System Design Responsibilities
Presentation transcript:

17. GRASP—Designing Objects with Responsibilities III CSE5324 Lecture Quiz 17 due at 5 PM Thursday, 8 October 2015

17.10 Creator Pattern Purpose Dynamic creation of objects based upon easily interchangeable algorithms. Use When B “contains” or compositely aggregates A, records A or closely uses A. B has the initializing data for A that will be passed to A when it is created. Thus B is an Expert with respect to creating A. Example In the NextGen POS, we must choose a creator for the :SalesLineItem instance. Sale aggregates the SalesLineItem attribute (Figure 17.12), and the interaction diagram (Figure 17.13) clearly implicates :Sale as its creator. CREATOR Object Creational :Director :Creature :Creator makeItem(quantity) create(quantity)

17.11 (Information) Expert Pattern Purpose Encapsulate a responsibility in a class having the information needed to fulfill it. Use When Intuitively assigning responsibilities to classes. A class has (most of) the expertise needed to complete a task. That class is associated with others can provide any missing information. Example In the NextGen POS, some class needs to know the grand total of a sale. If the initial Design Model has no relevant classes, look in the Domain Model (Figure 17.14), expanding it if necessary. Encouraged by Sale’s associations with all SalesLineItem instances, their quantities and prices, we easily add a getTotal() method to the Design Model’s interaction and class diagrams (Figures ). EXPERTObject Behavioral :Expert :Descriptio n :Item st = getSubtotal() p = getPrice() t = getTotal()

17.12 Low Coupling Principle Purpose Choose the design alternative that minimizes connections among elements. Use When A class has an attribute that is declared in another (unstable) class. A class calls on another (unstable) class’ methods. A class is a direct or indirect subclass of another (unstable) class. Example In the NextGen POS, either :Register (Figure 17.18) or :Sale (Figure 17.19) can create :Payment. Sale must eventually be coupled to the knowledge of Payment, while Register knows relatively little and only during the keyboard entry process. The second alternative is preferred for its reduced coupling. LOW COUPLING Class and Object Stuctural :Agent :Creature :Creator initialize() create()

17.13 (Façade) Controller Pattern Purpose Choose the first object(s) beyond the UI layer (e.g., :Robot) to control all access to it. Each controller delegates all work to downstream Domain Layer applications. Use When A class represents the overall “system” or its “root object.” A class represents a use case scenario containing a single system event; e.g., handler, coordinator, session. (The UI Layer does not handle system events.) Marketing expresses a strong desire for reuse and pluggable interfaces. Example The NextGen POS application contains several system operations; e.g., enterItem(), makeNewSale(), endSale(), makePayment(). Instead of gathering these into a :System class (Figure 17.20), assign a :ProcessSaleHandler class that responsibility (Figure 17.23). CONTROLLERObject Structural :GUI :Controller :JFrame system(event) sysOprn(ID) button() UI Layer Domain Layer delegate()

17.14 High Cohesion Principle Purpose Choose the design alternative that keeps objects focused, understandable and manageable. Use When A class has too many or unrelated responsibilities. Design clarity and comprehension is critical. Example In the NextGen POS, either :Register (Figure 17.26) or :Sale (Figure 17.27) can create :Payment. If :Register also takes the responsibilities of 50 other system operations, it would become a “bloated” incohesive object. The second alternative, in which :Register passively delegates the makePayment() responsibility to :Sale, is preferred for its higher cohesion. HIGH COHESION Class and Object Stuctural :Delegator :Creature :Creator SysOprn() create() SysOprn()

R U O K ? Match each of the following design principles with its purpose below. 1.Creator. __ 2.Expert. __ 3.Low coupling. __ 4.Controller. __ 5.High cohesion. __ a.Choose the design alternative that keeps objects focused, understandable and manageable. b.Encapsulate a responsibility in a class having the information needed to fulfill it. c.Choose the design alternative that minimizes connections among elements. d.Choose the first object(s) beyond the UI layer to control all access to it. e.Dynamic creation of objects based upon easily interchangeable algorithms.

R U O K ? Match each of the following design principles with its indications below. 6. Creator. __ 7. Expert. __ 8. Low coupling. __ 9. Controller. __ 10. High cohesion. __ a.B “contains” or compositely aggregates A, records A or closely uses A. b.A class has taken on too many or unrelated responsibilities. c.A class uses another (unstable) class’ methods or attributes. d.A class has (most of) the expertise needed to complete a task. e.A class represents a use case scenario containing a single system event.

R U O K ? Match each of the following design principles with an example of its use below. 11. Creator. __ 12. Expert. __ 13. Low coupling. __ 14. Controller. __ 15. High cohesion. __ a.Your car’s pilotage and navigation functions are split between two classes. b.Only your car’s :GPS class knows the next turn direction. c.Only the pilot only knows how to stay centered in a traffic lane. d.Your car’s :Controller starts up the GPS’ clock. e.This class handles system operations, which join its User Interface with its Domain Layers’ hardware DLLs.