Design Pattern and Software Architecture: IV. Design Pattern

Size: px
Start display at page:

Download "Design Pattern and Software Architecture: IV. Design Pattern"

Transcription

1 Design Pattern and Software Architecture: IV. Design Pattern AG Softwaretechnik Raum E Tele hg@upb.de IV. Design Pattern IV.1 Introduction IV.2 Example: WYSIWYG Editor Lexi IV.3 Creational Pattern Singleton, Factory Method, Abstract Factory, Prototype IV.4 Structural Pattern Composite, Decorator, Bridge, Adapter IV.5 Behavioural Pattern Observer, Iterator, Strategy, Hook, Template Method, Visitor, Command, Memento IV.6 Discussion & Summary IV.7 Bibliography IV-2 1

2 IV.1 Introduction [Gamma+1994] Design Pattern: Ensure internal software qualities such as changeability at design level (not implementation!) Classification: Creational Patterns Structural Patterns Behavioural Patterns IV-3 IV.2 Example Design of a WYSIWYG Editor Lexi [Gamma+1994] Design Aspects: 1. Document structure 2. Text formatting, search for regular expressions, line breaking, spell checking 3. Global state system root, selection, zooming, User Interface 5. Different Look-And-Feels 6. Different Window systems 7. Undo/Redo, Macros,... IV-4 2

3 Coarse Grain Design Software Architecture IV-5 Internal Representation? IV-6 3

4 Tree Structure of What? IV-7 Concept of A Glyph Use basic OO: Use subtyping (not inheritance) to handle each specific glyph in a uniform manner Use shared aggregation or composition to describe composition structure IV-8 4

5 Text Formatting, Searching, Line Breaking, Spell Checking, <<creates>> <<creates>> <<creates>> <<creates>> <<creates>> IV-9 Manage Aspect using different Tools for Line Breaking, IV-10 5

6 Manage GUI Elements? IV-11 Support Multiple Window Systems IV-12 6

7 Support Undo/Redo IV-13 IV.3 Creational Pattern Motivation: abstract from instantiation process Make system independent of object creation [Gamma+1994] Basic Themes: Encapsulate knowledge about concrete classes Hide how objects are created and composed Details: What class? Who creates? How? When? Problems: Class creation spread over the code (no single point of change) Patterns: Singleton Factory Method Abstract Factory Prototype IV-14 7

8 Design Pattern Singleton Lexi system root: Exactly one root object Reachable from everywhere Support for dynamic subtyping [Gamma+1994] IV-15 Factory Method Pattern [Gamma+1994] Intent: Dynamic choice of the underlying class when creating the object Problem: Direct object creation via x = new C () creates exactly one object of fixed type C (no flexible choice supported) Solution: Encapsulate object creation in method Redefine method in subclasses Distinguish cases using parameters, options, environment Related Patterns: Often realized using the Prototype Pattern; see also Abstract Factory Pattern IV-16 8

9 Example: Document Creation IV-17 Abstract Factory Pattern Intent: Groups factory methods and structures creation of related objects Problem: How to manage the creation of families of related or dependent objects [Gamma+1994] Solution: Encapsulate their object creation within one class Redefine in subclasses as required Related Patterns: Often realized using the Factory Methods Pattern Often a concrete Factory is also a Singleton IV-18 9

10 Example: GUI Factory Abstract Factory with Factory Methods ensures type secure programs IV-19 Prototype Pattern [Gamma+1994] Intent: Reduce complex initialisation and constructor processing and instead clone an exist instance Problem: Initialisation of complex objects is often time consuming and required behaviour is not related to a new class but rather the composition of given classes (Java Swing) Related Patterns: An Abstract Factory might use a set of prototype to clone instead of create the required instances Design with the Composite and Decorator Pattern can often benefit from Prototype as well IV-20 10

11 Prototype Pattern Intent: Reduce complex initialisation and constructor processing and instead clone an exist instance Example: Extend Lexi with a Tool-Palette for a sheet of music IV-21 Example: Prototype & Cloning IV-22 11

12 " Example: Creational Patterns More flexible (GUI Factory does not know all widget types at compile-time) Abstract Factory with Prototypes required run-time type checks Often mixed forms IV-23 Dynamic Cast Pattern Problem: Type casts vs. secure static types that ensure correct usage of operation class etc. Language Solution: run-time test for casts (Exceptions) Limitation: Attempt to cast non-glyph to Composite is not detected at compile-time (only runtime error) Solution: Declare all valid casts in Glyph using to_composite Trade-off:! Superclass requires cast-op for all subclasses Somtimes multi level casts required IV-24 12

13 -. ' ( ) * + 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 otherwise Patterns: & Composite Pattern Decorator Pattern Bridge Pattern Adapter Pattern Facade Pattern Flyweight Pattern [Gamma+1994] IV-25 Composite Pattern Intent: Compose objects into a tree to represent part-whole hierarchies where the composition and its parts are treated uniformly Related Patterns, Often the Decorator Pattern is used combined with the Composite Pattern. The Iterator Pattern can be used to traverse composite structures. The Visitor pattern can be used to localize behaviour that would otherwise be distributed across the composites and leafs. IV-26 13

