BTS430 Systems Analysis and Design using UML Design Patterns.

Slides:



Advertisements
Similar presentations
GRASP: Designing Objects with Responsibilities
Advertisements

GoF State Pattern Aaron Jacobs State(305) Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
Object-Oriented Analysis and Design
© Keith Vander Linden, Dilbert © United Feature Syndicate, Inc.
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:
Feb R. McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m Function:
Design Patterns CS is not simply about programming
Design Patterns Daniel McClain. Background What are they?  Way of recording solutions to recurring design problems History  “A Pattern Language: Towns,
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.
NJIT 1 GRASP: Designing Objects with Responsibilities Chapter 17 Applying UML and Patterns Craig Larman.
GRASP : Designing Objects with Responsibilities
Design Patterns and Responsibility Assignment CMPT 371 Fall 2004 J.W. Benham.
Façade Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
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
Design Patterns Trends and Case Study John Hurst June 2005.
Chapter 7 GRASP patterns Dr Seham Mostefai CAP 252.
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.
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 )
GRASP: Designing Objects With Responsibilities Chapter 17 Applying UML and Patterns -Craig Larman.
Object-Oriented Analysis and Design Mar 2, 2009.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 27. Review UML dynamic view – State Diagrams.
CS 325: Software Engineering February 12, 2015 Applying Responsibility-Assignment Patterns Design Patterns Situation-Specific Patterns Responsibility-Assignment.
GRASP: Designing Objects With Responsibilities
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.
Object-Oriented Design Part 2
D ESIGN P ATTERNS Weslei A. de T. Marinho. T ALK O UTLINE Pattern Definition GRASP Patterns GoF Patterns GoF Patterns Classification Creational Patterns.
GRASP: Designing Objects with Responsibilities
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
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.
Advanced Object-Oriented Design Patterns and Architectures Part One COEN396A John Xiao
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
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.
GRASP – Designing Objects with Responsibilities
TK2023 Object-Oriented Software Engineering
GoF Patterns (GoF) popo.
Introduction to Design Patterns
Chapter 12: Collaboration Diagram - PART2
Conception OBJET GRASP Patterns
Design Patterns Introduction
DESIGN MODEL: USE-CASE REALIZATIONS WITH GRASP PATTERNS
Apply Expert, Creator, Controller, Low Coupling, High Cohesion
GRASP : Designing Objects with Responsibilities
GRASP Design Patterns: Designing Objects with Responsibilities
GRASP (General Responsibility Assignment Software Patterns)
Introduction to Design Patterns
Presentation transcript:

BTS430 Systems Analysis and Design using UML Design Patterns

Patterns  “… a pattern is a named problem/solution pair that can be applied in new contexts, with advice on how to apply it in novel situations and discussion of its trade- offs.” * *Larman, page 218

Design Patterns  “ The best way to use patterns is to load your brain with them and then recognize places in your design and existing applications where you can apply them. Instead of code reuse, with patterns you get experience reuse.”* * Head First Design Patterns, p. xi

References for Pattern theory  The “Bible” Design Patterns, Elements of Reusable Object-Oriented Software  Erich Gamma  Richard Helm  Ralph Johnson  John Vlissides Authors known as the Gang of Four so the patterns are called the GoF patterns First book – 1995 Most complete

References for Pattern theory  Head First Design Patterns Eric Freeman and Elisabeth Freeman (“must have” for BTS530 and 630)  Applying UML and Patterns, third edition Craig Larman

Beginnings of Patterns  Started with Christopher Alexander, a Professor of Architecture at Berkeley. Invented patterns for building living architectures, e.g., houses, towns, cities Books: The Timeless Way of Building and A Pattern Language Direct analogies between creating “living architecture” and flexible, extensible software* *Head First Design Patterns, p. 602

GRASP Patterns  “ A learning aid to help you understand essential object design and apply design reasoning in a methodical, rational, explainable way ”. *  Patterns of assigning object responsibilities * Larman, p. 277

GRASP Patterns  “ GRASP is an acronym that stands for General Responsibility Assignment Software Patterns” The name was chosen to suggest the importance of grasping these principles to successfully design object-oriented software Larman, p. 222

GRASP Patterns  Do not state new ideas  Name and codify widely used basic principles* * Larman, p. 279

Responsibilities  UML defines a responsibility as “a contract or obligation of a classifier”.  A class embodies a set of responsibilities that define the behaviour of the objects in the class.

Responsibilities  “A responsibility is not the same thing as a method, but methods are implemented to fulfill responsibilities.”  “Responsibilities are implemented using methods that either act alone or collaborate with other methods and objects.” Larman, p. 217

Fig. 17.2: Responsibilities and methods are related Implies Sale objects have a responsibility To create Payments

Responsibilities revolve around  Doing  Knowing  Collaboration

“Doing” responsibilities  Doing something itself, such as creating an object or doing a calculation  Initiating action in other objects  Controlling and co-coordinating activities in other objects Larman, p. 216

“Knowing” responsibilities  Knowing about private encapsulated data  Knowing about related objects  Knowing about things that it can derive or calculate  Larman, p. 216

GRASP Patterns  Key three: Creator Controller Information Expert

Creator  Who should be responsible for creating an new instance of some class?  Some options: Assign B the responsibility to create A if one or more of the following is/are true:  B “contains” A (e.g. Invoice creates InvoiceLineItem)  B records A  B closely uses A  B has the initializing data for A that will be passed to A when it is created (thus B is the Expert with respect to creating A). (e.g. Sale creates Payment) p. 291

Creating a SalesLineItem

Controller  What first object beyond the UI layer receives and coordinates a system operation? Use Case or Session Controller  Use case/session (e.g. Register)* Larman, p. 286 and 302

Guidelines/Issues  Controller usually delegates work to other objects—it controls, coordinates, it does not do much work itself  Danger: Bloated controller a single controller receives all system events (and there are many) a controller that does the work itself a controller that has many attributes; maintains significant information  Among Cures for Bloat more controllers, use case controllers, more delegation

Information Expert  What is the general principle of assigning responsibilities to objects?  A Solution: Assign a responsibility to the class that has the information necessary to fulfill it—the “information expert” (note: start this process by clearly stating the responsibility!) Larman, p. 294

Information Expert  Example: Sale has the responsibility of knowing its total, expressed with the method named getTotal Larman, p. 222

Information Expert p. 222

Collaboration  Fulfillment of a responsibility often requires information from different classes of objects  Example, sales total requires the collaboration of 3 classes of objects: Sale, SalesLineItem, ProductDescription  Interact via messages* *Larman, p. 297

Facade  Hides all of the complexity of one or more classes in a simple interface*  Provides a simplified interface to a subsystem while still exposing the full functionality of the system to those who may need it* *Head First Design Patterns, p. 254 *Head First Design Patterns, p. 260

Database Facade