Oct 200391.3913 Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.

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 Design Examples with GRASP
February R. McFadyen1 Polymorphism Indirection Pure Fabrication Protected Variations (Law of Demeter) More GRASP Patterns.
Jan 15, Ron McFadyen1 Ch 9. Use-case model: drawing System Sequence Diagrams Iteration: a simple cash-only success scenario of Process Sale.
Jan 23, Ron McFadyen1 SSD for a samplePOS Use Case Figure 13.1 Input Events invoke a system operation of the same name same idea as in object-oriented.
Oct 22, Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – interfaces,
March Ron McFadyen1 Ch 17: Use Case Realizations with GRASP Patterns Assigning responsibilities to objects to achieve user goals Section 17.4.
Feb R. McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m Function:
Jan Ron McFadyen1 Consider a simple cash-only Process Sale scenario 1. Customer arrives at a POS checkout with goods and/or services to purchase.
Fall 2009AXS-3913 Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
Sept Ron McFadyen Interaction Diagrams - Chapter 15 Describe/illustrate sequence of message exchanges among objects that are working together.
Oct Ron McFadyen1 Ch 17: Use Case Realizations with GRASP Patterns P. 248: “The assignment of responsibilities and design of collaborations.
Fall 2009ACS-3913 Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – interfaces,
March R. McFadyen1 Principle of Least Knowledge – page 265 Principle: talk only to your immediate friends Also called Law of Demeter (LoD)
Oct 21, R. McFadyen1 Pure Fabrication P Problem: You have a responsibility to assign to a class, but assigning it to a class in the conceptual.
Fall 2009ACS Ron McFadyen1 The context maintains an instance of a concrete state subclass State Pattern Each subclass (concrete state) implements.
February Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Pronunciation: -"fi-z&m.
ACS-3913Fall 2009 Ron McFadyen1 Contracts Used to help understand requirements more completely (and so may not always be necessary) based on assertions;
Oct Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
Feb 4, Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – (interfaces,
Feb Ron McFadyen1 Use Case Realizations with GRASP Patterns “The assignment of responsibilities and design of collaborations are very important.
November Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – interfaces,
Fall 2009ACS-3913 R. McFadyen1 Protected Variations Principle: How do you design so that variations in the future do not have an undesirable affect on.
Object-Oriented Analysis and Design
November Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
March R. McFadyen1 Pure Fabrication P Problem: You have a responsibility to assign to a class, but assigning it to a class in the conceptual.
Sept Ron McFadyen1 Extend Relationship.
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.
Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative Development Part III Elaboration Iteration I – Basic1.
Chapter 2.1 Iterative, Evolutionary, and Agile. Introduction We will look at Agile Modeling, UML, and iterative and evolutionary development. We will.
GRASP Pattern Zhen Jiang West Chester University
Chapter 18 Object Design Examples with GRASP. Objectives Design use case realizations –A use-case realization describes how a particular use case is realized.
1 Ch 18. Object Design Examples With Grasp Objectives Design use case realizations. Apply GRASP to assign responsibilities to classes. Apply UML to illustrate.
Chapter 26 GoF Design Patterns. The Adapter Design Pattern.
GRASP: Designing Objects With Responsibilities Chapter 17 Applying UML and Patterns -Craig Larman.
Object Design Examples with GRASP (Ch. 18)
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.
Review ♦ System sequence diagram ♦ Domain model
Object-Oriented Analysis and Design 1 Mira Balaban & Arnon Sturm Object-Oriented Analysis and Design Session 4: Object-Oriented Software Construction.
Operation Contracts: Getting ready to open the “System” black box All material from Applying UML and Patterns, 3 rd Edition, Craig Larman, chapter 11.
Design Class Diagrams (DCDs)
BTS430 Systems Analysis and Design using UML Domain Model—Part 2: Associations and Attributes.
Operation Contracts. Primary way to describe system behavior is with use cases Operation contracts provide more details in terms of state changes to objects.
Fall 2009ACS-3913 Ron McFadyen1 Use Case Realizations with GRASP Patterns “The assignment of responsibilities and design of collaborations are very important.
Object-Oriented Analysis and Design Week 11, 2009.
BTS430 Systems Analysis and Design using UML Domain Model—Part 2: Associations and Attributes.
GRASP: Designing Objects With Responsibilities
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.
1 Chapter 9: Operation Contracts Chapter 13 in Applying UML and Patterns Book.
TK2023 Object-Oriented Software Engineering CHAPTER 11 CLASS DIAGRAMS.
Use-Case Model: Adding Detail with Operation Contracts.
1 Design Model Use-Case realizations with GRASP Larman chapter 17.
Oct 3, Ron McFadyen1 GRASP Patterns 1.Expert 2.Creator 3.Controller 4.Low Coupling 5.High Cohesion.
Design Model: Determining Visibility CH-18. Objectives Identify four kinds of visibility. Design to establish visibility. Illustrate kinds of visibility.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
OO Methodology Elaboration Phase Iteration 1- Part 2.
Ch 17: Use Case Realizations with GRASP Patterns
Mapping Designs to Code. It specify how to map the design into object oriented language The UML artifacts created during the design work, the interaction.
Object Design Examples with GRASP
TK2023 Object-Oriented Software Engineering
Used to help understand requirements more completely
GRASP: Visibility and Design
Chapter 10: Visibility Chapter 18 in Applying UML and Patterns Book.
Chapter 20 Applying UML and Patterns Craig Larman
Chapter 11: Class Diagram
Implementation Model: Mapping Designs to Code
Operation Contracts Ch. 11.
Design Model: Creating Design Class Diagrams
Presentation transcript:

Oct Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object sends a message to a sale object, the register must have visibility to the sale. enterItem() :Register:Sale makeLineItem() Register has to know about sale in order to send this message. The sale must be visible to the register.

Oct Ron McFadyen Consider an example from Applying UML & Patterns. Some business rules: A register has access to a product catalog A product catalog contains product descriptions A register captures a sale A sale contains sales line items A sale is paid by a payment A product description describes a sales line item

Oct Ron McFadyen ProductDescription Register endSale() enterItem() makeNewSale() makePayment() Payment amount description price quantity ProductCatalog Sale SalesLineItem date makeLineItem() makePayment() getTotal() paid by contains captures contains has access to describes

Oct Ron McFadyen Visibility Visibility from A to B can occur in four ways: Attribute B is an attribute of A (most common) Parameter B is a parameter of a method of A Local B is a non-parameter local object in a method of A Global B is globally visible

Oct Ron McFadyen Suppose Register has a method enterItem(). Suppose further that enterItem() in Register has an attribute that will hold a product description. When the method ends, the attribute value is lost. Visibility is temporary – while the method executes. The visibility is local to the method. public class Register private ProductCatalog catalog; private Sale currentSale; … public void enterItem (ItemID id, int quantity) { ProductDescription desc = catalog.getProdDesc(id); currentSale.makeLineItem (desc, quantity); } Note there is attribute visibility to ProductCatalog and Sale.

Oct Ron McFadyen Suppose Register sends the product description as a parameter to Sale and sale sends that to SalesLineItem. Sale has parameter visibility to ProductDescription. public class Sale private List lineItems = … ; private Date date; Private Payment payment; … public void makeLineItem (ProductDescription desc, int quantity) { lineItems.add (new SalesLineItem(desc, quantity)); } Note there is attribute visibility to SalesLineItem and Payment.

Oct Ron McFadyen If the visibility is non-attribute visibility, we show the relationship as a dependency using a dashed line ProductDescription Register Sale SalesLineItem endSale() enterItem() makeNewSale() makePayment() date makeLineItem() makePayment() getTotal() Payment amount paid by contains captures description price quantity Attribute visibility Non-attribute visibility ProductCatalog contains has access to describes