Copyright © Craig Larman. 2000 All Rights Reserved Responsibility-Driven Design with the GRASP Patterns.

Slides:



Advertisements
Similar presentations
Object Design Examples with GRASP
Advertisements

Object-Oriented Analysis and Design CHAPTER 17, 25: GRASP PATTERNS 1.
GRASP Patterns M Taimoor Khan
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Oct 3, R. McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m Function:
Oct 2, Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m Function:
March R McFadyen1 Architecture Architecture involves the set of significant decisions about the organization of a software system, decisions.
Feb R. McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m Function:
© Lethbridge/Laganière 2001 Chapter 9: Architecting and designing software1 Layers Data from IBM-Rational and Craig Larman…
Object-Oriented Software Engineering Practical Software Development using UML and Java Design Patterns – Part 2 Sources: Chapter 6: Using Design Patterns,
Chapter 25 GRASP: More Objects with Responsibilities 1CS6359 Fall 2011 John Cole.
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
NJIT More GRASP Patterns Chapter 22 Applying UML and Patterns Craig Larman Prepared By: Krishnendu Banerjee.
Fall 2009ACS-3913 Ron McFadyen1 idea was first put forth by Christopher Alexander (1977) in his work on architectural design principles a pattern is a.
February Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m.
Object-Oriented Software Engineering Practical Software Development using UML and Java Design Patterns Sources: Chapter 6: Using Design Patterns, and Chapter.
GRASP : Designing Objects with Responsibilities
October 20, 2005Architectural Design, ECEN Architectural Design Architecture Business Cycle Design for Maintainability ECEN 5543 / CSCI 5548 SW Eng.
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.
Objectives Design Class Diagrams Issues in system design Generalization Review UML papers.
GRASP Design Patterns: Designing Objects with Responsibilities
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
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 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.
BTS430 Systems Analysis and Design using UML Domain Model Part 1—Finding Conceptual Classes.
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 )
Chapter 7: Object Design Examples with GRASP. Objective Design use case realizations. Apply GRASP to assign responsibilities to classes. Apply UML to.
Requirements To Design--Iteratively Chapter 12 Applying UML and Patterns Craig Larman.
Chapter 17. Initial Object Design Inputs: requirements meetings various Use Cases – 10% complete Key risks addressed with preliminary programming System.
GRASP: Designing Objects With Responsibilities Chapter 17 Applying UML and Patterns -Craig Larman.
GRASP: Designing Objects With Responsibilities
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
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
GRASP: Designing Objects with Responsibilities
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
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)
Object-Oriented Analysis and Design Mar 9, 2008.
Patterns Roberto Damiani Mendes. Roteiro Definition; Definition; Architecture Patterns; Architecture Patterns; Design Patterns; Design Patterns; GRASP.
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
Chapter 17 Designing with Responsibilities. Fig
References: Applying UML and patterns Craig Larman
OO Methodology Elaboration Phase Iteration 1- Part 3.
GRASP: More Patterns for Assigning Responsibilities Presented By Dr. Shazzad Hosain.
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.
Copyright © Craig Larman All Rights Reserved Large-Scale System Partitioning.
Elaboration: Iteration 2. Elaboration: Iteration 2 Basics Iteration 1 ends with : All the software has been tested: The idea in the UP is to do early,
GRASP – Designing Objects with Responsibilities
Conception OBJET GRASP Patterns
DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS
Apply Expert, Creator, Controller, Low Coupling, High Cohesion
GRASP : Designing Objects with Responsibilities
GRASP (General Responsibility Assignment Software Patterns)
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Object Oriented System Design Responsibilities
Presentation transcript:

Copyright © Craig Larman All Rights Reserved Responsibility-Driven Design with the GRASP Patterns

Copyright © Craig Larman All Rights Reserved 2 Introduction n Now what happens? n What object should receive this message? n What objects should interact to fulfill the request, and how?

