Apply Expert, Creator, Controller, Low Coupling, High Cohesion

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-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 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:
Object-Oriented Software Engineering Practical Software Development using UML and Java Design Patterns – Part 2 Sources: Chapter 6: Using Design Patterns,
© 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 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.
CSSE 374: More GRASP’ing and Use Case Realization Steve Chenoweth Office: Moench Room F220 Phone: (812) These.
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
Systems Analysis and Design in a Changing World, Fifth Edition
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.
BTS430 Systems Analysis and Design using UML Domain Model Part 1—Finding Conceptual Classes.
12 Systems Analysis and Design in a Changing World, Fifth Edition.
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 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
Object-Oriented Analysis and Design Mar 11, 2008.
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
Copyright © Craig Larman All Rights Reserved Responsibility-Driven Design with the GRASP Patterns.
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.
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.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
TK2023 Object-Oriented Software Engineering CHAPTER 8 LOGICAL ARCHITECTURE.
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.
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,
Object Design Examples with GRASP
GRASP – Designing Objects with Responsibilities
TK2023 Object-Oriented Software Engineering
Chapter 12: Collaboration Diagram - PART2
Conception OBJET GRASP Patterns
DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS
The Object Oriented Approach to Design
GRASP : Designing Objects with Responsibilities
Use Case Realization Describes a collaboration among analysis classes that shows how a specific use case is realized Consists of flow-of-events analysis,
GRASP Design Patterns: Designing Objects with Responsibilities
GRASP (General Responsibility Assignment Software Patterns)
Object Oriented System Design Responsibilities
Presentation transcript:

Apply Expert, Creator, Controller, Low Coupling, High Cohesion Overview A critical skill is designing or thinking in objects. This can be practiced based on explainable principles. We will start applying these. You will be able to: Apply Expert, Creator, Controller, Low Coupling, High Cohesion Design for low representational gap Design for visibility Define use case realizations Relate the UP artifacts interaction diagrams designing objects design class diagrams mapping code 1

MOTIVATION: Introduction Now what happens? What object should receive this message? What objects should interact to fulfill the request, and how? interaction diagrams designing objects design class diagrams mapping code 2

DEFINITION: Responsibility-Driven Design (RDD) Detailed object design is usually done from the point of view of the metaphor of: Objects have responsibilities Objects collaborate 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? interaction diagrams designing objects design class diagrams mapping code 3

DEFINITION: Responsibilities Responsibilities are an abstraction. The responsibility for persistence. Large-grained responsibility. The responsibility for the sales tax calculation. More fine-grained responsibility. They are implemented with methods in objects. 1 method in 1 object 5 methods in 1 object 50 methods across 10 objects interaction diagrams designing objects design class diagrams mapping code 4

“Façade” “Information Expert” … They provide a vocabulary of design. DEFINITION: Patterns Patterns are named problem-solution pairs to common problems, typically showing a popular, robust solution. “Façade” “Information Expert” … They provide a vocabulary of design. interaction diagrams designing objects design class diagrams mapping code 5

DEFINITION: GRASP Principles What guiding principles to help us assign responsibilities? These principles are captured in the GRASP patterns. General Responsibility Assignment Software Patterns. Very fundamental, basic principles of object design. interaction diagrams designing objects design class diagrams mapping code 6

The 9 GRASP Principles Expert Creator Controller Low Coupling High Cohesion Polymorphism Pure Fabrication Indirection Protected Variations interaction diagrams designing objects design class diagrams mapping code 7

PATTERN: Information Expert What is most basic, general principle of responsibility assignment? 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? What information is needed to do this? What object or objects has the majority of this information. interaction diagrams designing objects design class diagrams mapping code 8

Designing for Low Representational Gap interaction diagrams designing objects design class diagrams mapping code 9

Designing for Low Representational Gap Contraindication: We do not design for low representational gap regarding actors. E.g., we don’t make a software class Clerk do all the work in the software system. Why?? interaction diagrams designing objects design class diagrams mapping code 10

Designing for Visibility Fact: To send a message to B, A must have visibility to B. It doesn’t happen by “magic.” Kinds of visibility: Attribute Parameter Local Global interaction diagrams designing objects design class diagrams mapping code 11

DEFINITION: Attribute Visibility interaction diagrams designing objects design class diagrams mapping code 12

DEFINITION: Parameter Visibility interaction diagrams designing objects design class diagrams mapping code 13

DEFINITION: Local Visibility interaction diagrams designing objects design class diagrams mapping code 14

What object creates an X? PATTERN: Creator What object creates an X? Ignores special-case patterns such as Factory. Choose an object C, such that: C contains or aggregates X C closely uses X C has the initializing data for X The more, the better. interaction diagrams designing objects design class diagrams mapping code 15

PATTERN: Controller What object in the domain (or application coordination layer) receives requests for work from the UI layer? interaction diagrams designing objects design class diagrams mapping code 16

Solution: Choose a class whose name suggests: PATTERN: Controller Solution: Choose a class whose name suggests: The overall “system,” device, or subsystem A kind of Façade class Or, represents the use case scenario or session interaction diagrams designing objects design class diagrams mapping code 17

Cohesion Coupling PATTERN: Low Coupling Assign responsibilities so that coupling remains low. What does low coupling mean? Coupling Cohesion interaction diagrams designing objects design class diagrams mapping code 18

PATTERN: High Cohesion Assign responsibilities so that cohesion remains high? What does high cohesion mean? Coupling Cohesion interaction diagrams designing objects design class diagrams mapping code 19

DEFINITION: Use Case Realizations In the vocabulary of the UP and use case modeling, when we design the objects to handle the systems operation for a scenario, we are designing a use case realization. interaction diagrams designing objects design class diagrams mapping code 20