Chandan Rupakheti Office: Moench Room F203 Phone: (812) 877-8390 These slides and others derived from Shawn Bohner, Curt.

Slides:



Advertisements
Similar presentations
GRASP: Designing Objects with Responsibilities
Advertisements

Object-Oriented Analysis and Design
CSSE 374: Object-Oriented Design Exercise Steve Chenoweth Office: Moench Room F220 Phone: (812) These slides and.
CSSE 374: Introduction to Object- Oriented Analysis and Design Q1 Steve Chenoweth Office: Moench Room F220 Phone: (812)
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:
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.
NJIT 1 GRASP: Designing Objects with Responsibilities Chapter 17 Applying UML and Patterns Craig Larman.
Object-Oriented Analysis and Design
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.
Domain Modeling Chandan R. Rupakheti and Steve Chenoweth Week 5, Day 1.
CSSE 374: More GRASP’ing and Use Case Realization Steve Chenoweth Office: Moench Room F220 Phone: (812) These.
CSSE 374: Design Class Diagrams Steve Chenoweth Office: Moench Room F220 Phone: (812) These slides and others.
CSSE 374: Domain Model Refinements and Iteration 3 Preparations Q1 These slides and others derived from Shawn Bohner, Curt Clifton, Alex Lo, and others.
GRASP Design Patterns: Designing Objects with Responsibilities
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 4 Slide 1 Slide 1 Extended Class Diagram.
CSSE 374: Interaction Diagrams Steve Chenoweth Office: Moench Room F220 Phone: (812) These slides and others derived.
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
CSSE 374: Final Perspectives on Software Architecture and Design These slides derived from Shawn Bohner, Curt Clifton, Alex Lo, and others involved in.
CSSE 374: Operations Contracts and Logical Architectures Steve Chenoweth Office: Moench Room F220 Phone: (812)
CSSE 374: GRASP’ing at the First Five Patterns Principles Steve Chenoweth Office: Moench Room F220 Phone: (812)
GRASP Principles. How to Design Objects The hard step: moving from analysis to design How to do it? –Design principles (Larman: “patterns”) – an attempt.
CSSE 374: More Object Design with Gang of Four Design Patterns Steve Chenoweth Office: Moench Room F220 Phone: (812)
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.
CSSE 374: Introduction to Gang of Four Design Patterns
Chapter 1 Object-Oriented Analysis and Design. Disclaimer Slides come from a variety of sources: –Craig Larman-developed slides; author of this classic.
Architecture GRASP Realization of use cases in interaction diagrams Design class diagram Design ( how )
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.
Object-Oriented Analysis and Design Mar 2, 2009.
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.
Copyright © Craig Larman All Rights Reserved Responsibility-Driven Design with the GRASP Patterns.
CSSE 374: More GRASP’ing for Object Responsibilities
Jan 21, Ron McFadyen1 Ch 10. Domain Model: Visualizing Concepts Domain model illustrated with a class diagram (with no operations defined)
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.
1 Software Development By Rick Mercer with help from these sources: Rational Unified Process Computing Fundamentals with C++, Rick Mercer Designing Object.
Single Responsibility Principle Steve Chenoweth Office: Moench Room F220 Phone: (812) Chandan Rupakheti Office:
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.
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
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.
GRASP: More Patterns for Assigning Responsibilities Presented By Dr. Shazzad Hosain.
Session 33 More on SOLID Steve Chenoweth Office: Moench Room F220 Phone: (812) Chandan Rupakheti Office: Moench.
General Principles in Assigning Responsibilities Responsibilities Responsibility-Driven Design CRC Cards GRASP.
CSSE 374: UML Activity Diagrams
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
CSSE 374: Domain Model Refinements and Iteration 3 Preparations
Apply Expert, Creator, Controller, Low Coupling, High Cohesion
GRASP : Designing Objects with Responsibilities
Object Oriented System Design Responsibilities
Presentation transcript:

Chandan Rupakheti Office: Moench Room F203 Phone: (812) These slides and others derived from Shawn Bohner, Curt Clifton, Alex Lo, and others involved in delivering 374. CSSE 374: Getting a Grasp on GRASP Q1 Steve Chenoweth Office: Moench Room F220 Phone: (812) Left – Whose responsibility is it? Always a tough question, and the results vary! 

In the flow of programming… It’s a lot like playing music –  Combines effortless logic  With intuition  And “it” loves for us to do it! But…  “The flow” suppresses self- consciousness  Which is the part of the brain that’s supposed to remember what you did! So, when you come back to your own code –  You need to rely on its being logical, conceptual, and coherent!  Thus – OO… and Patterns! And anyone else reading it surely needs this, too! 