14 Composite Pattern Example Support a tree (DAG) of similar/uniform treated objects (Example: Lexi document structure) Advantages: / Uniform simply extendable structure 0 Implicit operation forwarding 1 Simple recursive traversing Naïve OO solution: 2 Many classes 3 Many casts IV-27 Composite Pattern Realization IV-28 14

15 : = > ; < Composite Pattern Realization Idea: 4 Common abstract superclass (Glyph) determines ALL essential properties For application this rather abstract superclass is often enough Composite forwards his operations to all children => Apply operations uniformly on (sub-)trees Implementation: 7 Explicit parent reference? => Better use association instead of simple reference Sharing components? Later => Design Pattern Flyweigth Maximizing base-class interface? Yes! - subclasses may inherit useless methods + more uniform classes prevent casts Where are the child managing operations Add and Remove declared? Composite => type safe, but contradicts "maximizing base-class interface" Component => not type safe because leafs will never contain other composites Child ordering? Often yes! Who should delete components? Composition or Shared Aggregation? Often Composition! IV-29 Implementation Variant 1 Efficient Variant:? Distinguish char from the rest Clean Keep uniform treatment IV-30 15

16 B C G Decorator Pattern Intent: Attach additional functionality to objects and not classes dynamically Alternative to subclassing! Also Known As: wrapper Related Pattern: A Adapter change interface degenerated form of Composite that adds responsibilities change skin rather than internals such as Strategy IV-31 Decorator Pattern Example Example: D Add Frames, Scroll Bars, Borders, Background, Shadows, etc. to the document root Basic OO: E Redefine method Problem: F Not flexible Add/Remove "Decorators Leads to complex case statements IV-32 16

17 I L Decorator Pattern Realization Idea: H Use explicit Decoration objects Dynamic changes possible Design Goal: J "seamless" decoration => Standard: K Forward most operations Decorate some operations and add functionality and status where required IV-33 Decorator Pattern Realization IV-34 17

18 N P R S T U Bridge Pattern Intent: Decouple abstraction and implementation of class hierarchies Also Known As: Handle/Body Motivation: M Hierarchy of classes with similar functionality Achieve platform independence using abstract superclasses and platform specific subclasses Explosion of the class hierarchy Related Patterns: O An Abstract Factory may create and configure a Bridge While a Bridge is designed up-front an Adapter might be used in already existing systems IV-35 Bridge Pattern Example Design Aspects: Q "double dispatch : the kind of window and its specific implementation determines the finally called operation Flexible separation of interface objects and implementation objects Implementation can be exchanged without recompilation => shared libraries WindowImp interface is sufficient for all specific kind of windows WindowImp subclasses often adapter for the related basic libraries IV-36 18

19 X Y Bridge Pattern Realization IV-37 Adapter Pattern Intent: Adapt extern interfaces (libraries, modules,...) to the required internal interfaces Also Known As: Wrapper Example: V Type conversions for parameters Related Pattern: W The Bridge is used to separate the interface form its implementation while the adapter is used to change the interface to an existing object Proxies are representatives for other objects, but do not change the interface Decorator keeps the interface and adjusts functionality while the Adapter adjust the interfacse and keeps the functionality IV-38 19

