Software Quality Management
|
|
- Rosalind Jennings
- 5 years ago
- Views:
Transcription
1 Marco Scotto
2 Outline Structural Patterns Adapter Composite Decorator 2
3 Design Pattern Space Purpose Creational Structural Behavioral Scope Class Factory Method Adapter Interpreter Template Method Object Abstract Factory Builder Prototype Singleton Adapter Bridge Composite Decorator Façade Proxy Chain of Responsibility Command Iterator Mediator Memento Flyweight Observer State Strategy Visitor 3
4 Adapter (1/3) Intent Convert the interface of a class into another interface clients expect. Adapter lets classes work together that could not otherwise because of incompatible interfaces Also Known As Wrapper 4
5 Adapter (2/3) Motivation Sometimes a toolkit or class library can not be used because its interface is incompatible with the interface required by an application We cannot change the library interface, since we may not have its source code Even if we did have the source code, we probably should not change the library for each domain-specific application 5
6 Adapter (3/3) Example 6
7 Structure (1/2) A class adapter uses multiple inheritance to adapt one interface to another: 7
8 Structure (2/2) An object adapter relies on object composition: 8
9 Applicability Use the Adapter pattern when: You want to use an existing class, and its interface does not match the one you need You want to create a reusable class that cooperates with unrelated classes with incompatible interfaces 9
10 Implementation Issues How much adapting should be done? Simple interface conversion that just changes operation names and order of arguments Totally different set of operations Does the adapter provide two-way transparency? A two-way adapter supports both the Target and the Adaptee interface It allows an adapted object (Adapter) to appear as an Adaptee object or a Target object 10
11 Adapter Pattern Example 1 (1/6) Round pegs and square pegs SquarePeg class: /** * The SquarePeg class. * This is the Target class. */ public class SquarePeg { public void insert(string str) { System.out.println("SquarePeg insert(): " + str); 11
12 Adapter Pattern Example 1 (2/6) RoundPeg class: /** * The RoundPeg class. * This is the Adaptee class. */ public class RoundPeg { public void insertintohole(string msg) { System.out.println( "RoundPeg insertintohole(): " + msg); 12
13 Adapter Pattern Example 1 (3/6) If a client only understands the SquarePeg interface for inserting pegs using the insert() method, how can it insert round pegs? Using a peg adapter 13
14 Adapter Pattern Example 1 (4/6) PegAdapter class: /** * The PegAdapter class. * This is the Adapter class. * It adapts a RoundPeg to a SquarePeg. * Its interface is that of a SquarePeg. */ public class PegAdapter extends SquarePeg { private RoundPeg roundpeg; public PegAdapter(RoundPeg peg) { this.roundpeg = peg; public void insert(string str) { roundpeg.insertintohole(str); 14
15 Adapter Pattern Example 1 (5/6) Typical client program: // Test program for Pegs. public class TestPegs { public static void main(string args[]) { // Create some pegs. RoundPeg roundpeg = new RoundPeg(); SquarePeg squarepeg = new SquarePeg(); // Do an insert using the square peg. squarepeg.insert("inserting square peg..."); 15
16 Adapter Pattern Example 1 (6/6) // Now we'd like to do an insert using the round peg. // But this client only understands the insert() // method of pegs, not a insertintohole() method. // The solution: create an adapter that adapts // a square peg to a round peg! PegAdapter adapter = new PegAdapter(roundPeg); adapter.insert("inserting round peg..."); Client program output: SquarePeg insert(): Inserting square peg... RoundPeg insertintohole(): Inserting round peg... 16
17 Adapter Pattern Example 2 (1/6) Notice in Example 1 that the PegAdapter adapts a RoundPeg to a SquarePeg. The interface for PegAdapter is that of a SquarePeg What if we want to have an adapter that acts as a SquarePeg or a RoundPeg? Such an adapter is called a two-way adapter One way to implement two-way adapters is to use multiple inheritance, but we cannot do this in Java But we can have our adapter class implement two different Java interfaces 17
18 Adapter Pattern Example 2 (2/6) Interfaces for round and square pegs: /** *The IRoundPeg interface. */ public interface IRoundPeg { public void insertintohole(string msg); /** *The ISquarePeg interface. */ public interface ISquarePeg { public void insert(string str); 18
19 Adapter Pattern Example 2 (3/6) New RoundPeg and SquarePeg classes. These are essentially the same as before except they now implement the appropriate interface // The RoundPeg class. public class RoundPeg implements IRoundPeg { public void insertintohole(string msg) { System.out.println( "RoundPeg insertintohole(): " + msg); // The SquarePeg class. public class SquarePeg implements ISquarePeg { public void insert(string str) { System.out.println("SquarePeg insert(): " + str); 19
20 Adapter Pattern Example 2 (4/6) And here is the new PegAdapter: /** * The PegAdapter class. * This is the two-way adapter class. */ public class PegAdapter implements ISquarePeg, IRoundPeg { private RoundPeg roundpeg; private SquarePeg squarepeg; public PegAdapter(RoundPeg peg) {this.roundpeg = peg; public PegAdapter(SquarePeg peg) {this.squarepeg = peg; public void insert(string str) {roundpeg.insertintohole(str); public void insertintohole(string msg){squarepeg.insert(msg); 20
21 Adapter Pattern Example 2 (5/6) A client that uses the two-way adapter: // Test program for Pegs. public class TestPegs { public static void main(string args[]) { // Create some pegs. RoundPeg roundpeg = new RoundPeg(); SquarePeg squarepeg = new SquarePeg(); // Do an insert using the square peg. squarepeg.insert("inserting square peg..."); // Create a two-way adapter and do an insert with it. ISquarePeg roundtosquare = new PegAdapter(roundPeg); roundtosquare.insert("inserting round peg..."); 21
22 Adapter Pattern Example 2 (6/6) // Do an insert using the round peg. roundpeg.insertintohole("inserting round peg..."); // Create a two-way adapter and do an insert with it. IRoundPeg squaretoround = new PegAdapter(squarePeg); squaretoround.insertintohole("inserting square peg..."); Client program output: SquarePeg insert(): Inserting square peg... RoundPeg insertintohole(): Inserting round peg... RoundPeg insertintohole(): Inserting round peg... SquarePeg insert(): Inserting square peg... 22
23 Adapter Pattern Example 3 (1/3) Situation A Java class library exists for creating CGI web server programs One class in the library is the CGIVariables class which stores all CGI environment variables in a hash table and allows access to them via a get(string evname) method The latest version of the web server supports servlets, which provide functionality similar to CGI programs, but are considerably more efficient. The servlet library has an HttpServletRequest class which has a getx() method for each CGI environment variable. We want to use servlets. Should we rewrite all of our existing Java CGI programs? 23
24 Adapter Pattern Example 3 (2/3) Solution: We have to do some rewriting, but let's attempt to minimize things We can design a CGIAdapter class which has the same interface (a get() method) as the original CGIVariables class, but which puts a wrapper around the HttpServletRequest class Our CGI programs must now use this CGIAdapter class rather than the original CGIVariables class, but the form of the get() method invocations need not change 24
25 Adapter Pattern Example 3 (3/3) Here's a snippet of the CGIAdapter class: public class CGIAdapter { Hashtable CGIVariables = new Hashtable(20); public CGIAdapter(HttpServletRequest CGIEnvironment) { CGIVariables.put("AUTH_TYPE", CGIEnvironment.getAuthType()); CGIVariables.put("REMOTE_USER", CGIEnvironment.getRemoteUser()); // etc. public Object get(object key) {return CGIvariables.get(key); Note that in this example, the Adapter class (CGIAdapter) itself constructs the Adaptee class (CGIVariables) 25
26 Adapter Pattern Example 4 (1/6) Situation Consider a utility class that has a copy() method which can make a copy of an vector excluding those objects that meet a certain criteria To accomplish this the method assumes that all objects in the vector implement the Copyable interface providing the iscopyable() method to determine if the object should be copied or not 26
27 Adapter Pattern Example 4 (2/6) 27
28 Adapter Pattern Example 4 (3/6) Copyable interface: public interface Copyable { public boolean iscopyable(); copy() method of the VectorUtilities class: public static Vector copy(vector vin) { Vector vout = new Vector(); Enumeration e = vin.elements(); while (e.hasmoreelements()) { Copyable c = (Copyable) e.nextelement(); if (c.iscopyable()) vout.addelemet(c); return vout; 28
29 Adapter Pattern Example 4 (4/6) But what if we have a class, say the Document class, that does not implement the Copyable interface We want to be able perform a selective copy of a vector of Document objects, but we do not want to modify the Document class at all To make things simple, let s assume that the Document class has a nice isvalid() method we can invoke to determine whether or not it should be copied 29
30 Adapter Pattern Example 4 (5/6) New class diagram: 30
31 Adapter Pattern Example 4 (6/6) DocumentAdapter class: public class DocumentAdapter implements Copyable { private Document d; public DocumentAdapter(Document d) { document = d; public boolean iscopyable() { return d.isvalid(); 31
32 Pattern Example 5 Adapter (1/4) Do you see any Adapter pattern here? public class ButtonDemo { public ButtonDemo() { Button button = new Button("Press me"); button.addactionlistener(new ActionListener() { public void actionperformed(actionevent e) { dooperation(); ); public void dooperation() { whatever 32
33 Pattern Example 5 Adapter (2/4) Button objects expect to be able to invoke the actionperformed() method on their associated ActionListener objects But the ButtonDemo class does not have this method It really wants the button to invoke its dooperation() method The anonymous inner class we instantiated acts as an adapter object, adapting ButtonDemo to ActionListener 33
34 Pattern Example 5 Adapter (3/4) Recall that there are some AWT listener interfaces that have several methods which must be implemented by an event listener For example, the WindowListener interface has seven such methods In many cases, an event listener is really only interested in one specific event, such as the Window Closing event 34
35 Pattern Example 5 Adapter (4/4) Java provides adapter classes as a convenience in this situation For example, the WindowAdapter class implements the WindowListener interface, providing do nothing implementation of all seven required methods An event listener class can extend WindowAdapter and override only those methods of interest And now we see why they are called adapter classes 35
36 Composite Pattern (1/3) Intent Compose objects into tree structures to represent part-whole hierarchies Composite lets clients treat individual objects and compositions of objects uniformly This is called recursive composition 36
37 Composite Pattern (2/3) 37
38 Composite Pattern (3/3) Example 38
39 Applicability Use the Composite pattern when You want to represent part-whole hierarchies of objects You want clients to be able to ignore the difference between compositions of objects and individual objects. Clients will treat all objects in the composite structure uniformly 39
40 Structure 40
41 Composite Pattern (1/2) A typical Composite object structure might look like this: 41
42 Composite Pattern (2/2) Consequences Benefits It makes it easy to add new kinds of components It makes clients simpler, since they do not have to know if they are dealing with a leaf or a composite component Liabilities It makes it harder to restrict the type of components of a composite 42
43 Implementation Issues (1/2) A composite object knows its contained components, that is, its children Should components maintain a reference to their parent component? Depends on application, but having these references supports the Chain of Responsibility pattern 43
44 Implementation Issues (2/2) Where should the child management methods (add(), remove(), getchild()) be declared? In the Component class: Gives transparency, since all components can be treated the same But it is not safe, since clients can try to do meaningless things to leaf components at run-time In the Composite class: Gives safety, since any attempt to perform a child operation on a leaf component will be caught at compile-time But we lose transparency, since now leaf and composite components have different interfaces 44
45 Composite Pattern (1/2) Transparent vs. Safe 45
46 Composite Pattern (2/2) Implementation Issues Should Component maintain the list of components that will be used by a composite object? That is, should this list be an instance variable of Component rather than Composite? Better to keep this part of Composite and avoid wasting the space in every leaf object Is child ordering important? Depends on application Who should delete components? Not a problem in Java. The garbage collector will come to the rescue What's the best data structure to store components? Depends on application 46
47 Composite Pattern Example 1 (1/8) Situation: A GUI system has window objects which can contain various GUI components (widgets) such as, buttons and text areas. A window can also contain widget container objects which can hold other widgets. Solution 1 What if we designed all the widgets with different interfaces for "updating" the screen? We would then have to write a Window update() method as follows: 47
48 Composite Pattern Example 1 (2/8) public class Window { Button[] buttons; Menu[] menus; TextArea[] textareas; WidgetContainer[] containers; public void update() { if (buttons!= null) for (int k = 0; k < buttons.length; k++) buttons[k].draw(); if (menus!= null) for (int k = 0; k < menus.length; k++) menus[k].refresh(); // Other widgets handled similarly. if (containers!= null) for (int k = 0; k < containers.length; k++ ) containers[k].updatewidgets();... 48
49 Composite Pattern Example 1 (3/8) It looks particularly bad It violates the Open-Closed Principle If we want to add a new kind of widget, we have to modify the update() method of Window to handle it 49
50 Composite Pattern Example 1 (4/8) Solution 2 We should always try to program to an interface, right? So, let's make all widgets support the Widget interface, either by being subclasses of a Widget class or implementing a Java Widget interface Now our update() method becomes: 50
51 Composite Pattern Example 1 (5/8) public class Window { Widget[] widgets; WidgetContainer[] containers; public void update() { if (widgets!= null) for (int k = 0; k < widgets.length; k++) widgets[k].update(); if (containers!= null) for (int k = 0; k < containers.length; k++ ) containers[k].updatewidgets(); 51
52 Composite Pattern Example 1 (6/8) It looks better but we are still distinguishing between widgets and widget containers 52
53 Composite Pattern Example 1 (7/8) Solution 3: The Composite pattern 53
54 Composite Pattern Example 1 (8/8) Now the update method looks like: public class Window { Component[] components; public void update() { if (components!= null) for (int k = 0; k < components.length; k++) components[k].update(); 54
55 Composite Pattern Example 2 - The Java AWT Composite Pattern 55
56 Composite Pattern Example 3 Situation: Many types of manufactured systems, such as computer systems and stereo systems, are composed of individual components and sub-systems that contain components For example, a computer system can have various chassis that contain components (hard-drive chassis, power-supply chassis) and busses that contain cards The entire system is composed of individual components (floppy drives, cd-rom drives), busses and chassis 56
57 Composite Pattern Example 3 Solution: Use the Composite pattern 57
58 Decorator Pattern (1/4) Intent Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality Also Known As Wrapper Motivation We want to add properties, such as borders or scrollbars to a GUI component. We can do this with inheritance (subclassing), but this limits our flexibility A better way is to use composition 58
59 Decorator Pattern (2/4) 59
60 Decorator Pattern (3/4) Motivation 60
61 Decorator Pattern (4/4) Motivation 61
62 Applicability Use Decorator: To add responsibilities to individual objects dynamically without affecting other objects When extension by subclassing is impractical Sometimes a large number of independent extensions are possible and would produce an explosion of subclasses to support every combination. Or a class definition may be hidden or otherwise unavailable for subclassing 62
63 Structure 63
64 Decorator Example 1 (1/11) Let s look at the motivation for the Decorator pattern in a little more detail Suppose we have a TextView GUI component and we want to add different kinds of borders and scrollbars to it Suppose we have three types of borders: Plain 3D Fancy And two types of scrollbars: Horizontal Vertical 64
65 Decorator Example 1 (2/11) Solution 1: Let s use inheritance first. We generate subclasses of TextView for all the required cases We need the 15 subclasses: TextView-Plain TextView-Fancy TextView-3D TextView-Horizontal TextView-Vertical TextView-Horizontal-Vertical TextView-Plain-Horizontal TextView-Plain-Vertical TextView-Plain-Horizontal-Vertical TextView-3D-Horizontal TextView-3D-Vertical TextView-3D-Horizontal-Vertical TextView-Fancy-Horizontal TextView-Fancy-Vertical TextView-Fancy-Horizontal-Vertical 65
66 Decorator Example 1 (3/11) There are several disadvantages to this technique: We already have an explosion of subclasses. What if we add another type of border? Or an entirely different property? We have to instantiate a specific subclass to get the behavior we want This choice is made statically and a client can't control how and when to decorate the component 66
67 Decorator Example 1 (4/11) Solution 2: Let s use the Strategy pattern 67
68 Decorator Example 1 (5/11) Now the TextView Class looks like this: public class TextView extends Component { private Border border; private Scrollbar sb; public TextView(Border border, Scrollbar sb) { this.border = border; this.sb = sb; public void draw() { border.draw(); sb.draw(); // Code to draw the TextView object itself. 68
69 Decorator Example 1 (6/11) Using the Strategy pattern we can add or change properties to the TextView component dynamically. For example, we could have mutators for the border and scroll bar attributes and we could change them at run-time But note that the TextView object itself had to be modified and it has knowledge of borders and scrollbars If we wanted to add another kind of property or behavior, we would have to again modify TextView 69
70 Decorator Example 1 (7/11) Solution 3: Let s turn Strategy inside out to get the Decorator pattern 70
71 Decorator Example 1 (8/11) Now the TextView class knows nothing about borders and scrollbars: public class TextView extends Component { public void draw() { // Code to draw the TextView object itself. 71
72 Decorator Example 1 (9/11) But the decorators need to know about components: public class FancyBorder extends Decorator { private Component component; public FancyBorder(Component component) { this.component = component; public void draw() { component.draw(); // Code to draw the FancyBorder object itself. 72
73 Decorator Example 1 (10/11) Now a client can add borders as follows: public class Client { public static void main(string[] args) { TextView data = new TextView(); Component borderdata = new FancyBorder(data); Component scrolleddata = new VertScrollbar(data); Component borderandscrolleddata = new HorzScrollbar(borderData); 73
74 Decorator Example 1 (11/11) Decorator Changing the skin of an object Strategy Changing the guts of an object 74
75 Decorator Example 2 (1/3) Java I/O classes use the Decorator pattern The basic I/O classes are InputStream, OutputStream, Reader and Writer. These classes have a very basic set of behaviors We would like to add additional behaviors to an existing stream to yield, for example: Buffered Stream Adds buffering for the stream Data Stream Allows I/O of primitive Java data types Pushback Stream Allows undo operation We really do not want to modify the basic I/O classes to achieve these behaviors, so we use decorator classes, which Java calls filter classes, to add the desired properties using composition 75
76 Decorator Example 2 (2/3) Some examples of the decorator (filter) classes are: BufferedInputStream DataInputStream PushbackInputStream The constructors for these classes take an InputStream object 76
77 Decorator Example 2 (3/3) Here is an example of the use of these classes: public class JavaIO { public static void main(string[] args) { // Open an InputStream. FileInputStream in = new FileInputStream("test.dat"); // Create a buffered InputStream. BufferedInputStream bin = new BufferedInputStream(in); // Create a buffered, data InputStream. DataInputStream dbin = new DataInputStream(bin); // Create an unbuffered, data InputStream. DataInputStream din = new DataInputStream(in); // Create a buffered, pushback, data InputStream. PushbackInputStream pbdbin = new PushbackInputStream(dbin); 77
The Adapter Pattern. Design Patterns In Java Bob Tarr
The Adapter Pattern Intent Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces. Also Known
More informationThe Decorator Pattern. Design Patterns In Java Bob Tarr
The Decorator Pattern Intent Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality. Also Known As Wrapper Motivation
More informationThe Composite Pattern
The Composite Pattern Intent Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly. This is called
More informationDesign Patterns. Comp2110 Software Design. Department of Computer Science Australian National University. Second Semester
Design Patterns Comp2110 Software Design Department of Computer Science Australian National University Second Semester 2005 1 Design Pattern Space Creational patterns Deal with initializing and configuring
More informationDesign Patterns IV Structural Design Patterns, 1
Structural Design Patterns, 1 COMP2110/2510 Software Design Software Design for SE September 17, 2008 Class Object Department of Computer Science The Australian National University 18.1 1 2 Class Object
More informationDesign Patterns IV. Alexei Khorev. 1 Structural Patterns. Structural Patterns. 2 Adapter Design Patterns IV. Alexei Khorev. Structural Patterns
Structural Design Patterns, 1 1 COMP2110/2510 Software Design Software Design for SE September 17, 2008 2 3 Department of Computer Science The Australian National University 4 18.1 18.2 GoF Structural
More informationDecorator Pattern. CS356 Object-Oriented Design and Programming November 7, 2014
Decorator Pattern CS356 Object-Oriented Design and Programming http://cs356.yusun.io November 7, 2014 Yu Sun, Ph.D. http://yusun.io yusun@csupomona.edu Decorator Intent Dynamically attach additional responsibilities
More information2/17/04 Doc 8 Adapter & Strategy slide # 1
2/17/04 Doc 8 Adapter & Strategy slide # 1 CS 635 Advanced Object-Oriented Design & Programming Spring Semester, 2004 Doc 8 Adapter & Strategy Contents Adapter...2 Motivating Adapter...2 Adapter...6 Consequences...10
More informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: Composite 1 Composite pattern Intent Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects
More informationCOSC 3351 Software Design. Design Patterns Structural Patterns (I)
COSC 3351 Software Design Design Patterns Structural Patterns (I) Spring 2008 Purpose Creational Structural Behavioral Scope Class Factory Method Adaptor(class) Interpreter Template Method Object Abstract
More informationSDC Design patterns GoF
SDC Design patterns GoF Design Patterns The design pattern concept can be viewed as an abstraction of imitating useful parts of other software products. The design pattern is a description of communicating
More informationThink of drawing/diagramming editors. ECE450 Software Engineering II. The problem. The Composite pattern
Think of drawing/diagramming editors ECE450 Software Engineering II Drawing/diagramming editors let users build complex diagrams out of simple components The user can group components to form larger components......which
More informationDesign Pattern: Composite
Design Pattern: Composite Intent Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly. Motivation
More informationSoftware Quality Management
2004-2005 Marco Scotto (Marco.Scotto@unibz.it) Course Outline Creational Patterns Singleton Builder 2 Design pattern space Purpose Creational Structural Behavioral Scope Class Factory Method Adapter Interpreter
More informationCSCI 253. Overview. Structural Patterns. George Blankenship 1. Object Oriented Design: Structural Patterns. George Blankenship
CSCI 253 Object Oriented Design: George Blankenship George Blankenship 1 Creational Patterns Singleton Abstract factory Factory Method Prototype t Builder Overview Composite Façade Proxy Flyweight Adapter
More informationObject-Oriented Oriented Programming
Object-Oriented Oriented Programming Composite Pattern CSIE Department, NTUT Woei-Kae Chen Catalog of Design patterns Creational patterns Abstract Factory, Builder, Factory Method, Prototype, Singleton
More informationDesign Patterns in C++
Design Patterns in C++ Structural Patterns Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa March 23, 2011 G. Lipari (Scuola Superiore Sant Anna) Structural patterns March
More informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: Decorator 1 2 3 4 Decorator Intent Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing
More informationDesign Patterns. Comp2110 Software Design. Department of Computer Science Australian National University. Second Semester
Design Patterns Comp2110 Software Design Department of Computer Science Australian National University Second Semester 2006 1 What is a Design Pattern? Current use comes from the work of the architect
More informationDesign Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011
Design Patterns Lecture 1 Manuel Mastrofini Systems Engineering and Web Services University of Rome Tor Vergata June 2011 Definition A pattern is a reusable solution to a commonly occurring problem within
More informationDesign Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.)
Design Pattern CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.) A. Design Pattern Design patterns represent the best practices used by experienced
More informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: Decorator 1 An example 2 Your first idea of implementation 3 In reality 4 Now a beverage can be mixed from different condiment to form a new beverage 5 6
More informationSoftware Eningeering. Lecture 9 Design Patterns 2
Software Eningeering Lecture 9 Design Patterns 2 Patterns covered Creational Abstract Factory, Builder, Factory Method, Prototype, Singleton Structural Adapter, Bridge, Composite, Decorator, Facade, Flyweight,
More informationAdapter Pattern Structural
Adapter Pattern Structural Intent» Convert the interface of a class into a different interface that a client expects.» Lets classes work together that otherwise could not Adapter-1 Class Adapter Motivation
More informationDesign Patterns Lecture 2
Design Patterns Lecture 2 Josef Hallberg josef.hallberg@ltu.se 1 Patterns covered Creational Abstract Factory, Builder, Factory Method, Prototype, Singleton Structural Adapter, Bridge, Composite, Decorator,
More informationThe GoF Design Patterns Reference
The GoF Design Patterns Reference Version.0 / 0.0.07 / Printed.0.07 Copyright 0-07 wsdesign. All rights reserved. The GoF Design Patterns Reference ii Table of Contents Preface... viii I. Introduction....
More informationDesign Patterns Revisited
CSC 7322 : Object Oriented Development J Paul Gibson, A207 paul.gibson@int-edu.eu http://www-public.it-sudparis.eu/~gibson/teaching/csc7322/ Design Patterns Revisited /~gibson/teaching/csc7322/l13-designpatterns-2.pdf
More informationDESIGN PATTERN - INTERVIEW QUESTIONS
DESIGN PATTERN - INTERVIEW QUESTIONS http://www.tutorialspoint.com/design_pattern/design_pattern_interview_questions.htm Copyright tutorialspoint.com Dear readers, these Design Pattern Interview Questions
More informationSoftware Design COSC 4353/6353 D R. R A J S I N G H
Software Design COSC 4353/6353 D R. R A J S I N G H Design Patterns What are design patterns? Why design patterns? Example DP Types Toolkit, Framework, and Design Pattern A toolkit is a library of reusable
More informationDesign Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1
What is a Design Pattern? Each pattern Describes a problem which occurs over and over again in our environment,and then describes the core of the problem Novelists, playwrights and other writers rarely
More informationCSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich
CSCD01 Engineering Large Software Systems Design Patterns Joe Bettridge Winter 2018 With thanks to Anya Tafliovich Design Patterns Design patterns take the problems consistently found in software, and
More informationINSTITUTE OF AERONAUTICAL ENGINEERING
INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad -500 0 COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Name : DESIGN PATTERNS Course Code : A7050 Class : IV B. Tech
More informationDesign Patterns Reid Holmes
Material and some slide content from: - Head First Design Patterns Book - GoF Design Patterns Book Design Patterns Reid Holmes GoF design patterns $ %!!!! $ "! # & Pattern vocabulary Shared vocabulary
More informationEPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns
EPL 603 TOPICS IN SOFTWARE ENGINEERING Lab 6: Design Patterns Links to Design Pattern Material 1 http://www.oodesign.com/ http://www.vincehuston.org/dp/patterns_quiz.html Types of Design Patterns 2 Creational
More informationSOFTWARE PATTERNS. Joseph Bonello
SOFTWARE PATTERNS Joseph Bonello MOTIVATION Building software using new frameworks is more complex And expensive There are many methodologies and frameworks to help developers build enterprise application
More informationCSCI Object Oriented Design: Frameworks and Design Patterns George Blankenship. Frameworks and Design George Blankenship 1
CSCI 6234 Object Oriented Design: Frameworks and Design Patterns George Blankenship Frameworks and Design George Blankenship 1 Background A class is a mechanisms for encapsulation, it embodies a certain
More informationProduced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar
Design Patterns MSc in Communications Software Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie
More informationThe Strategy Pattern Design Principle: Design Principle: Design Principle:
Strategy Pattern The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it. Design
More informationUNIT I Introduction to Design Patterns
SIDDHARTH GROUP OF INSTITUTIONS :: PUTTUR Siddharth Nagar, Narayanavanam Road 517583 QUESTION BANK (DESCRIPTIVE) Subject with Code : Design Patterns (16MC842) Year & Sem: III-MCA I-Sem Course : MCA Regulation:
More informationLast Lecture. Lecture 26: Design Patterns (part 2) State. Goals of Lecture. Design Patterns
Lecture 26: Design Patterns (part 2) Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2003 Last Lecture Design Patterns Background and Core Concepts Examples Singleton,
More informationComposite Pattern. IV.4 Structural Pattern
IV.4 Structural Pattern Motivation: Compose objects to realize new functionality Flexible structures that can be changed at run-time Problems: Fixed class for every composition is required at compile-time
More informationCreational Design Patterns
Creational Design Patterns Creational Design Patterns Structural Design Patterns Behavioral Design Patterns GoF Design Pattern Categories Purpose Creational Structural Behavioral Scope Class Factory Method
More informationGoals of Lecture. Lecture 27: OO Design Patterns. Pattern Resources. Design Patterns. Cover OO Design Patterns. Pattern Languages of Programming
Goals of Lecture Lecture 27: OO Design Patterns Cover OO Design Patterns Background Examples Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2001 April 24, 2001 Kenneth
More informationDesign Patterns Reid Holmes
Material and some slide content from: - Head First Design Patterns Book - GoF Design Patterns Book Design Patterns Reid Holmes GoF design patterns $ %!!!! $ "! # & Pattern vocabulary Shared vocabulary
More informationObject Oriented Methods with UML. Introduction to Design Patterns- Lecture 8
Object Oriented Methods with UML Introduction to Design Patterns- Lecture 8 Topics(03/05/16) Design Patterns Design Pattern In software engineering, a design pattern is a general repeatable solution to
More informationTopics in Object-Oriented Design Patterns
Software design Topics in Object-Oriented Design Patterns Material mainly from the book Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides; slides originally by Spiros Mancoridis;
More informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: Decorator 1 Decorator Intent Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending
More informationDesign Patterns גרא וייס המחלקה למדעי המחשב אוניברסיטת בן-גוריון
Design Patterns גרא וייס המחלקה למדעי המחשב אוניברסיטת בן-גוריון 2 Problem: Reusability in OO Designing OO software is hard, and designing reusable OO software is even harder: Software should be specific
More informationSoftware Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.
Software Design Patterns Jonathan I. Maletic, Ph.D. Department of Computer Science Kent State University J. Maletic 1 Background 1 Search for recurring successful designs emergent designs from practice
More informationTrusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout
1 Last update: 2 November 2004 Trusted Components Reuse, Contracts and Patterns Prof. Dr. Bertrand Meyer Dr. Karine Arnout 2 Lecture 5: Design patterns Agenda for today 3 Overview Benefits of patterns
More informationUNIT I Introduction to Design Patterns
SIDDHARTH GROUP OF INSTITUTIONS :: PUTTUR Siddharth Nagar, Narayanavanam Road 517583 QUESTION BANK (DESCRIPTIVE) Subject with Code : Design Patterns(9F00505c) Year & Sem: III-MCA I-Sem Course : MCA Regulation:
More informationLast Lecture. Lecture 17: Design Patterns (part 2) Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 4448/ Spring Semester, 2005
1 Lecture 17: Design Patterns (part 2) Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 4448/6448 - Spring Semester, 2005 2 Last Lecture Design Patterns Background and Core Concepts Examples
More informationDesign Patterns. GoF design patterns catalog
Design Patterns GoF design patterns catalog OMT notations - classes OMT notation - relationships Inheritance - triangle Aggregation - diamond Acquaintance keeps a reference solid line with arrow Creates
More informationDesign Patterns. An introduction
Design Patterns An introduction Introduction Designing object-oriented software is hard, and designing reusable object-oriented software is even harder. Your design should be specific to the problem at
More informationUsing Design Patterns in Java Application Development
Using Design Patterns in Java Application Development ExxonMobil Research & Engineering Co. Clinton, New Jersey Michael P. Redlich (908) 730-3416 michael.p.redlich@exxonmobil.com About Myself Degree B.S.
More informationIntroduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of
Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of Computer Science Technische Universität Darmstadt Dr.
More informationA Reconnaissance on Design Patterns
A Reconnaissance on Design Patterns M.Chaithanya Varma Student of computer science engineering, Sree Vidhyanikethan Engineering college, Tirupati, India ABSTRACT: In past decade, design patterns have been
More informationThe Composite Design Pattern
Dr. Michael Eichberg Software Technology Group Department of Computer Science Technische Universität Darmstadt Introduction to Software Engineering The Composite Design Pattern For details see Gamma et
More informationDesign Patterns. Dr. Rania Khairy. Software Engineering and Development Tool
Design Patterns What are Design Patterns? What are Design Patterns? Why Patterns? Canonical Cataloging Other Design Patterns Books: Freeman, Eric and Elisabeth Freeman with Kathy Sierra and Bert Bates.
More information2.1 Design Patterns and Architecture (continued)
MBSE - 2.1 Design Patterns and Architecture 1 2.1 Design Patterns and Architecture (continued) 1. Introduction 2. Model Construction 2.1 Design Patterns and Architecture 2.2 State Machines 2.3 Timed Automata
More informationTuesday, October 4. Announcements
Tuesday, October 4 Announcements www.singularsource.net Donate to my short story contest UCI Delta Sigma Pi Accepts business and ICS students See Facebook page for details Slide 2 1 Design Patterns Design
More informationCS 349 / SE 382 Design Patterns. Professor Michael Terry January 21, 2009
CS 349 / SE 382 Design Patterns Professor Michael Terry January 21, 2009 Today s Agenda More demos! Design patterns CS 349 / SE 382 / 2 Announcements Assignment 1 due Monday at 5PM! CS 349 / SE 382 / 3
More information2.1 Design Patterns and Architecture (continued)
MBSE - 2.1 Design Patterns and Architecture 1 2.1 Design Patterns and Architecture (continued) 1. Introduction 2. Model Construction 2.1 Design Patterns and Architecture 2.2 State Machines 2.3 Abstract
More informationThe Singleton Pattern. Design Patterns In Java Bob Tarr
The Singleton Pattern Intent Ensure a class only has one instance, and provide a global point of access to it Motivation Sometimes we want just a single instance of a class to exist in the system For example,
More informationThe Singleton Pattern. Design Patterns In Java Bob Tarr
The Singleton Pattern Intent Ensure a class only has one instance, and provide a global point of access to it Motivation Sometimes we want just a single instance of a class to exist in the system For example,
More informationProduced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar
Design Patterns MSc in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie
More informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: Composite 1 Composite pattern Intent Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects
More informationKeywords: Abstract Factory, Singleton, Factory Method, Prototype, Builder, Composite, Flyweight, Decorator.
Comparative Study In Utilization Of Creational And Structural Design Patterns In Solving Design Problems K.Wseem Abrar M.Tech., Student, Dept. of CSE, Amina Institute of Technology, Shamirpet, Hyderabad
More informationJava for Programmers Course (equivalent to SL 275) 36 Contact Hours
Java for Programmers Course (equivalent to SL 275) 36 Contact Hours Course Overview This course teaches programmers the skills necessary to create Java programming system applications and satisfies the
More informationObject-oriented Software Design Patterns
Object-oriented Software Design Patterns Concepts and Examples Marcelo Vinícius Cysneiros Aragão marcelovca90@inatel.br Topics What are design patterns? Benefits of using design patterns Categories and
More informationA few important patterns and their connections
A few important patterns and their connections Perdita Stevens School of Informatics University of Edinburgh Plan Singleton Factory method Facade and how they are connected. You should understand how to
More informationPlan. A few important patterns and their connections. Singleton. Singleton: class diagram. Singleton Factory method Facade
Plan A few important patterns and their connections Perdita Stevens School of Informatics University of Edinburgh Singleton Factory method Facade and how they are connected. You should understand how to
More informationCOURSE 4 DESIGN PATTERNS
COURSE 4 DESIGN PATTERNS PREVIOUS COURSE Creational Patterns Factory Method defines an interface for creating objects, but lets subclasses decide which classes to instantiate Abstract Factory provides
More informationModellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico
Modellistica Medica Maria Grazia Pia INFN Genova Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico 2002-2003 Lezione 9 OO modeling Design Patterns Structural Patterns Behavioural Patterns
More informationSoftware Engineering Prof. Rushikesh K.Joshi IIT Bombay Lecture-15 Design Patterns
Software Engineering Prof. Rushikesh K.Joshi IIT Bombay Lecture-15 Design Patterns Today we are going to talk about an important aspect of design that is reusability of design. How much our old design
More informationIntroduction to Software Engineering: Object Design I Reuse & Patterns
Introduction to Software Engineering: Object Design I Reuse & Patterns John T. Bell Department of Computer Science University of Illinois, Chicago Based on materials from Bruegge & DuToit 3e, Chapter 8,
More informationCSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich
CSCD01 Engineering Large Software Systems Design Patterns Joe Bettridge Winter 2018 With thanks to Anya Tafliovich Design Patterns Design patterns take the problems consistently found in software, and
More informationDesign Patterns. Decorator Pattern. Ekim 2017
Design Patterns Decorator Pattern ebru@hacettepe.edu.tr ebruakcapinarsezer@gmail.com http://yunus.hacettepe.edu.tr/~ebru/ @ebru176 Ekim 2017 Let s try to design Each football player has the abilities of
More informationDesign Patterns. Decorator. Oliver Haase
Design Patterns Decorator Oliver Haase 1 Motivation Your task is to program a coffee machine. The machine brews plain coffee, coffee with cream, sugar, sweetener, and cinnamon. A plain coffee costs 0,90,
More informationDesign Patterns. Vasileios Theodorou
Design Patterns Vasileios Theodorou 1 A partitioning structural design pattern Motivation - Treat individual objects and compositions of objects uniformly Application - Objects are recursively composed
More informationAn Introduction to Patterns
An Introduction to Patterns Robert B. France Colorado State University Robert B. France 1 What is a Pattern? - 1 Work on software development patterns stemmed from work on patterns from building architecture
More informationDesign Pattern and Software Architecture: IV. Design Pattern
Design Pattern and Software Architecture: IV. Design Pattern AG Softwaretechnik Raum E 3.165 Tele.. 60-3321 hg@upb.de IV. Design Pattern IV.1 Introduction IV.2 Example: WYSIWYG Editor Lexi IV.3 Creational
More informationInformation systems modelling UML and service description languages
Internet Engineering Tomasz Babczyński, Zofia Kruczkiewicz Tomasz Kubik Information systems modelling UML and service description languages Overview of design patterns for supporting information systems
More informationObject-Oriented Oriented Programming Adapter Pattern. CSIE Department, NTUT Woei-Kae Chen
Object-Oriented Oriented Programming Adapter Pattern CSIE Department, NTUT Woei-Kae Chen Adapter: Intent Convert the interface of a class into another interface clients expect. Adapter lets classes work
More informationLecture 13: Design Patterns
1 Lecture 13: Design Patterns Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2005 2 Pattern Resources Pattern Languages of Programming Technical conference on Patterns
More informationDesign of Software Systems (Ontwerp van SoftwareSystemen) Design Patterns Reference. Roel Wuyts
Design of Software Systems (Ontwerp van SoftwareSystemen) Design Patterns Reference 2015-2016 Visitor See lecture on design patterns Design of Software Systems 2 Composite See lecture on design patterns
More informationR07. IV B.Tech. II Semester Supplementary Examinations, July, 2011
www..com www..com Set No. 1 DIGITAL DESIGN THROUGH VERILOG (Common to Electronics & Communication Engineering, Bio-Medical Engineering and Electronics & Computer Engineering) 1. a) What is Verilog HDL?
More informationCOSC 3351 Software Design. Design Patterns Behavioral Patterns (I)
COSC 3351 Software Design Design Patterns Behavioral Patterns (I) Spring 2008 Purpose Creational Structural Behavioral Scope Class Factory Method Adapter(class) Interpreter Template Method Object Abstract
More informationPattern Resources. Lecture 25: Design Patterns. What are Patterns? Design Patterns. Pattern Languages of Programming. The Portland Pattern Repository
Pattern Resources Lecture 25: Design Patterns Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2003 Pattern Languages of Programming Technical conference on Patterns
More informationEINDHOVEN UNIVERSITY OF TECHNOLOGY
EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics & Computer Science Exam Programming Methods, 2IP15, Wednesday 17 April 2013, 09:00 12:00 TU/e THIS IS THE EXAMINER S COPY WITH (POSSIBLY INCOMPLETE)
More informationADAPTER. Topics. Presented By: Mallampati Bhava Chaitanya
ADAPTER Presented By: Mallampati Bhava Chaitanya Topics Intent Motivation Applicability Structure Participants & Collaborations Consequences Sample Code Known Uses Related Patterns Intent Convert the interface
More informationIdioms and Design Patterns. Martin Skogevall IDE, Mälardalen University
Idioms and Design Patterns Martin Skogevall IDE, Mälardalen University 2005-04-07 Acronyms Object Oriented Analysis and Design (OOAD) Object Oriented Programming (OOD Software Design Patterns (SDP) Gang
More informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: Composite 1 Composite pattern Intent Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects
More informationDesign Patterns. Lecture 10: OOP, autumn 2003
Design Patterns Lecture 10: OOP, autumn 2003 What are patterns? Many recurring problems are solved in similar ways This wisdom is collected into patterns design patterns - about software design Other kinds
More informationWhat are patterns? Design Patterns. Design patterns. Creational patterns. The factory pattern. Factory pattern structure. Lecture 10: OOP, autumn 2003
What are patterns? Design Patterns Lecture 10: OOP, autumn 2003 Many recurring problems are solved in similar ways This wisdom is collected into patterns design patterns - about software design Other kinds
More informationDesign Patterns. CSE870: Advanced Software Engineering (Design Patterns): Cheng
Design Patterns Acknowledgements Materials based on a number of sources D. Levine and D. Schmidt. Helm Gamma et al S. Konrad Motivation Developing software is hard Designing reusable software is more challenging
More informationProduced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar
Design Patterns MSc in Communications Software Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie
More informationDesign Patterns! Acknowledgements!
Design Patterns! Acknowledgements! Materials based on a number of sources! D. Levine and D. Schmidt!. Helm! Gamma et al! S. Konrad! (Cheng) 1 Motivation! Developing software is hard! Designing reusable
More informationLectures 24 and 25 Introduction to Architectural Styles and Design Patterns
Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns Software Engineering ITCS 3155 Fall 2008 Dr. Jamie Payton Department of Computer Science University of North Carolina at Charlotte
More informationTDDB84. Lecture 2. fredag 6 september 13
TDDB84 Lecture 2 Yes, you can bring the books to the exam Creational Factory method Structural Decorator Behavioral LE2 Creational Abstract Factory Singleton Builder Structural Composite Proxy Bridge Adapter
More information