Mastering Object-Oriented Design A large set of soft principles It isn’t magic. We learn it with:  Patterns (named, explained, and applied)  Examples  Practice “The critical design tool for software development is a mind well- educated in design principles.” Q2 

Today SOLID  GRASP (From Uncle Bob back to Larman) SRP specifically – The basis for the Cohesion pattern, that we’ll study today SRP more generally – basis for today’s “Responsibility Driven Design” ideas   Bob Martin – Popularized SRP Craig Larman – Your Book’s Author

Responsibility-Driven Design Responsibility Driven Design (RDD)  Pioneered by Rebecca Wirfs-Brock in early 1990s Think of objects in terms of:  What they do or What they know …the human worker metaphor! An object’s obligation or contract that it offers to other objects 

Responsibilities for an Object Doing  a Sale is responsible for creating instances of SalesLineItem Knowing  a Sale is responsible for knowing its total cost 

Knowing and Doing Responsibilities “Doing” Responsibilities  Create another object  Perform a calculation  Initiate an action in an object  Control/coordinate activities of objects “Knowing” Responsibilities  Knowing it’s own encapsulated data  Knowing about other objects  Knowing things it can derive or calculate Q3,4 

Responsibilities Come in All Sizes BIG : provide access to a relational database small: create a Sale A responsibility is not the same thing as a method 

When Do We Assign Responsibilities? While coding While modeling  UML is a low-cost modeling tool  Can assign responsibilities with minimal investment 

General Responsibility Assignment Software Patterns (GRASP) 1/2 General Responsibility Assignment Software Patterns (or Principles)  A set of patterns for assigning responsibilities to software objects What is a Pattern?  A pattern is a named and well-known problem-solution pair that can be applied in a new context 

General Responsibility Assignment Software Patterns (GRASP) 2/2 Five Covered In Chapter Creator 2. Information Expert 3. Controller 4. Low Coupling 5. High Cohesion Four Later In Chapter 25  PolymorphismPure Fabrication IndirectionProtected Variations 

Design: Floor Tiles The worst part is when sidewalk cracks are out-of- sync with your natural stride. 

Information Expert Pattern Pattern Name Information Expert Problem What is a basic principle by which to assign responsibilities to objects? Solution Assign a responsibility to the class that has the information needed to fulfill it. Names Matter! “New pattern” is an oxymoron! Q5,6 

Information Expert and Unique IDs Basic principle of RDD: Assign responsibility to the object that has the required information  “Tell the expert to do it!” Who should get a square given a unique ID?  Let the Board do it because it knows about the squares 

Creator Pattern Who should create object A? Solution (advice): Let B do it if:  B contains or aggregates A  B records A  B closely uses A  B has the initializing data for A Monopoly Board Example  When you start a game, who creates the squares for the board?  Let Board create them since it contains the squares Q7 

Monopoly Example 

Create “in Action” 

Composition 

Exercise on Creator Examples Break up into your project teams Given the following:  Domain Model for BBVS Identify Creator pattern examples (hint)  B contains or aggregates A  B records A  B closely uses A  B has the initializing data for A Q8 

Store Address Phone# Customer name address phone# Video ID Transaction date Payment /amount: Money type authorization Initiates   Records- rental-of Pays-for  Transacts  Rents-from, Buys-from  Stocks  Selects  *1 1 * * 1 * 1..* * 1 Makes- Authorizes  1 1..* Rental dueDate ReturnDate ReturnTime VideoDescription title subjectCategory VideoSupplier address name newVideos Basket Shelf location stock Membership ID startDate PricingPolicy perDayRentalCharge perDayLateCharge 1 Obtains  1 1  Maintains 1 * Determines- rental-charge  1 *  Contains 1 * * 1  Stores- video-on  Defines 1 *  Provides 1 * * Describes  Contains  1 0..*  Provides 1 0..* 1 1  Holds- videos-in 1 

GRASP Fits in with the Goals of Software Design In many areas of engineering: In software: Gather Requirements Design for Production Build & Sell It / Them Decide What to Do Next Gather Requirements Design & Deliver Rel 1 Design & Deliver Rel 10 Decide What to Do Next … Short engineering cycle. Maintenance is most of the engineering cycle. So, we need to keep coming back to the design. 

GRASP Fits in with Systems Engineering Principles Like top-down design that minimizes interface complexity: And having an understandable “design” to build the pieces into. 