20 \ ] ^ Adapter Pattern Realization IV-39 Facade Pattern Intent: Provide a unified interface to a set of interfaces in a subsystem Motivation: Z Support subsystem encapsulation using a single explicit interface object Related Patterns: [ An Abstract Factory may provide an interface for creating objects in a subsystem independent way An Abstract Factory can be used as alternative by hiding subsystem specific classes A Mediator has similar functionality, but has two combined systems and does not abstract form one of them Often Facade objects are also Singletons IV-40 20

21 a e Flyweight Pattern Intent: Use object sharing to support huge numbers of fine-grained objects efficiently Motivation: _ Benefit from using objects also where their unshared usage would be prohibitively expensive Related Patterns: ` Often combined with Composite State and Strategy objects are often Flyweights IV-41 Flyweight Pattern Example Problem: Number of character objects becomes a problem when for each character font attributes etc. have to be stored composite (row) composite (column) composite (row) Intrinsic state: b Independent of context Extrinsic state: c Varies with the context Example: d Character (intrinsic) Font, location (extrinsic) composite (row) a p p a r e n t composite (column) composite (row) a p p a r e n t a e n p r t z IV-42 21

22 p f g h i j k l m n IV.5 Behavioural Pattern Motivation: Assign responsibilities between objects to realize algorithms and behaviour Problem: How to distribute behaviour between different classes Patterns: Strategy Pattern Template Method Iterator Pattern Visitor Pattern Command Pattern Memento Pattern Hook Pattern [Gamma+1994] IV-43 Strategy Pattern Intent: Encapsulation of a family of dynamically interchangeable algorithms Also Known As: Policy Problem: o Best" algorithm can often not uniquely determined due to trade-offs: Run-time <-> Memory, Run-time <-> Quality Best solution depends on problem characteristics: e.g. for sorting: data structure, stability, problem size,... Related Pattern: q Strategy objects often make good flyweights [Gamma+1994] IV-44 22

23 s t u v w x Strategy Pattern Example Formatter: r quick&dirty slow&fine (TeX) IV-45 Strategy Pattern Realization Idea: explicit algorithm object Abstract algorithm superclass "Delegation" dynamically assign what algorithm should be used IV-46 23

24 z } ± ² ³ µ Strategy Pattern Realization Key Issue: Strategy / Context Interface Strategy knows" Context structure: y Strategy has reference of Context/Document Context provides fat" interface => tight Context/Strategy coupling Context propagation via parameter: { Context provides ALL required information to the Strategy: loosely coupling Problem: TEXFormatter requires more details than Simpleformatter! => always provide MAXIMAL information ~ ƒ ˆ Š Œ Ž ƒ Œ ƒ š š Œ œ žÿƒ œš Š Œ Ž ƒ Š Œ Ž ƒ ~ ƒ ˆ Š Œ Ž ª «ª ŠŠ Ÿ ž ƒ See also: Visitor Design Pattern IV-47 Strategy Pattern Realization Pros: Families of algorithms An alternative to subclassing Strategies eliminate conditional (switch) statements (dynamic) choice of implementation Cons: Delegation => communication overhead IV-48 24

25 Template Method Pattern Intent: Define a skeleton algorithm with steps deferred to subclasses Example: Sort algorithm parameterised with iterator, less-op, swapop Related Pattern: Factory Methods are often called by Template Methods Template Methods use inheritance to vary parts of the algorithm while Strategy use delegation to vary the entire algorithm [Gamma+1994] IV-49 Template Method Example IV-50 25

26 Á Â Ã Å Æ Ç È º» ¼ ¾ Template Method Realization Design aspects: ¹ An OO classics! Reuse superclass with extensive implementation Simple application/context specific subclasses define the details in deferred operations Extract common code/functionality into superclass Implementation: ½ Access control: deferred operations have to be protected Minimizing the number of required deferred operations Naming Convention: name deferred operations doxxx IV-51 Iterator Pattern (Problem) Problem: Permit access to aggregated set of elements Why not use Arrays? À Arrays provide no encapsulation => no information hiding => reduced changeability Invariants, e.g. ordered, can not be ensured due to arbitrary access Static size => often to many memory is allocated (can not grow) Insert is inefficient (when a new memory chunk has to be allocated) Solution: Container classes generalize and replace arrays Ä Hierarchy of containers for different tasks: Lists, Sets, Bags, Stacks, Vectors, Heap, Trees, Graphs, Maps,... Independent of entry type: Container<ValueType> Example: stack<string> s; s.push( Karl ); cout << s.top( ); s.pop( );... Use Iterator to access Container: Provide sequential access to all elements Support multiple clients in parallel Uniform access operations => exchangeability IV-52 26

27 ! " ä ö # $ % & How To Encapsulate A Container? Via values: É Ê Ë ÌÎÍÐÏ Ñ Ì Ò ÓŒÔÕÏ ËˆÖ ÓÙØ ÚÜÛ ÝŠÌ ÞàßáÌ â ÞáÒ â Øàã Inefficient: O(log(n)) or O(n) Use index (Array): å æ ç åéè ê ë ì íîîðï ð íîñ ò í îôó å õàè Local Cursor: No extern navigation and instead locally stored position Õø ùõúõûüúšýÿþ û üú Õø ù û û Õø ùõúõûüúáû fits only to arrays, but not linked lists. The support for random" access restricts the choice of possible implementations to a great extent Encapsulation Not "reentrant" IV-53 How Encapsulate a Container? Extern cursor: specific record/class that contains index Iterator: like Cursor, but navigation is done using only the Iterator cursor := c.first (); cursor2 = c.first (); c.next (cursor); c.islast (cursor); c.remove (cursor); Uniform due to abstract superclass container All functionality is located in the container, cursor encapsulates only the position Suitable solution, but not used! iter = c.start (); x = iter.get(); iter.next(); iter.atend (); Very uniform access operations (Hierarchies of Iterators) Configure Iterator: iter = tree.start (postorder); Easy to use on client side Functionality distributed on Container and Iterator THE Standard!! IV-54 27

28 ) * + -. Iterator Pattern Intent: Provide a way to access aggregated elements sequentially without exposing the underlying representation Motivation: ' Permit access to aggregated element set directly (parameter or access) breaks encapsulation [Gamma+1994] Related Patterns: ( Often applied to recursive structures such as Composites Polymorphic Iterators via Factory Methods Memento can be used to store Iterator position IV-55 Cursor vs. Iterator? Similar for the client, but in libraries most often Iterator, e.g., O2, Leda, STL... IMPORTANT:, Container are available and therefore should be reused Container are used like elements of the programming language itself Set, list, stack are not modelled explicitly any more and instead their implementation is implicitly assumed when associations with multiplicity 0..* are used for (Cursor i = userlist.start ();!userlist.atend (i); userlist.advance (i) ) { user = userlist.get (i); } for (Iterator i = userlist.start ();! i.atend (); i.advance () ) { user = i.get (); } IV-56 28

29 / Iterator & Composite Structures Intent: Uniform treatment for document structur (vgl. JGL) Motivation: JGL-conform Iterator for composite- /document structur Enable general access strategies (e.g., JGL algorithm foreach, find,... ) Hierarchies of alternative traversals: PLR (Parent-Left-Right), LRP, LR,... Also for subtrees Any start node Example: :6;< =>@?BAC@?ED FG7?IH JLK?LM JLC@?ON9@H JLK?6D P@Q R S6Q RTGU V Q R SWH VWX < >@?BAC@?IU :67?LYOKTGQ RX ZB[ \OC@C J U T@K J X ZBU :67? ]ER SX ZB[ R K ^_H A F6M?BMTG?LM : ;6]GR SX Z Z ` IV-57 Complex Iterator Example acb deegf b h i j kch dj l hkmj kcn oeqprb sutvi j k h dj l h w th x ycdj kqpqb sutvojlv kprb sctvz t{ b x agf b h i j k h dj l h } pqb sctvdp~b sutv w j v k prb sut v gdp~b sutvz ƒ t{ b x a~pqb sutvq kjl} wwh kj {h n j v kpqb sctvz ƒ t{ b x aqdo ycdcn akg} w j vx eol n kgx eool n k jlh sg l j l x h ê j acvx b o kcb ekq l j lge x b x n x } j v kprb sut v c gn{b bi j vh l n k Š {n j x Œqk mcak t j x l n} Ž t dejjlv kkcn ož6 z x } jlv kprb sctv k x n O Gvx b o h k n8} L dˆj n o} w j v k prb sut v 8} prb sutv j v kpqb sut v k x n ~ Gvx b o h kcn} kj@} z x h ej a vx b o ƒ@k b e kow kˆj x b x n x h ej@{tg{n jlx b n l j b dej a vx b o p~b sutv j v kcfd h kcn j j v kpqb sutcv kjlfdch kcn j } Lz l h }z j v k fdch kcn j@ n{b } j v k fdch kcn j kcn o ~ Wvx b o h kcn} L kˆj@} qj v kpqb stvz w jlv kp~b sutv Oj v kcf dch k n j z j v kcf dch k n j qj v kpqb sut v kˆj fdch kcn j@} Lzqƒ x } j v kcfdch kcn j 8n{b bw j v k prb sut v gn{b b z ƒ@k b e kow x n oœos ekcb x nga vcx b o8b x ej dcn oacv lcle kgn kmj kcb kcœ kcn j i nt { j i j kch dj l h x j k h g x n o } j v kcf dch kcn k x n O Gvx b o h kcn} j v kcf dch k n j kcn o ~ Wvx b o h kcn} jlv k pqb sutvolz x j kch do ycdcn a kg} z j v k prb sut v 8x j kch kj@} z ƒ IV-58 29