Copyright © Craig Larman All Rights Reserved 3 Responsibility-Driven Design (RDD) n Detailed object design is usually done from the point of view of the metaphor of: – Objects have responsibilities – Objects collaborate – Similar to how we conceive of people n In RDD we do object design such that we will ask questions such as: – What are the responsibilities of this object? – Who does it collaborate with?

Copyright © Craig Larman All Rights Reserved 4 Responsibilities n Responsibilities are an abstraction. – The responsibility for persistence. Large-grained responsibility. – The responsibility for the sales tax calculation. More fine-grained responsibility. n They are implemented with methods in objects. – 1 method in 1 object – 5 methods in 1 object – 50 methods across 10 objects

Copyright © Craig Larman All Rights Reserved 5 Fundamental Principles of Object Design—GRASP Patterns n What guiding principles to help us assign responsibilities? n These principles are captured in the GRASP patterns. – General Responsibility Assignment Software Patterns. – Very very fundamental, simple, basic principles of object design.

Copyright © Craig Larman All Rights Reserved 6 The 9 GRASP Patterns 1.Expert 2.Creator 3.Controller 4.Low Coupling 5.High Cohesion 6.Polymorphism 7.Pure Fabrication 8.Indirection 9.Don’t Talk to Strangers Memorizing and applying these is the most important, useful objective of this seminar.

Copyright © Craig Larman All Rights Reserved 7 (Information) Expert n What is most basic, general principle of responsibility assignment? n Assign a responsibility to the object that has the information necessary to fulfill it. – “That which has the information, does the work.” – E.g., What software object calculates sales tax? 1. What information is needed to do this? 2. What object or objects has the majority of this information.

Copyright © Craig Larman All Rights Reserved 8 Creator n What object creates an X? – Ignores special-case patterns such as Factory. n Choose an object C, such that: – C contains or aggregates X – C closely uses X – C has the initializing data for X n The more, the better.

Copyright © Craig Larman All Rights Reserved 9 Controller n What object in the domain (or application coordination layer) receives requests for work from the UI layer?

Copyright © Craig Larman All Rights Reserved 10 Controller n Candidates: – An object whose name reflects the use case. e.g., RentingVideosUCHandler part of the Application Coordination layer. – An object whose name reflects the overall server, business, or large-scale entity. A kind of “façade” object. e.g., Store, RentingServer

Copyright © Craig Larman All Rights Reserved 11 Exercise Time n OK, before learning more patterns, we will practice. – We will learn the remaining patterns in this module, at a later time. n We will do some detailed object design of the domain layer – Illustrating our ideas with collaboration diagrams – and making our design decisions with the GRASP patterns. n For each message in the collaboration diagram, we will comment it with the choice of GRASP pattern. – Goal: To consciously, methodically apply these.

Copyright © Craig Larman All Rights Reserved 12 Low Coupling n Assign responsibilities so that coupling remains low. n What does low coupling mean?

Copyright © Craig Larman All Rights Reserved 13 High Cohesion n Assign responsibilities so that cohesion remains high? n What does high cohesion mean?

Copyright © Craig Larman All Rights Reserved 14 Polymorphism n How to design for varying, similar cases? n Assign a polymorphic operation to the family of classes for which the cases vary. – Don’t use case logic. n E.g., draw() – Square, Circle, Triangle

Copyright © Craig Larman All Rights Reserved 15 Pure Fabrication n Where to assign a responsibility, when the usual options based on Expert lead to problems with coupling and cohesion, or are otherwise undersirable. n Make up an “artificial” class, whose name is not necessarily inspired by the domain vocabulary. n E.g., database persistence in – Video? – DatabaseFacade? (a Pure Fabrication)

Copyright © Craig Larman All Rights Reserved 16 Indirection n A common mechanism to reduce coupling? n Assign a responsibility to an intermediate object to decouple collaboration from 2 other objects.

Copyright © Craig Larman All Rights Reserved 17 Don’t Talk to Strangers n How to design to reduce coupling to knowledge of the structural connections of objects? n Don’t traverse a network of object connections in order to invoke an operation. n Rather, promote that operation to a “familiar” of the client.