Fall 2009ACS-3913 R. McFadyen1 Polymorphism Indirection Pure Fabrication Protected Variations (Law of Demeter) More GRASP Patterns.

Slides:



Advertisements
Similar presentations
Object-Oriented Analysis and Design CHAPTER 17, 25: GRASP PATTERNS 1.
Advertisements

February R. McFadyen1 Polymorphism Indirection Pure Fabrication Protected Variations (Law of Demeter) More GRASP Patterns.
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
GRASP The other four What are the first five? What is the goal/purpose of using patterns?
Fall 2009ACS-3913 Ron McFadyen Composite Pattern Problem: How do we treat a composition structure of objects the same way as a non-composite object? Arises.
October R. McFadyen1 Polymorphism Indirection Pure Fabrication Protected Variations (Law of Demeter) Ch 22: More GRASP Patterns.
Nov R McFadyen1 Design Patterns (GoF) contains the creational patterns: Abstract factory Builder Factory method (section 23.3 has a Simple.
Fall 2009ACS-3913 R McFadyen1 Design Patterns (GoF) contains the creational patterns: Abstract factory Builder Factory method (Simple Factory) Prototype.
Object-Oriented Software Engineering Practical Software Development using UML and Java Design Patterns – Part 2 Sources: Chapter 6: Using Design Patterns,
Chapter 25 GRASP: More Objects with Responsibilities 1CS6359 Fall 2011 John Cole.
March R McFadyen1 Design Patterns (GoF) contains the creational patterns: Abstract factory Builder Factory method (in Larman) Prototype Singleton.
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
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.
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.
Fall 2009ACS-3913 R McFadyen1 GoF Patterns, chapter 26 GoF book presents 23 patterns: Creational – 5 Structural – 7 Behavioural – 11 Larman discusses 7.
Criteria for good design. aim to appreciate the proper and improper uses of inheritance and appreciate the concepts of coupling and cohesion.
Chapter 25 More Design Patterns. Polymorphism Issue: Conditional variation –If-then-else or switch statements –New variation or case: Conditional statements.
March R McFadyen1 GoF (Gang of Four): Gamma, Johnson, Helm & Vlissides Book: Design Patterns: Elements of Reusable Object-Oriented Software.
Fall 2009ACS-3913 R McFadyen1 Singleton Problem: Exactly one instance of a certain object is required (this object is called a singleton). We must ensure.
Criteria for good design. aim to appreciate the proper and improper uses of inheritance and appreciate the concepts of coupling and cohesion.
Winter 2011ACS Ron McFadyen1 Façade A façade simplifies access to a related set of objects by providing one object that all objects outside the.
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.
March 6, R. McFadyen1 Pure Fabrication P Problem: You have a responsibility to assign to a class, but assigning it to a class in the.
Fall 2009ACS-3913 Ron McFadyen1 From the Merriam-Webster’s online dictionary ( Main Entry: an·thro·po·mor·phism Date: 1753 an interpretation.
Chapter 26 Applying Gang of Four Design Patterns 1CS6359 Fall 2012 John Cole.
3/15/05H-1 © 2001 T. Horton CS 494 Object-Oriented Analysis & Design Evaluating Class Diagrams Topics include: Cohesion, Coupling Law of Demeter (handout)
Chapter 25 More Design Patterns.
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 17. GRASP General Responsibility Assignment Software Patterns (Principles) OOD: after identifying requirements, create domain model, define responsiblities.
CSSE 374: Introduction to Gang of Four Design Patterns
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
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
Chapter 17. Initial Object Design Inputs: requirements meetings various Use Cases – 10% complete Key risks addressed with preliminary programming System.
GoF Design Patterns (Ch. 26). GoF Design Patterns Adapter Factory Singleton Strategy Composite Façade Observer (Publish-Subscribe)
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Copyright © Craig Larman All Rights Reserved Responsibility-Driven Design with the GRASP Patterns.
CSSE 374: More GRASP’ing for Object Responsibilities
IntellAgile Copyright © 2002 Craig Larman. All rights reserved. Object Design and Use- Case Realizations with GRASP Patterns.
OO Methodology Elaboration Iteration 2 - Design Patterns -
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Gang of Four Patterns 23 total 15 useful How are they different from GRASP Patterns?
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
Chapter 17 Designing with Responsibilities. Fig
GRASP: More Patterns for Assigning Responsibilities Presented By Dr. Shazzad Hosain.
Object-Oriented Analysis and Design Week 12, 2009.
3/1/01H-1 © 2001 T. Horton CS 494 Object-Oriented Analysis & Design Evaluating Class Diagrams Topics include: Cohesion, Coupling Law of Demeter (handout)
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,
BTS530: Major Project Planning and Design
Chapter 10 Design Patterns.
Presentation on GoF Design Patterns Submitted by WWW. ASSIGNMENTPOINT
GoF Patterns (GoF) popo.
Conception OBJET GRASP Patterns
Design Patterns (GoF) contains the creational patterns:
Types of Programming Languages
Apply Expert, Creator, Controller, Low Coupling, High Cohesion
GoF Design Patterns (Ch. 26). GoF Design Patterns Adapter Factory Singleton Strategy Composite Façade Observer (Publish-Subscribe)
GoF Design Patterns (Ch. 26)
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
Chapter 25 GRASP The other four.
GoF Design Patterns (Ch. 26)
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Chapter 25 GRASP The other four.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
defines a higher-level interface that makes a subsystem easier to use
GoF Patterns Ch. 26.
Presentation transcript:

Fall 2009ACS-3913 R. McFadyen1 Polymorphism Indirection Pure Fabrication Protected Variations (Law of Demeter) More GRASP Patterns

Fall 2009ACS-3913 R. McFadyen2 Problem: How should we handle alternatives that are based on the class an object belongs to? We want to avoid the use of conditional If-then-Else logic Polymorphism Solution: Use polymorphic operations Methods in different classes are given the same name Different classes may be said to implement the same interface Subclasses in an inheritance hierarchy override method implementation of a superclass

Fall 2009ACS-3913 R. McFadyen3 Multiple tax calculators must be supported. Each tax calculator has its behaviour – behaviour varies by type of calculator Polymorphism > ITaxCalculatorAdapter getTaxes(Sale) : list of TaxLineItems TaxMasterAdapter getTaxes(Sale) : list of TaxLineItems GoodAsGoldTaxProAdapter getTaxes(Sale) : list of TaxLineItems The names are the same; the implementations differ

Fall 2009ACS-3913 R. McFadyen4 ITaxCalculatorAdapter is stereotyped as an interface. An interface is a set of operations – their names and parameters (signature) but no implementation. Implementation is done by the subclasses. Polymorphism > ITaxCalculatorAdapter getTaxes(Sale) : list of TaxLineItems

Fall 2009ACS-3913 R. McFadyen5 When calculator receives the message getTaxes, the method defined in the class TaxMasterAdapter is executed Polymorphism calculator:TaxMasterAdapter getTaxes(aSale) The concept of polymorphism arises in GoF patterns: Adapter, Command, Composite, etc.

Fall 2009ACS-3913 R. McFadyen6 Indirection Problem: Classes are highly coupled. How can we assign responsibilities to classes in order to keep coupling low? Solution: Assign responsibilities to an intermediate class … this provides a level of indirection Later on, we discuss GoF patterns: Adapter, Façade, and Observer. These incorporate the concept of Indirection

Fall 2009ACS-3913 R. McFadyen7 Indirection Figure 22.3: Objects send messages to the real tax calculators through an intermediary object (an adapter object) s:Sale:TaxMasterAdapter > : TaxMaster taxes := getTaxes( s ) t := getTotal()