30 š Design of Complex Iterators Options: Iterator construction with plrbegin is possible for all glyphs: + Recursion is addressed uniform for user - Find sibling inefficient ( linear search in liste => O( n/2 ) ) Solutions: 1. Iterator only for document (subtree): use stack of Iterators (see [Gamma+1994] Chapter 2.8) 2. Glyph stores in addition to theparent his position (myposinchildren) 3. Mixed Forms: Maintain stack of Iterators when go down For Sibling the stack is used when possible, otherwise inefficient search is used IV-59 Iterator & Strategy Realization Ÿœ ~ B qÿ «ª 6œ œ W «ª ± Eœ ª²6 B³O 6 µ ²6 B B O ¹ºœ O ¹ºª 6œ œ Ÿ Ÿ6»LẂ I ¼Gœ L½ B Ǵ 6ª«²@ ³O 6 µ ž œ O ² 6 ¾ L µ G ÀÁ L µà  Gà œ ž6ÿ Iµ ²6 ~ B»G L»~»W Gà 6 L Ä ª µ ²6 LÅ Æ µ ²@ ÇÈ»~ 6 L É œ u «6à œ O ¹ºªÀ Ê B O ¹ œ O ¹8Ë œ q L qÿ L 6ª œ O ¹Ìµ ž œ O ² 6 6 ª± L Lµ ²6 E Í»~ ¾ Î Ǵ ÀG qÿ G µ ²@ qÿ u O œ q L qÿ «ª Í Ï IV-60 30

