Jan 29, 200391.3913 Ron McFadyen1 UML Class Diagram Examples Based on well-known patterns Exhibit ways of providing dynamic structures and behaviour.

Slides:



Advertisements
Similar presentations
Object-Oriented Software Engineering Visual OO Analysis and Design
Advertisements

Winter 2007ACS-3913 Ron McFadyen1 Duck Example Consider the text example (up to page 6). Each type of duck is a subclass of Duck Most subclasses implement.
Winter 2007ACS-3913 Ron McFadyen1 Also known as publish/subscribe The essence of this pattern is that one or more objects (called observers or listeners)
Unified Modeling Language Philip Liew
C15: Design Patterns Gamma,Helm,Johnson,Vlissides (GOF)
Jan 15, Ron McFadyen1 Ch 9. Use-case model: drawing System Sequence Diagrams Iteration: a simple cash-only success scenario of Process Sale.
March Ron McFadyen1 Design Patterns In software engineering, a design pattern is a generally repeatable solution to a commonly-occurring problem.
Oct 22, Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – interfaces,
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.
March Ron McFadyen1 Observer P Also known as Publish-Subscribe Applied in order to implement the Model-View Separation principle (see.
Fall 2009ACS-3913 Ron McFadyen1 Decorator Pattern The Decorator pattern allows us to enclose an object inside another object. The enclosing object is called.
Fall 2009ACS-3913 Ron McFadyen1 Observer Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another object.
Spring 2010ACS-3913 Ron McFadyen1 Weather Station Page 39+ In this application, weather station devices supply data to a weather data object. As the data.
Java Swing Toolkit Graphics The key to effectively using graphics in Java is understanding: –the basic components of the graphics library –the patterns.
Creating Custom Forms. 2 Design and create a custom form You can create a custom form by modifying an existing form or creating a new form. Either way,
Sept 2004Ron McFadyen Decorator Pattern The decorator pattern allows us to enclose an object inside another object. The enclosing object is called.
Chapter 9 Problems TC 1, 2. TC 1 Solution is to create an adapter that adapts calls from the payroll system to the payroll tax subsystem. TaxCalcAdapter.
Nov Ron McFadyen1 Figure The Observer Pattern in a DCD.
Nov Ron McFadyen1 Observer P Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another.
Winter 2012ACS-3913 Ron McFadyen1 Model View Controller Originated with Smalltalk development (1979) Separates a system’s classes into View, Controller,
System Architecture Lecture 3 CSE 111 Spring /22/20151Copyright William E. Howden.
March Ron McFadyen1 Design Patterns In software engineering, a design pattern is a generally repeatable solution to a commonly-occurring problem.
Object Collaborations. Objectives: Object Interaction (cont.) You will be able to:  Use sequence diagrams to detail object interactions.
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.
Oct Ron McFadyen1 Collaborations Collaboration : an arrangement of classes, links, roles in a context to implement some behaviour. Useful for.
Nov 5, Ron McFadyen1 Observer Pattern Objects that participate in the observer pattern must either be publishers (subject) or subscribers (observers)
Winter 2007ACS-3913 Ron McFadyen1 Observer Pattern Problem: There are many objects (observers / subscribers) needing to know of the state changes, or events,
System Analysis and Design
Winter 2011ACS-3913 Ron McFadyen1 Decorator Sometimes we need a way to add responsibilities to an object dynamically and transparently. The Decorator pattern.
March Ron McFadyen1 Observer Problem: There are many objects (subscribers) needing to know of the state changes, or events, of another object.
Chapter 26 Applying Gang of Four Design Patterns 1CS6359 Fall 2012 John Cole.
XP New Perspectives on Microsoft Access 2002 Tutorial 51 Microsoft Access 2002 Tutorial 5 – Enhancing a Table’s Design, and Creating Advanced Queries and.
Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Department of Computer Science, York University Object Oriented Software Construction 16/09/ :52 PM 0 COSC3311 – Software Design Decorator Pattern.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
Java Programming: From Problem Analysis to Program Design, Second Edition1  Learn about basic GUI components.  Explore how the GUI components JFrame,
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Jan Ron McFadyen1 Decorator Sometimes we need a way to add responsibilities to an object dynamically and transparently. The Decorator pattern.
18 April 2005CSci 210 Spring Design Patterns 1 CSci 210.
Oct R McFadyen1 Facade P Problem: There are a set of classes, a subsystem, that you need to interact with for some purpose, but you don’t.
Decorator Design Pattern Rick Mercer CSC 335: Object-Oriented Programming and Design.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
2007ACS-3913 Ron McFadyen1 Class Diagram See Schaum’s UML Outline, especially chapters 4, 5, 6, 7.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
Proxy, Observer, Symbolic Links Rebecca Chernoff.
GUIs Basic Concepts. GUI GUI : Graphical User Interface Window/Frame : a window on the screen Controls/Widgets : GUI components.
1 CSE 331 Model/View Separation and Observer Pattern slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia.
Decorator Design Pattern Rick Mercer CSC 335: Object-Oriented Programming and Design.
S.Ducasse Stéphane Ducasse 1 Decorator.
More Patterns CS 124. More Basic Patterns Patterns you’ve already seen (without knowing it) Observer / Listener Wrapper Composite Decorator / Filter Patterns.
Java - hello world example public class HelloWorld { public static void main (String args[]) { System.out.println("Hello World"); }
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 6 1 Microsoft Office Access 2003 Tutorial 6 – Creating Custom Forms.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 6: Restaurant.
View  view  presents the user with a sensory (visual, audio, haptic) representation of the model state  a user interface element (the user interface.
CS 350 – Software Design The Decorator Pattern – Chapter 17 In this chapter we expand our e-commerce case study and learn how to use the Decorator Pattern.
Jan 2005Ron McFadyen Qualified Associations ProductCatalogueProductDescription A one to many association can be altered in a diagram to a one.
CHAPTER 6 OBJECT ANALYSIS.
Software Design Refinement Using Design Patterns
Creates the file on disk and opens it for writing
Design Patterns Lecture part 2.
Unified Modeling Language
Behavioral Design Patterns
Instructor: Dr. Hany H. Ammar
UML dynamic Modeling (Behavior Diagram)
Creates the file on disk and opens it for writing
Event loops 17-Jan-19.
Event loops 17-Jan-19.
Exercise 1: Let’s Communicate - Decrypt The message
Decorator Pattern The decorator pattern allows us to enclose an object inside another object. The enclosing object is called a decorator. The other object.
Presentation transcript:

Jan 29, Ron McFadyen1 UML Class Diagram Examples Based on well-known patterns Exhibit ways of providing dynamic structures and behaviour

Jan 29, Ron McFadyen2 UML Class Diagram Example 1 Example of the Decorator pattern: the intent is to attach additional responsibilities to an object dynamically We create a chain of objects that start with the decorator objects and ending with the original object In this example, SalesTicket is the original object and headers and footers are the decorators We will be able to build chains of objects with a varying number of headers, a ticket, and a varying number of footers: –Header1  Header2  Footer1  SalesTicket –Header1  Footer1  SalesTicket

Jan 29, Ron McFadyen3 UML Class Diagram Example 1 SalesTicket Component HeaderFooter TicketDecorator 1 0,1

Jan 29, Ron McFadyen4 UML Class Diagram Example 2 In this example, the original object is an input stream and the decorators are actions to be performed on the input stream We can build chains of objects with a varying number of actions to be applied in turn to an input file: –decrypt  decompress  grades file –run checksum  decrypt  unzip  payroll file –run checksum  decrypt  unzip  a string

Jan 29, Ron McFadyen5 UML Class Diagram Example 2 String Component DecryptChecksum Action 1 0,1 File Source DecompressUnzip

Jan 29, Ron McFadyen6 UML Class Diagram Example 3 In this example, the original object is a text view and the decorators add more to the appearance of the text view We can build chains of objects with a varying number of actions to be applied in turn to an input file: –border  scrollbar  text view

Jan 29, Ron McFadyen7 UML Class Diagram Example 3 Text view Component BorderDecorator Decorator 1 0,1 ScrollDecorator

Jan 29, Ron McFadyen8 UML Class Diagram Example 4 In this example, based on the Composite pattern, a diagram is considered a complex construction of lines, rectangles, text, etc. and these can be combined into pictures generating a tree structure: pic1:Picture pic2:Picturetext1:Texttext2:Textl1:Line r1:Rectangletext3:Textl2:Line

Jan 29, Ron McFadyen9 UML Class Diagram Example 4 Line Component Composite * RectangleText

Jan 29, Ron McFadyen10 UML Class Diagram Example 5 This example is based on the Proxy pattern Suppose you have a document that has a number of images and for some images you may have a proxy, something that stands for/ looks like/ act like the real thing. When the document is being formatted for display the document can send a message to the graphic asking it to display itself: a simple box if the image is still on disk; the image itself if its available doc1:Documentproxy1:Proxy proxy5:Proxy forest:Image tree:Image

Jan 29, Ron McFadyen11 UML Class Diagram Example 5 Image Graphic ImageProxy 0,11 Document 1 *

Jan 29, Ron McFadyen12 UML Class Diagram Example 6 This example is based on the Observer pattern Note the directed line – this indicates a unidirectional association where messages can only be sent in that direction. Note the dashed lines – we have interface inheritance in this case Suppose an alarm needs to notify each of its listeners when a certain event occurs. We arrange for this by having the subscribers register with the publisher, who places them on its notify list. When the event occurs the publishers sends each subscriber a message. More detail later on in course

Jan 29, Ron McFadyen13 UML Class Diagram Example 6 alarmWindow Observer Beeper Publisher 1 * alarmClock