GRASP : Designing Objects with Responsibilities

Slides:



Advertisements
Similar presentations
GRASP: Designing Objects with Responsibilities
Advertisements

Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
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:
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
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.
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.
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.
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.
BTS430 Systems Analysis and Design using UML Design Patterns.
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.
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.
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
Copyright © Craig Larman All Rights Reserved Responsibility-Driven Design with the GRASP Patterns.
Object-Oriented Design Part 2
Next Gen POS Example GRASP again. Same Patterns Different Example!
GRASP: Designing Objects with Responsibilities
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.
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.
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.
Object Design Examples with GRASP
GRASP – Designing Objects with Responsibilities
TK2023 Object-Oriented Software Engineering
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
Apply Expert, Creator, Controller, Low Coupling, High Cohesion
GRASP Design Patterns: Designing Objects with Responsibilities
GRASP (General Responsibility Assignment Software Patterns)
Next Gen POS Example GRASP again.
Object Oriented System Design Responsibilities
Presentation transcript:

GRASP : Designing Objects with Responsibilities Larman chapter 17

Object design Can be described as…… After identifying your requirements and creating a domain model, then add methods to the software classes, and define the messaging between the objects to fulfill the requirements.

Fig. 17.1

GRASP patterns General Responsibility Assignment Software Patterns A learning aid to help one understand essential object design Assigment of responsibilities occurs during creation of interaction diagrams and certainly during programming.

Responsibilities Related to the obligations of an object Types : Knowing About private encapsulated data About related objects About things it can derive or calculate Doing Doing something itself Initiating a action in other objects Controlling activities in other objects Responsibilities are implemented using methods

Patterns A named description of a problem and solution that can be applied to a new context. Patterns : attempt to codify tried-and-true knowledge and principles. facilitates communication. GRASP patterns : Information Expert Creator High Cohesion Low coupling Controller

Domain model1. iteration, fig. 17.3

Who creates the square objects, fig. 17.4

Board contains Square, fig. 17.5

Info Expert : Who should know about a Square object, given a key. fig

Low Coupling, why Board over Dog, fig. 17.7

What first object after or beyond the UI should receive the message from the UI layer? fig. 17.8

Controller, Fig. 17.9

Controller, fig. 17.10

High Cohesion, fig. 17.11

Name : Controller Solution : Problem : Assign the responsibility for receiving or handling a system event message to a class representing one of the following choices : Represent the overall system, device or subsystem (Façade controller) Represent a use case scenario within which the system events occur. Often named <UseCaseName>Handler or <UseCaseName>Session Use the same controller for all system events in the same use case scenario Problem : Who should be responsible for handling an input system event ?

Example of Controller pattern Who should be the controller for system events ? The Controller pattern suggest : A Facade controller Register POSSystem A receiver or handler of all system events of a use case scanario ProssSaleHandler ProcessSaleSession

Facade Controller

Controller, fig. 17.22

System events and Allocating system operations System Sequence Diagram

Name : Information Expert Solution : Assign a responsibility to the information expert- the class that has the information necessary to fullfill the responsibility. Problem : What is a general principle of assigning responsibilities to objects.

Fig. 17.16 Who should be responsible for knowing the grand total of a sale ?

Info Expert, fig. 17.17

Name : Creator Solution : Problem : Class B has the responsibility to create an instance of class A if : B contains or compositely aggregates A B records A objects B closely uses A objects B has the initializing data. B is a creator of A objects. Problem : Who should be responsible for creating a new instance of some class ?

Who should be responsible for creating a SalesLineItem ? fig. 17.12

Example of Creator, fig. 17.13

Name : Low Coupling Solution : Problem : Assign a responsibility so that coupling remains low. Problem : How to support low dependency, low change impact, and increased reuse ? Coupling is a measure of how strongly one element is connected to, has knowledge of, or relies on other elements.

Who should be responsible for creating a Payment instance and associate with a Sale ? Fig. 17.18 Bad Coupling

Fig. 17.19 Good Coupling

Name : High Cohesion Solution : Problem : Assign a responsibility so that cohesion remains high. Problem : How to keep complexity manageable ? Cohesion is a measure of how strongly related and focused the responsibilities of an element are.

Example of High Cohesion Who should be responsible for creating a Payment instance and associate it with a Sale ? Ex.1 High Cohesion pattern suggest ex. 2 Ex.2 Creator pattern suggest ex. 1