31 Ñ Ò Ó Ô Õ Visitor Pattern (Problem) Problem: Ð For classes A { public m()... } and class B extends A { public m( )... } we want that depending on the runtime typ of x either x.m () is A::m or B::m() => called operation depends on runtime type of an object ("single dispatch ) Sometimes even "double dispatch is required when called operation depends on multiple runtime types Example: Lexi tools such as SpellChecker, Hyphenator, Formatter,... and Glyph classes Within the Strategy-Pattern, for example, the Glyph operation getchar is required: aglyph.do (atool) charglyph + spellchecker => SpellChecker::checkChar (charglyph) rowglyph + formatter => formatrowbegin (rowglyph) (Language construct for "double dispatch" (see CLOS language) solves problem!!) IV-61 Visitor Pattern Intent: Perform a specific operation when traversing the elements of an object structure Example: Compiler with abstract syntax tree and type-checking, code generation, Idea: Achieve the required double dispatch using two single dispatch calls and explicit visitor objects! Related Pattern: Ö Traversal using Composite Use to realize Interpreter [Gamma+1994] IV-62 31

32 Ø Ù Ú Û Ü Ý Þ ß à â ã Visitor Pattern Realization IV-63 Visitor Pattern Implementation Design Aspects: Main advantage: getc (or similar access operations) are not further an element of the Glyph Elegant cooperation between two class hierarchies Separation in data structures, traversal and algorithms New Visitors can be easily added Hosts are not required to be of related types Visitor algorithm objects can accumulate State Traversal Algortihm: Object structure (Composite) Iterator Visitor itself Problems: á New Glyph classes are expensive (all Visitors have be adjusted) Guidelines: The class hierarchy with less classes and changes should be the hosts The more complex and less frequent changing hierarchy should be the Visitors => In our example its better to chose the Glyphs as "Visitors IV-64 32

33 Command Pattern (Problem) Problem: ä The common technique to use a switch covering all Menu-Items or Buttons results in fixed assignment of user interface elements and functionality. This often lead to multiple implementations of functionality and hindrance to adjust the user interface. Also Undo and Macro mechanism are difficult to provide. Idea: å Use explicit command objects that enable more flexible management æçgèé ê ëíì~î8ê ïñðeòqð~ëóiêlôoõë~öñï«îqøgù ú úlú ûwüíê õërýñóbëröþï î øgù ú ú ú ë~ÿoû~ð ûeõêlô ˆôñÿ~û ûoðó ø! " îërçqöþðrôrõgõˆý ð " îëñôqðeü " îgëqçqöñðqôoõ ó ôoø# $ îîqõ&% êlôoïîqü ú ðgõó ø ú ægçoõ " îgëqçgöþðrôrõ ó õýqð " îgëeø! è'ð~ÿ' ë~ÿoû~ð ()*+, ú ú ú ë~ÿoû~ð.-,,/ / í 0, IV-65 Command Pattern Intent: Encapsulate Requests in explicit objects allowing undo and macro support Also Known As: Action, Transaction [Gamma+1994] Motivation: Permit flexible composition of window widgets with required functionality Related Pattern: 1 Use a Command as a Prototype for a history list 2 Use a Memento to remember class specific state IV-66 33

34 : ; Command Pattern Realization Attach Widgets such as Buttons or MenuItems with commands that are executed when selected! Hierarchy of commands to organize stuff IV-67 Command Pattern Implementation Design Aspects: 3 Connection MenuItem <-> Command often dictated by GUI- Builder Connection Command <-> document / data structure: 5 Document is parameter fir Command construktor Access via Singleton (see Lexi) Command-Schnittstelle: 8 exec, undo, redo (history can be managed in Command::exec too) beginofparams,... Operations to request extern parameters Abbrev. Such as geticon, isexecutable, help,... are used for the dynamic construction of Menus ) parse, unparse operations support for scripting interfaces (Macros) IV-68 34

35 < = Idea for Undo/Redo Support Store executed commands to enable undo and redo steps Stored command elements have to additionally remember their subject of change (e.g., cut requires text fragment and position) Sequence of command elements represents the past, present and future IV-69 Undo/Redo Realization Use ordered association of commands with undo / redo operations to maintain a history Make History object a Singleton IV-70 35

36 B C D H I F G Undo/Redo Implementation Alternatives: A Single-level (multi-level) Undo (History has maximal 1 (n) entries) (linear) Undo/Redo (alternatives: see Ipsen/Progres-Modell): newcmd.exec () after an undo results in erasing future command => no further support for redo reflexive Undo: add Undo to History: Undo( Undo ) = Redo (see Emacs) => Redo contra intuitive accessible Combination with Backup/Recovery concepts: Memory consumption of the Undo-Information (sometimes) prohibitive expensive E periodic auto save / dump memory image Add backup/recovery points in History Instead of undo restore last backup version and redo until the required state is reached IV-71 Idea for Macro Support Use Composite Pattern to combine multiple low-level commands Use recursive propagation of the Composite pattern with ordered Composite elements to achieve intended composed behaviour composite (Command) composite (Rename) composite (Macro) composite (Command) composite (Save As) composite (Save) IV-72 36

37 Macro Realization Compose multiple commands to a single Macro Command IV-73 Full Command Pattern Structure IV-74 37

38 K M O Q Memento Pattern (Problem) Problem: Commands in the History have to additional store information to recover the old state (undo) Standard: store via cloning a copy of all changed objects, but: J Sometimes to much overhead A reference back can not be used to store referenc back to clone => extra treatment Alternatives: L Create only partial" clone Store only important" attribute and overwrite them for an undo (Problem: encapsulation might restrict attribute access) Idea: N Class itself provides helper object with important data: "Memento" Class can reset its state when some of its Mementos is provided IV-75 Memento Pattern Intent: Capture and externalise an object s state without violating encapsulation Also Known As: Token Related Pattern P Use for Undo with Command Use for Iterator [Gamma+1994] IV-76 38

39 Hooks Pattern Intent: Support several extensions or adaptations to internal operations Example: R Lisp-Systems such as Emacs Related Pattern: S Command Pattern T Interpreter Pattern IV-77 Hooks Pattern Implementation Design aspects: U See Strategy V IMPORTANT: Interface Command / Document W Add dynamically new commands/macros X "Interpreter Commands with script extensions Realize: Y Macros IV-78 39

40 Z [ \ ] III.6 Discussion & Summary Design pattern enable reuse of design experience at the design level! Each design pattern application should be guided by analysing the trade-offs Design pattern are domain independent concepts, but their application in a specific context is guided by the domain specific requirements (time, space) Design patterns generalize concepts that have been successfully employed in real world applications and therefore are bullet proofed! IV-79 III.7 Bibliography (1/1) [Gamma+1994] Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Design Patterns, Elements of Reuseable Object-Oriented Software. Addison-Wesley, IV-80 40

Composite Pattern. IV.4 Structural Pattern

Composite 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 information

Design Pattern and Software Architecture: IV. Design Pattern

