Design Patterns. Comp2110 Software Design. Department of Computer Science Australian National University. Second Semester
|
|
- Mariah Garrison
- 6 years ago
- Views:
Transcription
1 Design Patterns Comp2110 Software Design Department of Computer Science Australian National University Second Semester
2 What is a Design Pattern? Current use comes from the work of the architect Christopher Alexander Alexander studied ways to improve the process of designing building and urban areas Each pattern is a three-part rule, which expresses a relation between a certain context, a problem and a solution. Hence, the comman defintion of a pattern: A sollution to a problem in a context. Patterns can be applied to many different areas of human endeavor, including software development 2
3 What is a Design Pattern? Definition: "A pattern for software architecture describes a particular recurring design problem that arises in specific design contexts and presents a wellproven generic scheme for its solution. The solution scheme is specified by describing its constituent components, their responsibilities and relationships, and the ways in which they collaborate." [Buschmann]. 3
4 What is a Design Pattern? continued A design pattern is a way of reusing abstract knowledge about a problem and its solution A pattern is a description of the problem and the essence of its solution A pattern should be sufficiently abstract to be reused in different settings A pattern is the abstraction from a concrete form which keeps recurring in specific non-arbitrary contexts. Patterns often rely on object characteristics such as inheritance and polymorphism 4
5 What is a Design Pattern? continued design pattern is a widely accepted solution to a recurring design problem in OOP a design pattern describes how to structure classes to meet a given requirement provides a general blueprint to follow when implementing part of a program does not describe how to structure the entire application does not describe specific algorithms focuses on relationships between classes 5
6 Why Design Patterns? Designing object-oriented software is hard and designing reusable object-oriented software is even harder. -Erich Gamma Experienced designers reuse solutions that have worked in the past Well-structured object-oriented systems have recurring patterns of classes and objects Knowledge of the patterns that have worked in the past allows a designer to be more productive and the resulting designs to be more flexible and reusable 6
7 In general, patterns have the following characteristics: A pattern describes a solution to a recurring problem that arises in specific design situations. Patterns are not invented; they are distilled from practical experience. Patterns describe a group of components (e.g., classes or objects), how the components interact, and the responsibilities of each component. That is, they are higher level abstractions than classes or objects. 7
8 Patterns provide a vocabulary for communication among designers. The choice of a name for a pattern is very important. Patterns help document the architectural vision of a design. If the vision is clearly understood, it will less likely be violated when the system is modified. Patterns provide a conceptual skeleton for a solution to a design problem and, hence, encourage the construction of software with well-defined properties Patterns are building blocks for the construction of more complex designs. 8
9 Patterns help designers manage the complexity of the software. When a recurring pattern is identified, the corresponding general solution can be implemented productively to provide a reliable software system. 9
10 Descriptions of Patterns Typically a pattern will be described with a schema that includes at least the following three parts: 1. Context The Context section describes the situation in which the design problem arises. 2. Problem The Problem section describes the problem that arises repeatedly in the context. In particular, the description describes the set of forces repeatedly arising in the context. A force is some aspect of the problem that must be considered when attempting a solution. Example types of forces include: requirements the solution must satisfy (e.g., efficiency) constraints that must be considered (e.g., use of a certain algorithm or protocol) desirable properties of a solution (e.g., easy to modify) 10
11 Descriptions of Patterns continued Forces may complementary (i.e., can be achieved simultaneously) or contradictory (i.e., can only be balanced). 3. Solution The Solution section describes a proven solution to the problem. The solution specifies a configuration of elements to balance the forces associated with the problem. A pattern describes the static structure of the configuration, identifying the components and the connectors (i.e., the relationships among the components). A pattern also describes the dynamic runtime behavior of the configuration, identifying the control structure of the components and connectors. 11
12 What makes a good pattern? This is a good pattern because: It solves a problem: Patterns capture solutions, not just abstract principles or strategies. It is a proven concept: Patterns capture solutions with a track record, not theories or speculation. The solution isn't obvious: Many problem-solving techniques (such as software design paradigms or methods) try to derive solutions from first principles. The best patterns generate a solution to a problem indirectly -- a necessary approach for the most difficult problems of design. 12
13 It describes a relationship: Patterns don't just describe modules, but describe deeper system structures and mechanisms. The pattern has a significant human component (minimize human intervention): All software serves human comfort or quality of life; the best patterns explicitly appeal to aesthetics and utility. 13
14 Pattern elements Patterns have in general four parts: Pattern Name: Having a concise, meaningful name for a pattern improves communication among developers. Problem: What is the problem and context where we would use this pattern? What are the conditions tha must be met before this pattern should be used? 14
15 Solution: A description of the elements that make up the design pattern Emphasizes their relationships, reponsibilities and collaborations Not a concrete design or implementation; rather a template for a design solution that can be instantiated in different ways Consequences: The pros and cons of using the pattern Includes impacts on reusability, portability, extensibility The results and trade-offs of applying the pattern 15
16 Design Pattern Space Creational patterns Deal with initializing and configuring of classes and objects. Structural patterns Deal with decoupling interface and implementation of classes and objects. Behavioral patterns Deal with dynamic interactions among societies of classes and objects. 16
17 Types of Patterns Creational Patterns Abstract Factory Buider Factory Method Prototype Singleton Behavioral Patterns Observer Visitor Command State Iterator Mediator Chain of Responsibility Structural Patterns Adapter Façade Proxy Composite Bridge Decorator 17
18 The Composite Pattern Definition 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. 18
19 The classes and/or objects participating in the Composite pattern are: Component: declares the interface for objects in the composition. implements default behavior for the interface common to all classes, as appropriate. declares an interface for accessing and managing its child components. (optional) defines an interface for accessing a component's parent in the recursive structure, and implements it if that's appropriate. implements child-related operations in the Component interface. 19
20 Leaf represents leaf objects in the composition. A leaf has no children. defines behavior for primitive objects in the composition. Composite defines behavior for components having children. stores child components. 20
21 Client (CompositeApp) manipulates objects in the composition through the Component interface. 21
22 Composite Pattern Structure (UML Diagram) 22
23 Example: Book DocumentComponent Paragraph Composite Chapter Book Section 23
24 Typical Composite Object Structure might look like this: 24
25 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 composite structure uniformly 25
26 Consequences Benefits It makes it easy to add a new kinds of components. It makes client simpler, since they do not have to know if they are dealing with a leaf or composite component. Liabilities It makes it harder to restrict the type of components of a composite. 26
27 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 composite structure uniformly 27
28 Implementation issues A composite object knows its contained components, that is, its children. Should components maintain a reference to their parent component? Depend on application, having these references supports the chain of Responsibility pattern. 28
29 Implementation issues (Transparency versus Safety) 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 note 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 child operation on a leaf component will be caught at compile time. But we loss transparency, since now leaf and composite components have different interfaces. 29
30 Transparent vs. Safe Class room exercise: 1. Draw class diagram for designing a transparent Composite Pattern interface. 2. Draw Class digram for designing a safe Composite Pattern interface. 30
31 The decision of whether the safe or transparent approach should be implemented is left to the system designer, who will make a decision in accordance with the particular characteristics of a system. 31
32 Implementation issues continued 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 a component rather than composite. Better this part of composite and avoid wasting the space in every leaf object. Is child ordering important? Depend on application. 32
33 Who should delete components? Not a problem in Java. The garbage collector will come to the rescue. What is the best data structure to store components? Depend on application. 33
34 Example: Computer equipment Situation: Many type of manufactured systems, such as computer systems and stereo systems, are composed of individual components and subsystem 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. 34
35 Solution: Use the Composite pattern 35
36 Sample code: The whole thing class Equipment { public: virtual ~Equipment() {} const string getname(){return name; } virtual float getpower() const = 0; virtual float getprice() const = 0; virtual void add(equipment *) {} virtual void remove(equipment *) {} protected: Equipment(const string & n) : name(n) {} private: string name; }; 36
37 Sample code: a leaf class FloppyDisk : public Equipment { public: FloppyDisk(const string & n, float pow, float pr) : Equipment(n), power(pow), price(pr) {} virtual ~FloppyDisk() {} virtual float getpower() const { return power; } virtual float getprice() const { return price; } private: float power; float price; }; 37
38 Sample code: another leaf class Card : public Equipment { public: Card(const string & n, float pow, float pr) : Equipment(n), power(pow), price(pr) {} virtual ~Card() {} virtual float getpower() const { return power; } virtual float getprice() const { return price; } private: float power; float price; }; 38
39 Sample code: Sub-equipment class CompositeEquipment : public Equipment { public: virtual ~CompositeEquipment() {} virtual float getpower() const {} virtual float getprice() const { float total = 0; for(list<equipment*>::const_iterator ptr = subeq.begin(); ptr!= subeq.end(); ++ptr) { total += (*ptr)->getprice();} return total; } virtual void add(equipment * item) { subeq.push_back(item);} virtual void remove(equipment *) {} protected: CompositeEquipment(const string & name) : Equipment(name) {} private: list<equipment*> subeq; }; 39
40 Sample code: pieces of sub-equipment class Chassis : public CompositeEquipment { public: Chassis(const string & n) : CompositeEquipment(n) {} virtual ~Chassis() {} }; class Bus : public CompositeEquipment { public: Bus(const string & n) : CompositeEquipment(n) {} virtual ~Bus() {} }; class Cabinet : public CompositeEquipment { public: Cabinet(const string & n) : CompositeEquipment(n) {} virtual ~Cabinet() {} }; 40
41 Sample code: main int main() { Cabinet * cabinet = new Cabinet("PC Cabinet"); Chassis * chassis = new Chassis("PC Chassis"); cabinet->add(chassis); Bus * bus = new Bus("MCA Bus"); bus->add(new Card("Sound Blaster", 100, )); bus->add(new Card("Graphics Accelerator", 100, )); chassis->add(bus); chassis->add(new FloppyDisk("3.5in Floppy", 7, 29.99)); cout <<"The price of " << chassis->getname() << endl <<"\tis " << chassis->getprice() << endl; } cout <<"The price of " << cabinet->getname() << endl <<"\tis " << cabinet->getprice() << endl; return 0; 41
42 Class Problem: Arithmetic Expression Apply Composite Pattern to work with arithmetic expressions built out of operators +,-, *, / and constants. The expressions that we are interested in are to evaluate arithmetic expressions, and print them. For example: (1 + 2) * 4 Result: (1+2)*4 = 12 4+(3*6) Result: 4+(3*6)=22 42
43 The Visitor Pattern Intent: Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates 43
44 Structure of Visitor Pattern 44
45 The classes and/or objects participating in this pattern are: Visitor: declares a Visit operation for each class of ConcreteElement in the object structure. The operation's name and signature identifies the class that sends the Visit request to the visitor. That lets the visitor determine the concrete class of the element being visited. Then the visitor can access the elements directly through its particular interface 45
46 ConcreteVisitor: implements each operation declared by Visitor. Each operation implements a fragment of the algorithm defined for the corresponding class or object in the structure. ConcreteVisitor provides the context for the algorithm and stores its local state. This state often accumulates results during the traversal of the structure. 46
47 Element: defines an Accept operation that takes a visitor as an argument. ConcreteElement: implements an Accept operation that takes a visitor as an argument 47
48 ObjectStructure: can enumerate its elements may provide a high-level interface to allow the visitor to visit its elements may either be a Composite (pattern) or a collection such as a list or a set 48
49 Visitor Define two class hierarchies one for object structure (or elements being operated on (nodes)) one for each operation family, called visitors that define operations on the elements create new operations by adding a new subclass to Visitor class hierarchy 49
50 Applicability When to Use Visitor: When an object structure contains many classes of objects with differing interfaces, and you want to perform operations on these objects that depend on their concrete classes. When many distinct and unrelated operations need to be preformed on objects in an object structure and you want to avoid cluttering the classes with these operations. 50
51 When the classes defining the structure rarely change, but you often want to define new operations over the structure. 51
52 Consequences Visitors makes adding new operations easier If the structure involves many different classes then adding a new operation to the structure requires changing all those classes. Visitors gathers related operations, separates unrelated ones. 52
53 Adding new ConcreteElement classes is hard To add a new ConcreteElement you need to change all existing visitors. 53
54 Circularity Inherent in Visitor pattern: Visitor needs elements & elements need Visitor emanates from double dispatch In Java, it s much easier, don t have to worry about forward references, or quick compiles C++ strives for efficiency, at a cost in programmer expertise 54
55 Implementation issues A visitor must visit each element of the structure Who is responsible for traversing the structure? object structure -- most often an iterator the visitor -- problem: you will likely dupe traversal code in each concrete visitor 55
56 Class Problem: Arithmetic Expression Apply visitor pattern to work with arithmetic expressions built out of operators +,-, *, / and constants. The expressions that we are interested in are to evaluate arithmetic expressions, and print them. For example: (1 + 2) * 4 Result: (1+2)*4 = 12 4+(3*6) Result: 4+(3*6)=22 56
57 The Adapter Pattern The Adapter pattern converts the interface of a class into another interface the clients expect. Adapter lets classes work together that could not otherwise because of incompatible interfaces. 57
58 The Adapter Pattern 58
59 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 or unforeseen classes, that is classes that don t necessarily have compatible interfaces You need to use several existing subclasses, but it s impractical to adapt their interface by subclassing everyone. An object adapter can adapt the interface of its parent class 59
60 Adapter has two forms: Class Adapter: Object Adapter: 60
61 Consequenses: A Class adapter uses inheritance so Only adapts a class and all its parents, not all its subclasses Lets Adapter override some of Adaptee s behavior Does not introduce an additional pointer indirection An object adapter uses object composition so Lets a single Adapter work with many Adaptees Makes it harder to override Adaptee behavior as the Adapter may not know with Adaptee it is working with 61
62 Class Problem 1. Adapt a ArrayedStack and LinkedStack to Stack interface. An abstract class STACK has four features push, pop, top and is_empty; it has two subclasses ArrayedStack and LinkedStack. Draw or sketch the solution on blackboard, relate to the UML diagram of Adapter pattern for class discussion. 2. A Queue is just like a stack, except that additions take place at the opposite end to removals. It's a first in first out (FIFO) structure where the stack is a last in first out (LIFO) structure. In fact what the boss wants is a new top class called DISPENSER, that has STACK and QUEUE as subclasses. Draw or sketch the solution on blackboard, relate to the UML diagram of Adapter pattern and Bridge pattern for class discussion separately. 62
63 The Bridge Pattern Decouple an abstraction from its implementation so that the two can vary independently. This allows the implementation to vary from its abstraction The abstraction defines and implements the interface All operations in the abstraction call method (s) its implementation object 63
64 Bridge Pattern UML Diagram 64
65 Applicability Use the Bridge pattern when: You want to avoid a permanent binding between an abstraction and its implementation Both the abstractions and their implementations should be independently extensible by subclassing Changes in the implementation of an abstraction should have no impact on the clients; that is, their code should not have to be recompiled You want to hide the implementation of an abstraction completely from clients (users) You want to share an implementation among multiple objects (reference counting), and this fact should be hidden from the client 65
66 Other issues Binding between abstraction & implementation In the Bridge pattern: An abstraction can use different implementations An implementation can be used in different abstraction Hide implementation from clients: In the Bridge pattern the client code can not access the implementation. For example, Java AWT uses Bridge to prevent programmer from accessing platform specific implementations of interface widgets, etc. 66
67 Example: Start with Window interface and two implementations: Now what do we do if we need some more types of windows: say IconWindow and DialogWindow? 67
68 The Bridge pattern provides a cleaner solution: IconWindow and DialogWindow will add functionality to or modify existing functionality of Window Methods in IconWindow and DialogWindow need to use the implementation methods to provide the new/modified functionality This means that the WindowImp interface must provide the base functionality for window implementation This does not mean that WindowImp interface must explicitly provide an iconifywindow method 68
69 The Decorator Pattern Intent: Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality Changing the Skin of an Object 69
70 The Decorator Pattern Structure Run time structure 70
71 Applicability Use Decorator: To add responsibilities to individual objects dynamically and transparently For responsibilities that can be withdrawn When subclassing is impractical - may lead to too many subclasses Commonly used in basic system frameworks, for example, Windows, streams, fonts 71
72 Consequences More flexible than static inheritance Avoids feature laden classes high up in hierarchy Lots of little objects A decorator and its components are not identical So checking object identification can cause problems 72
73 Implementation Issues Keep Decorators lightweight Don't put data members in VisualComponent Have Decorator forward all component operations Three ways to forward messages Simple forward Extended forward Override 73
74 Example: Text Views A text view has the following features: side scroll bar Bottom scroll bar 3D border Flat border 74
75 Example continued This gives 12 different options: TextView TextViewWithNoBorder&SideScrollbar TextViewWithNoBorder&BottomScrollbar TextViewWithNoBorder&Bottom&SideScrollbar TextViewWith3DBorder TextViewWith3DBorder&SideScrollbar TextViewWith3DBorder&BottomScrollbar TextViewWith3DBorder&Bottom&SideScrollbar TextViewWithFlatBorder TextViewWithFlatBorder&SideScrollbar TextViewWithFlatBorder&BottomScrollbar TextViewWithFlatBorder&Bottom&SideScrollbar 75
76 How do you implement using Composite or Decorator patterns? Solution one - Use Object Composition 76
77 Solution 2 Use Decorator pattern Run time structure 77
78 The Prototype Pattern Intent: Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype. Prototype: Declares an interface for cloning itself ConcretePrototype: Implements an operation for cloning itself Client: Creates a new object by asking a prototype to clone itself 78
79 The Prototype pattern structure 79
80 Applicability Use the Prototype pattern when: A system should be independent of how its products are created, composed, and represented; and when the classes to instantiate are specified at run-time; or to avoid building a class hierarchy of factories that parallels the class hierarchy of products; or when instances of a class can have one of only a few different combinations of state. It may be easier to have the proper number of prototypes and clone them rather than instantiating the class manually each time 80
81 Implementation Issues Using a prototype manager Implementing the Clone operation Initializing clones 81
Design 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 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 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 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 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 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 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 8 OO modeling Design Patterns Introduction Creational Patterns Software
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 informationChapter 8, Design Patterns Visitor
Chapter 8, Design Patterns Visitor Using UML, Patterns, and Java Object-Oriented Software Engineering Pattern A Pattern Taxonomy Structural Pattern Behavioral Pattern Creational Pattern Composite Decorator
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 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 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 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 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 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 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 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 informationTHOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS
THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS LOGISTICS HW3 due today HW4 due in two weeks 2 IN CLASS EXERCISE What's a software design problem you've solved from an idea you learned from someone else?
More informationReuse at Design Level: Design Patterns
Reuse at Design Level: Design Patterns CS 617- Lecture 17 Mon. 17 March 2008 3:30-5:00 pm Rushikesh K. Joshi Department of Computer Sc. & Engg. Indian Institute of Technology, Bombay Mumbai - 400 076 Reuse
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 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 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 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 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 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 informationDesign Patterns. Hausi A. Müller University of Victoria. Software Architecture Course Spring 2000
Design Patterns Hausi A. Müller University of Victoria Software Architecture Course Spring 2000 1 Motivation Vehicle for reasoning about design or architecture at a higher level of abstraction (design
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 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 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 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 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 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 informationDesign for change. You should avoid
Design patterns Sources Cours de Pascal Molli «A System of Pattern» Bushmann et All «Design Patterns» Gamma et All (GoF) «Applying UML and Patterns» Larman "Design Patterns Java Workbook" Steven John Metsker
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 informationDesign Patterns V Structural Design Patterns, 2
Structural Design Patterns, 2 COMP2110/2510 Software Design Software Design for SE September 17, 2008 Department of Computer Science The Australian National University 19.1 1 2 Formal 3 Formal 4 Formal
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 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 informationLECTURE NOTES ON DESIGN PATTERNS MCA III YEAR, V SEMESTER (JNTUA-R09)
LECTURE NOTES ON DESIGN PATTERNS MCA III YEAR, V SEMESTER (JNTUA-R09) Mr. B KRISHNA MURTHI M.TECH, MISTE. Assistant Professor DEPARTMENT OF MASTER OF COMPUTER APPLICATIONS CHADALAWADA RAMANAMMA ENGINEERING
More informationApplying Design Patterns to accelerate development of reusable, configurable and portable UVCs. Accellera Systems Initiative 1
Applying Design Patterns to accelerate development of reusable, configurable and portable UVCs. Accellera Systems Initiative 1 About the presenter Paul Kaunds Paul Kaunds is a Verification Consultant 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 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 informationFacade and Adapter. Comp-303 : Programming Techniques Lecture 19. Alexandre Denault Computer Science McGill University Winter 2004
Facade and Adapter Comp-303 : Programming Techniques Lecture 19 Alexandre Denault Computer Science McGill University Winter 2004 March 23, 2004 Lecture 19 Comp 303 : Facade and Adapter Page 1 Last lecture...
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 informationLecture 20: Design Patterns II
Lecture 20: Design Patterns II Software System Design and Implementation ITCS/ITIS 6112/8112 001 Fall 2008 Dr. Jamie Payton Department of Computer Science University of North Carolina at Charlotte Nov.
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 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 information3 Product Management Anti-Patterns by Thomas Schranz
3 Product Management Anti-Patterns by Thomas Schranz News Read above article, it s good and short! October 30, 2014 2 / 3 News Read above article, it s good and short! Grading: Added explanation about
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. 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 informationIngegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1
Ingegneria del Software Corso di Laurea in Informatica per il Management Design Patterns part 1 Davide Rossi Dipartimento di Informatica Università di Bologna Pattern Each pattern describes a problem which
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 informationFoundations of Software Engineering Design Patterns -- Introduction
Foundations of Software Engineering Design Patterns -- Introduction Fall 2016 Department of Computer Science Ben-Gurion university Based on slides of: Nurit Gal-oz, Department of Computer Science Ben-Gurion
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 informationLaboratorio di Sistemi Software Design Patterns 2
TITLE Laboratorio di Sistemi Software Design Patterns 2 Luca Padovani (A-L) Riccardo Solmi (M-Z) 1 Indice degli argomenti Tipi di Design Patterns Creazionali, strutturali, comportamentali Design Patterns
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 informationChapter 12 (revised by JAS)
Chapter 12 (revised by JAS) Pattern-Based Design Slide Set to accompany Software Engineering: A Practitionerʼs Approach, 7/e by Roger S. Pressman Slides copyright 1996, 2001, 2005, 2009 by Roger S. Pressman
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 informationChapter 1: Object-Oriented Programming Using C++
Chapter 1: Object-Oriented Programming Using C++ Objectives Looking ahead in this chapter, we ll consider: Abstract Data Types Encapsulation Inheritance Pointers Polymorphism Data Structures and Algorithms
More informationProgrammazione. Prof. Marco Bertini
Programmazione Prof. Marco Bertini marco.bertini@unifi.it http://www.micc.unifi.it/bertini/ Design patterns Design patterns are bug reports against your programming language. - Peter Norvig What are design
More informationDesign Patterns. Gunnar Gotshalks A4-1
Design Patterns A4-1 On Design Patterns A design pattern systematically names, explains and evaluates an important and recurring design problem and its solution Good designers know not to solve every problem
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 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 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 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 informationThe Visitor Pattern. Design Patterns In Java Bob Tarr
The Visitor Pattern Intent Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it
More informationDesign Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011
Design Patterns Lecture 2 Manuel Mastrofini Systems Engineering and Web Services University of Rome Tor Vergata June 2011 Structural patterns Part 2 Decorator Intent: It attaches additional responsibilities
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 informationINTERNAL ASSESSMENT TEST III Answer Schema
INTERNAL ASSESSMENT TEST III Answer Schema Subject& Code: Object-Oriented Modeling and Design (15CS551) Sem: V ISE (A & B) Q. No. Questions Marks 1. a. Ans Explain the steps or iterations involved in object
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 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 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 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 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 informationSlide 1. Design Patterns. Prof. Mirco Tribastone, Ph.D
Slide 1 Design Patterns Prof. Mirco Tribastone, Ph.D. 22.11.2011 Introduction Slide 2 Basic Idea The same (well-established) schema can be reused as a solution to similar problems. Muster Abstraktion Anwendung
More informationSocket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.
Gang of Four Software Design Patterns with examples STRUCTURAL 1) Adapter Convert the interface of a class into another interface clients expect. It lets the classes work together that couldn't otherwise
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 informationCoordination Patterns
Coordination Patterns 1. Coordination Patterns Design Patterns and their relevance for Coordination Oscar Nierstrasz Software Composition Group Institut für Informatik (IAM) Universität Bern oscar@iam.unibe.ch
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 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 Quality Management
2004-2005 Marco Scotto (Marco.Scotto@unibz.it) Outline Structural Patterns Adapter Composite Decorator 2 Design Pattern Space Purpose Creational Structural Behavioral Scope Class Factory Method Adapter
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. OOD Lecture 6
Design patterns OOD Lecture 6 Next lecture Monday, Oct 1, at 1:15 pm, in 1311 Remember that the poster sessions are in two days Thursday, Sep 27 1:15 or 3:15 pm (check which with your TA) Room 2244 + 2245
More informationDesign Patterns. Definition of a Design Pattern
Design Patterns Barbara Russo Definition of a Design Pattern A Pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem,
More informationOODP Session 4. Web Page: Visiting Hours: Tuesday 17:00 to 19:00
OODP Session 4 Session times PT group 1 Monday 18:00 21:00 room: Malet 403 PT group 2 Thursday 18:00 21:00 room: Malet 407 FT Tuesday 13:30 17:00 room: Malet 404 Email: oded@dcs.bbk.ac.uk Web Page: http://www.dcs.bbk.ac.uk/~oded
More informationCSCI 253. Overview. The Elements of a Design Pattern. George Blankenship 1. Object Oriented Design: Iterator Pattern George Blankenship
CSCI 253 Object Oriented Design: Iterator Pattern George Blankenship George Blankenship 1 Creational Patterns Singleton Abstract factory Factory Method Prototype Builder Overview Structural Patterns Composite
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 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 informationCSE870: Advanced Software Engineering (Cheng) 1
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 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 informationDESIGN PATTERNS SURESH BABU M ASST PROFESSOR VJIT
DESIGN PATTERNS SURESH BABU M ASST PROFESSOR VJIT L1 Each pattern Describes a problem which occurs over and over again in our environment,and then describes the core of the problem Novelists, playwrights
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 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 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 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 informationAPPLYING DESIGN PATTERNS TO SCA IMPLEMENTATIONS
APPLYING DESIGN PATTERNS TO SCA IMPLEMENTATIONS Adem Zumbul (TUBITAK-UEKAE, Kocaeli, Turkey, ademz@uekae.tubitak.gov.tr); Tuna Tugcu (Bogazici University, Istanbul, Turkey, tugcu@boun.edu.tr) ABSTRACT
More informationECE 449 OOP and Computer Simulation Lecture 11 Design Patterns
ECE 449 Object-Oriented Programming and Computer Simulation, Fall 2017, Dept. of ECE, IIT 1/60 ECE 449 OOP and Computer Simulation Lecture 11 Design Patterns Professor Jia Wang Department of Electrical
More information