Design 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 information

SDC Design patterns GoF

SDC 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 information

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns

EPL 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 information

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

Produced 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 information

Design 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.) 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 information

Topics in Object-Oriented Design Patterns

Topics 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 information

Using Design Patterns in Java Application Development

Using 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 information

Introduction to Software Engineering: Object Design I Reuse & Patterns

Introduction 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 information

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

CSCD01 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 information

Design Patterns. An introduction

Design 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 information

Object-Oriented Oriented Programming

Object-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 information

The Strategy Pattern Design Principle: Design Principle: Design Principle:

The 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 information

Ingegneria 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 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 information

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

Software 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 information

DESIGN PATTERN - INTERVIEW QUESTIONS

DESIGN 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 information

Think of drawing/diagramming editors. ECE450 Software Engineering II. The problem. The Composite pattern

Think 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 information

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

CSCD01 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 information

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011

Design 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 information

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011

Design 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 information

Object-Oriented Design

Object-Oriented Design Object-Oriented Design Lecture 20 GoF Design Patterns Behavioral Department of Computer Engineering Sharif University of Technology 1 GoF Behavioral Patterns Class Class Interpreter: Given a language,

More information

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

Socket 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 information

2.1 Design Patterns and Architecture (continued)

2.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 information

2.1 Design Patterns and Architecture (continued)

2.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 information

Keywords: Abstract Factory, Singleton, Factory Method, Prototype, Builder, Composite, Flyweight, Decorator.

Keywords: 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 information

Slide 1. Design Patterns. Prof. Mirco Tribastone, Ph.D

Slide 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 information

Design Patterns Reid Holmes

Design 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 information

Object-Oriented Design

Object-Oriented Design Object-Oriented Design Lecturer: Raman Ramsin Lecture 20: GoF Design Patterns Creational 1 Software Patterns Software Patterns support reuse of software architecture and design. Patterns capture the static

More information

Object Oriented Paradigm

Object Oriented Paradigm Object Oriented Paradigm Ming-Hwa Wang, Ph.D. Department of Computer Engineering Santa Clara University Object Oriented Paradigm/Programming (OOP) similar to Lego, which kids build new toys from assembling

More information

Tuesday, October 4. Announcements

Tuesday, 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 information

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

CSCD01 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 information

Software 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 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 information

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 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 information

Design Patterns. Gunnar Gotshalks A4-1

Design 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 information

Object Oriented Methods with UML. Introduction to Design Patterns- Lecture 8

Object 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 information

Modellistica 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 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 information

Lecture 5 C Programming Language

Lecture 5 C Programming Language Lecture 5 C Programming Language Summary of Lecture 5 Pointers Pointers and Arrays Function arguments Dynamic memory allocation Pointers to functions 2D arrays Addresses and Pointers Every object in the

More information

What is Design Patterns?

What is Design Patterns? Paweł Zajączkowski What is Design Patterns? 1. Design patterns may be said as a set of probable solutions for a particular problem which is tested to work best in certain situations. 2. In other words,

More information

Idioms and Design Patterns. Martin Skogevall IDE, Mälardalen University

Idioms 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 information

Design Patterns. (and anti-patterns)

Design Patterns. (and anti-patterns) Design Patterns (and anti-patterns) Design Patterns The Gang of Four defined the most common object-oriented patterns used in software. These are only the named ones Lots more variations exist Design Patterns

More information

be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate

be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate UNIT 4 GRASP GRASP: Designing objects with responsibilities Creator Information expert Low Coupling Controller High Cohesion Designing for visibility - Applying GoF design patterns adapter, singleton,

More information

Design of Software Systems (Ontwerp van SoftwareSystemen) Design Patterns Reference. Roel Wuyts

Design 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 information

CSCI Object Oriented Design: Frameworks and Design Patterns George Blankenship. Frameworks and Design George Blankenship 1

CSCI 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 information

An Introduction to Patterns

An 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 information

INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE 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 information

Design patterns. Jef De Smedt Beta VZW

Design patterns. Jef De Smedt Beta VZW Design patterns Jef De Smedt Beta VZW Who Beta VZW www.betavzw.org Association founded in 1993 Computer training for the unemployed Computer training for employees (Cevora/Cefora) 9:00-12:30 13:00-16:00

More information

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

Design Patterns. SE3A04 Tutorial. Jason Jaskolka SE3A04 Tutorial Jason Jaskolka Department of Computing and Software Faculty of Engineering McMaster University Hamilton, Ontario, Canada jaskolj@mcmaster.ca November 18/19, 2014 Jason Jaskolka 1 / 35 1

More information

Design patterns. OOD Lecture 6

Design 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 information

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

Trusted 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 information

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

Design 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 information

Last Lecture. Lecture 26: Design Patterns (part 2) State. Goals of Lecture. Design Patterns

Last 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 information

Modellistica 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 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 information

The GoF Design Patterns Reference

The 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 information

Applying the Observer Design Pattern

Applying the Observer Design Pattern Applying the Observer Design Pattern Trenton Computer Festival Professional Seminars Michael P. Redlich (908) 730-3416 michael.p.redlich@exxonmobil.com About Myself Degree B.S. in Computer Science Rutgers

More information

CSCI 253. Overview. The Elements of a Design Pattern. George Blankenship 1. Object Oriented Design: Iterator Pattern George Blankenship

CSCI 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 information

Object-oriented Software Design Patterns

Object-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 information

Design Patterns. Observations. Electrical Engineering Patterns. Mechanical Engineering Patterns

Design Patterns. Observations. Electrical Engineering Patterns. Mechanical Engineering Patterns Introduction o to Patterns and Design Patterns Dept. of Computer Science Baylor University Some slides adapted from slides by R. France and B. Tekinerdogan Observations Engineering=Problem Solving Many

More information

UNIT I Introduction to Design Patterns

UNIT 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 information

What is a Pattern? Lecture 40: Design Patterns. Elements of Design Patterns. What are design patterns?

What is a Pattern? Lecture 40: Design Patterns. Elements of Design Patterns. What are design patterns? What is a Pattern? Lecture 40: Design Patterns CS 62 Fall 2017 Kim Bruce & Alexandra Papoutsaki "Each pattern describes a problem which occurs over and over again in our environment, and then describes

More information

Brief Note on Design Pattern

Brief Note on Design Pattern Brief Note on Design Pattern - By - Channu Kambalyal channuk@yahoo.com This note is based on the well-known book Design Patterns Elements of Reusable Object-Oriented Software by Erich Gamma et., al.,.

More information

Ingegneria 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 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 information

Information systems modelling UML and service description languages

Information 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 information

3 Product Management Anti-Patterns by Thomas Schranz

3 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 information

Last Lecture. Lecture 17: Design Patterns (part 2) Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 4448/ Spring Semester, 2005

Last 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 information

4.1 Introduction Programming preliminaries Constructors Destructors An example... 3

4.1 Introduction Programming preliminaries Constructors Destructors An example... 3 Department of Computer Science Tackling Design Patterns Chapter 4: Factory Method design pattern Copyright c 2016 by Linda Marshall and Vreda Pieterse. All rights reserved. Contents 4.1 Introduction.................................

More information

SOFTWARE PATTERNS. Joseph Bonello

SOFTWARE 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 information

C++ for System Developers with Design Pattern

C++ for System Developers with Design Pattern C++ for System Developers with Design Pattern Introduction: This course introduces the C++ language for use on real time and embedded applications. The first part of the course focuses on the language

More information

Applying the Decorator Design Pattern

Applying the Decorator Design Pattern Applying the Decorator Design Pattern Trenton Computer Festival Professional Seminars Michael P. Redlich (908) 730-3416 michael.p.redlich@exxonmobil.com About Myself Degree B.S. in Computer Science Rutgers

More information

Software Engineering Prof. Rushikesh K.Joshi IIT Bombay Lecture-15 Design Patterns

Software 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 information

administrivia today UML start design patterns Tuesday, September 28, 2010

administrivia today UML start design patterns Tuesday, September 28, 2010 administrivia Assignment 2? promise to get past assignment 1 back soon exam on monday review slides are posted your responsibility to review covers through last week today UML start design patterns 1 Unified

More information

CHAPTER 6: CREATIONAL DESIGN PATTERNS

CHAPTER 6: CREATIONAL DESIGN PATTERNS CHAPTER 6: CREATIONAL DESIGN PATTERNS SESSION III: BUILDER, PROTOTYPE, SINGLETON Software Engineering Design: Theory and Practice by Carlos E. Otero Slides copyright 2012 by Carlos E. Otero For non-profit

More information

Applying 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 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 information

CS560. Lecture: Design Patterns II Includes slides by E. Gamma et al., 1995

CS560. Lecture: Design Patterns II Includes slides by E. Gamma et al., 1995 CS560 Lecture: Design Patterns II Includes slides by E. Gamma et al., 1995 Classification of GoF Design Pattern Creational Structural Behavioural Factory Method Adapter Interpreter Abstract Factory Bridge

More information

Chapter 1. OO e OO. (Pattern) Alexander) (context) (elements) k. (issue) Š. (name) (classification)

Chapter 1. OO e OO. (Pattern) Alexander) (context) (elements) k. (issue) Š. (name) (classification) Chapter 1 OO OO l s ( )l s( ƒ n n m² OO Œ ž OO k ž OO Œ n (Pattern) k ps ½ s x n k w wyÿ i OO wk n Ÿ Äwy ½ x wž yy? Pattrn (core) ƒ n y (Christopher Alexander) l ƒ gp (context) (elements) k k (cosequences)

More information

Overview CS Kinds of Patterns. Design Pattern. Factory Pattern Rationale. Kinds of Factory Patterns

Overview CS Kinds of Patterns. Design Pattern. Factory Pattern Rationale. Kinds of Factory Patterns Overview CS 2704 Topic: Design Patterns Design pattern concepts Kinds of patterns Some specific patterns Pattern resources 5/1/00 CS2704 Design Patterns 2 Design Pattern Solution to a particular kind of

More information

UNIT I Introduction to Design Patterns

UNIT 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 information

Coordination Patterns

Coordination 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 information

The Design Patterns Matrix From Analysis to Implementation

The Design Patterns Matrix From Analysis to Implementation The Design Patterns Matrix From Analysis to Implementation This is an excerpt from Shalloway, Alan and James R. Trott. Design Patterns Explained: A New Perspective for Object-Oriented Design. Addison-Wesley

More information

OODP Session 4. Web Page: Visiting Hours: Tuesday 17:00 to 19:00

OODP 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 information

APPLYING DESIGN PATTERNS TO SCA IMPLEMENTATIONS

APPLYING 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 information

Goals 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. 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 information

Design Patterns IV. Alexei Khorev. 1 Structural Patterns. Structural Patterns. 2 Adapter Design Patterns IV. Alexei Khorev. Structural Patterns

Design 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 information

Design Patterns IV Structural Design Patterns, 1

Design 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 information

Applying the Factory Method Design Pattern

Applying the Factory Method Design Pattern Applying the Factory Method Design Pattern Trenton Computer Festival Professional Seminars Michael P. Redlich (908) 730-3416 michael.p.redlich@exxonmobil.com About Myself Degree B.S. in Computer Science

More information

MVC. Model-View-Controller. Design Patterns. Certain programs reuse the same basic structure or set of ideas

MVC. Model-View-Controller. Design Patterns. Certain programs reuse the same basic structure or set of ideas MVC -- Design Patterns Certain programs reuse the same basic structure or set of ideas These regularly occurring structures have been called Design Patterns Design Patterns Design Patterns: Elements of

More information

WS01/02 - Design Pattern and Software Architecture

WS01/02 - Design Pattern and Software Architecture Design Pattern and Software Architecture: VIII. Conclusion AG Softwaretechnik Raum E 3.165 Tele. 60-3321 hg@upb.de VIII. Conclusion VIII.1 Classifications VIII.2 Common Misconceptions VIII.3 Open Questions

More information

A few important patterns and their connections

A 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 information

Plan. A few important patterns and their connections. Singleton. Singleton: class diagram. Singleton Factory method Facade

Plan. 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 information

Lecture 17: Patterns Potpourri. Copyright W. Howden 1

Lecture 17: Patterns Potpourri. Copyright W. Howden 1 Lecture 17: Patterns Potpourri Copyright W. Howden 1 GOF Patterns GOF: Gamma, Helm, Johnson, Vlissides Design Patterns, Addison Wesley, 1995 Patterns we have seen so far Creational Patterns e.g. Factory,

More information

Pointers. CS2023 Winter 2004

Pointers. CS2023 Winter 2004 Pointers CS2023 Winter 2004 Outcomes: Introduction to Pointers C for Java Programmers, Chapter 8, sections 8.1-8.8 Other textbooks on C on reserve After the conclusion of this section you should be able

More information

Review Software Engineering October, 7, Adrian Iftene

Review Software Engineering October, 7, Adrian Iftene Review Software Engineering October, 7, 2013 Adrian Iftene adiftene@info.uaic.ro Software engineering Basics Definition Development models Development activities Requirement analysis Modeling (UML Diagrams)

More information

David Talby March 21, 2006

David Talby March 21, 2006 David Talby Representing Data Structures Composite Flyweight Decorator Traversing Data Structures Iterator Visitor Documented Proved Design Experience Finding the right classes Finding them faster Common

More information

Design Patterns. David Talby

Design Patterns. David Talby Design Patterns David Talby Contents Representing Data Structures Composite Flyweight Decorator Traversing Data Structures Iterator Visitor May 27, 2008 Object Oriented Design Course 2 Design Patterns

More information

Design Pa*erns. + Anima/on Undo/Redo Graphics and Hints

Design Pa*erns. + Anima/on Undo/Redo Graphics and Hints Design Pa*erns + Anima/on Undo/Redo Graphics and Hints Design Pa*erns Design: the planning that lays the basis for the making of every object or system Pa*ern: a type of theme of recurring events or objects

More information

Design Patterns. Decorator. Oliver Haase

Design 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 information

CSCI 253. Overview. The Elements of a Design Pattern. George Blankenship 1. Object Oriented Design: Template Method Pattern. George Blankenship

CSCI 253. Overview. The Elements of a Design Pattern. George Blankenship 1. Object Oriented Design: Template Method Pattern. George Blankenship CSCI 253 Object Oriented Design: George Blankenship George Blankenship 1 Creational Patterns Singleton Abstract factory Factory Method Prototype Builder Overview Structural Patterns Composite Façade Proxy

More information

Pattern Examples Behavioural

Pattern Examples Behavioural Pattern Examples Behavioural based on patterns in Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, Design Patterns, Addison-Wesley, 1995. ISBN 0-201-63361-2 PE2-1 Iterator Pattern Intent» Access

More information

Design patterns generic models

Design patterns generic models Design patterns generic models Jyothish Maniyath CDC Software India Pvt Ltd 6 th Floor, Canberra Block, UB City, #24 Vittal Mallya Road, Bangalore, India +91 94482 46718 jyosh@maniyath.com ABSTRACT This

More information

DESIGN PATTERNS FOR MERE MORTALS

DESIGN PATTERNS FOR MERE MORTALS DESIGN PATTERNS FOR MERE MORTALS Philip Japikse (@skimedic) skimedic@outlook.com www.skimedic.com/blog Microsoft MVP, ASPInsider, MCSD, MCDBA, CSM, CSP Consultant, Teacher, Writer Phil.About() Consultant,

More information

What is Design Patterns?

What is Design Patterns? Paweł Zajączkowski What is Design Patterns? 1. Design patterns may be said as a set of probable solutions for a particular problem which is tested to work best in certain situations. 2. In other words,

More information