The Object Recursion Pattern
|
|
- Rudolf Gilmore
- 6 years ago
- Views:
Transcription
1 SilverMark, Inc. OBJECT RECURSION Object Behavioral Intent Distribute processing of a request over a structure by delegating polymorphically. Object Recursion transparently enables a request to be repeatedly broken into smaller parts that are easier to handle. Also Known As Recursive Delegation Motivation Consider the need to determine if two objects are equivalent. Simple objects and primitives are easy to compare; just use native operations. The difficulty lies in comparing arbitrarily complex objects. One approach is to employ a Comparer object that accepts any two arbitrarily complex objects and answers whether the subjects are equivalent. The Comparer takes the subjects, breaks each one into pieces, and compares the pieces to determine if they re equivalent. If any of the pieces are too complex to compare, the Comparer repeats the process by breaking it into pieces, and so on until all of the pieces are simple enough to compare. This Comparer approach has several undesirable consequences. The Comparer must recognize what kind of object the subjects are and know how to decompose those kinds of objects into simple parts that can be compared. The more complex a subject is, the more complex the code for comparing it needs to be. Every time a developer implements a new class whose instances might need to be compared, he also needs to add code to Comparer (or a subclass) to handle the new class. The decomposition code in Comparer depends heavily on the class implementation, so whenever that implementation changes, the code in Comparer must be changed accordingly. The subjects need to provide extra protocol for decomposing, protocol that exposes the objects implementation. All in all, the Comparer requires lots of complex code that is difficult to develop and maintain. A more object-oriented approach is for the Comparer to tell the subjects to compare themselves and let them decide how to do that. This way, the Comparer is telling the subjects what to do, but not how to do it. With this approach, the Comparer object isn t even needed because any Client can simply ask one subject to compare itself with another. So how do the subjects compare themselves? One determines if the other is equivalent to itself. It considers which parts of its state must be equivalent, then compares those. Each of those parts considers which of its parts must be equivalent and compares those, and so on until all of the parts are simple objects. At each step, the comparison process is relatively simple. Even a highly complex object doesn t need to know how to compare itself entirely; it just needs to know what its parts are and they need to know how to compare themselves. For example, consider an Engine object that knows its internal displacement and total horsepower. To compare it to another engine, a client must verify that both engines are the same size and same power. This diagram shows the classes involved and how to implement =: 07/27/98 5:25 PM 1 Copyright 1998,. All rights reserved. Permission is granted to copy for the PLoP-98 conference.
2 Client <<Comparable>> = Object:boolean Engine size Integer = Object = Engine power = Object = Number = Integer return false return (this.size = anengine.size) & (this.power = anengine.power) /* native */ The Client sends = to the first Engine with the second Engine as an argument. The first Engine compares itself to the second one by comparing their size and power. The parts are Integers, simple objects that the native system can compare. If the parts were complex objects, they would continue the comparison process by comparing their parts. Eventually, the simplest parts are either equal or they re not. a Client an Engine size : Integer power : Integer = anengine = aninteger [= is true] = aninteger Keys This comparison algorithm, where an object compares itself to another by telling their parts to compare themselves and so on, is an example of Object Recursion. An implementation of a recursive message sends the same message to one or more of its related objects and so on. The message surfs through the linked structure until reaching objects that can simply implement the message and return the result. A system that incorporates the Object Recursion pattern has the following features: Two polymorphic classes, one of which handles a request recursively and another which simply handles the request without recursing. A separate message, usually in a third class that is not polymorphic with the first two, to initiate the request. Applicability Use the Object Recursion pattern when: 2 07/27/98 5:25 PM
3 passing a message through a linked structure where the ultimate destination is unknown. broadcasting a message to all nodes in part of a linked structure. distributing a behavior s responsibility throughout a linked structure. Structure The following class diagram shows the roles of the participants: Initiator handler <<Handler>> * makerequest() handler handlerequest Terminator Recurser prehandlerequest() posthandlerequest() successor /* handle the request */ this.prehandlerequest(); successor.; this.posthandlerequest(); A typical object structure might look like this: aninitiator handler arecurser successor aterminator Participants Initiator (Client) initiates the request. usually not a subtype of Handler; makerequest() is a separate message from. Handler (Comparable) defines a type that can handle requests that initiators make. Recurser (Engine) defines the successor link. handles a request by delegating it to its successors. successors relevant to a request can vary by request. can perform extra behavior before or after delegating the request. may be a terminator for a different request. Terminator (Integer) Collaboration finishes the request by implementing it completely and not delegating any of its implementation. may be a recurser for a different request. The Initiator needs to make a request. It asks its Handler to handle the request. 07/27/98 5:25 PM 3
4 When the Handler is a Recurser, it does whatever work it needs to do, asks its successor another Handler to handle the request, and returns a result based on the successor s result. The extra work can be done before and/or after delegating to the successor. If the Recurser has multiple successors, it delegates to each of them in turn, perhaps asynchronously. When the Handler is a Terminator, it handles the request without delegating the request to any other successors and returns the result (if any). aninitiator handler arecurser successor aterminator makerequest() prehandlerequest() posthandlerequest() Consequences The advantages of the Object Recursion pattern are: Distributed processing. The processing of the request is distributed across a structure of handlers that can be as numerous and arranged as complexly as necessary to best complete the task. Responsibility flexibility. The Initiator does not need to know how many Handlers there are, how they re arranged, or how the processing is distributed. It simply makes the request of its handler and lets the Handlers do the rest. The Handler arrangement can change at runtime to dynamically reconfigure the handling responsibilities. Role flexibility. A handler that acts like a Recurser for one request may act as a Terminator for another request, and visa versa. Increased encapsulation. Encapsulates the decisions for how to handle a request within the object doing the handling. The disadvantages of the Object Recursion pattern are: Programming complexity. Recursion, procedural or object-oriented, is a difficult concept to grasp. Overuse can make a system more difficult to understand and maintain. Implementation There are a couple of issues to consider when implementing the Object Recursion pattern: 1. Separate Initiator type. The Initiator.makeRequest() message must not be polymorphic with the Recursor. message. Beginner programmers quickly learn that if a method has no 4 07/27/98 5:25 PM
5 senders, it can be deleted. But they mistakenly assume that as long as a method has senders, it shouldn t be deleted. This is not true when the only senders of a method are other implementors of the same message, as is the case with object recursion. Unless there is another, nonpolymorphic method to start off the recursion, none of the implementors will ever be run and they can all be deleted. 2. Defining the successor. The Recurser needs one or more successors, but the Terminator does not. If the Terminator implements the successor link (usually by inheriting it from the Handler), it ignores the link when implementing the messages. If all of the Terminator s messages ignore the successor link, then its value can always be null and the link is not needed. Sample Code Let s look at how to implement equals recursively. All objects, no matter how complex, are ultimately composed of simple objects (i.e., primitives) such as integers, floats, booleans, and characters. Determining the equality of two simple objects (of the same type) is a trivial task performed natively by the operating system or CPU. For example: 5 == 5 // integer comparison (true) 5.25 == 5.15 // float comparison (false) true == false // boolean comparison (false) 'a' == 'b' // character comparison (false) There s no recursion here, but these simple comparisons form the terminating case for recursion. Comparing two ordered collections is nearly as simple: Are each of the elements equal? Thus two strings are equal if each of their characters are equal. For example, look at the implementation of String.equals(String): public class String { private char value[]; private int count; public boolean equals(string anotherstring) { int n = count; if (n == anotherstring.count) { char v1[] = value; char v2[] = anotherstring.value; int i = 0; int j = 0; while (n--!= 0) { if (v1[i++]!= v2[j++]) { return false; return true; return false; Thus if each of the characters in the strings are equal, the strings are equal. For the purposes of implementing equality recursively, a string is a terminating object. Now consider a name object that stores the first name and last name separately. Two names are equal if their first and last names are both equal: public class PersonName { private String firstname, lastname; public boolean equals (PersonName anothername) { 07/27/98 5:25 PM 5
6 return firstname.equals(anothername.firstname) && (lastname.equals(anothername.lastname)); This contains one level of recursion PersonName.equals() calls String.equals() plus the primitive operation. Now consider a phone directory object that stores a person s name and phone number. Two entries are considered duplicates if their names are equal: public class DirectoryEntry { private PersonName name; public boolean equals (DirectoryEntry anotherentry) { return name.equals(anotherentry.name); Here we have two levels of recursion DirectoryEntry.equals() calls PersonName.equals(), which calls String.equals(). name firstname lastname client adirectory- Entry aperson- Name astring astring equals(entry) equals(entry.name) equals(name.first) [equals = true ] equals(name.last) The client doesn t really care which implementor of equals() it s calling; it just knows that it has two objects of the same type and so it compares them using equals(). If the two objects were simple ones, there would be no recursion necessary. When the two objects are complex, equals() is implemented recursively using other implementors of equals(). Known Uses Numerous programming examples use Object Recursion. The equality example described in the Motivation uses one-step recursion: The recursive implementation of the message sends the same message to its successor directly. Each implementor of equal also needs a corresponding implementor of hash, which is also implemented recursively. A copy or clone message is often implemented using two-step recursion: The recursive implementation sends a second message to the receiver, which in turn sends the original message to its successor. Thus the two messages together implement the recursion. In the case of copy(), the 6 07/27/98 5:25 PM
7 two messages are simplecopy() which only copies the root of the object and postcopy() which copies the object s parts as necessary. copy() sends simplecopy() and postcopy(); postcopy() in turn sends the parts copy(), propagating the recursion. Serialization algorithms, whether they produce text or binary output, usually use recursion. The algorithm serializes an object by serializing the root and then recursively serializing its (persistent) parts. Each branch of the recursion ends when a simple object serializes itself and is finished. An algorithm to display an object as a string (e.g., Java s tostring() and Smalltalk s printstring) is usually recursive. The algorithm displays the root as a string, then recursively tells the interesting parts to display themselves. A tree structure can use recursion to pass a message from any one of its leaves up to its root. Each node in the path recursively passes the message to its parent, doing any extra work along the way as necessary. The tree can similarly use recursion to broadcast a message from its root through all of its nodes to its leaves. These recursive techniques are frequently used in graphics trees, for example, to register invalidation requests and broadcast redisplay opportunities. See the Related Patterns section for more known uses. Related Patterns Object Recursion vs. Composite and Decorator When a Decorator [GHJV95, p. 175] delegates to its component or a Composite [GHJV95, p. 163] delegates to its children, this might be considered an example of Object Recursion. However, Composite and Decorator are structural (data structure) patterns, whereas Object Recursion is a behavioral (algorithm) pattern. If the structural patterns do embody recursion, it is only explicitly one level deep (a composite or decorator delegating to its component), whereas recursion s depth is unlimited. At best, Object Recursion is a pattern that both Composite and Decorator contain, but that can also be used independently of Composite or Decorator. Object Recursion vs. Chain of Responsibility Chain of Responsibility [GHJV95, p. 223] contains the Object Recursion pattern. Chain of Responsibility uses a linked-list or tree organized by specialization or priority. When a request is made, the structure uses Object Recursion to find an appropriate handler. Object Recursion and Adapter A chain of Adapters [GHJV95, p. 139] can seem to use a non-polymorphic form of Object Recursion, where the behavior is recursive even though the message isn t, as each adapter delegates to the next until the delegation terminates at the adaptee and unwinds. However, the lack of polymorphism goes against the spirit of Object Recursion. Object Recursion and Interpreter In Interpreter [GHJV95, p. 243], the interpret() message traverses the abstract syntax tree using Object Recursion. Client is the Initiator, AbstractExpression is the Handler, NonterminalExpression is the Recurser, and TerminalExpression is the Terminator. Object Recursion and Iterator Some implementations of Iterator [GHJV95, p. 257] use Object Recursion. External iterators on any structure are not recursive; they use while loops instead. Internal iterators on array structures also use while loops. An internal iterator on a linked-list structure is recursive. If the terminating node of the list is a real object with the same type as other list nodes, since the internal iteration makes the next() and isdone() messages private, the algorithm is object recursion. If the end of the list is marked by null, the recursion is procedural. 07/27/98 5:25 PM 7
8 An internal iterator on a branching structure (i.e., a tree or graph) must be implemented recursively. If the terminating points the leaves and/or root are objects, then the recursion is object recursion. Object Recursion and Delegation Other patterns contain an object that implements a message by delegating the same message to a collaborator of the same type: Proxy is a good example. Any such example is a one-level-deep example of Object Recursion, which is not a very interesting example, but a simple example nonetheless. References [GHJV95] Acknowledgments Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading, MA, Thanks to Eugene Wallingford for his help in writing this paper. 8 07/27/98 5:25 PM
CHAIN OF RESPONSIBILITY (DP 223)
CHAIN OF RESPONSIBILITY (DP 223) Object Behavioral Intent Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects
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 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 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 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 informationThe Null Object Pattern
Knowledge Systems Corp. 4001 Weston Pkwy, Cary, NC 27513-2303 919-677-1119 x541, bwoolf@ksccary.com NULL OBJECT Object Structural Intent Provide a surrogate for another object that shares the same interface
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 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 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 information2/23/04 Doc 10 State & Chain of Responsibility slide # 1
2/23/04 Doc 10 State & Chain of Responsibility slide # 1 CS 635 Advanced Object-Oriented Design & Programming Spring Semester, 2004 Doc 10 State & Chain of Responsibility Contents State... 2 Example -
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 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 informationCHAPTER 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 informationDesign Patterns. CSC207 Winter 2017
Design Patterns CSC207 Winter 2017 Design Patterns A design pattern is a general description of the solution to a well-established problem using an arrangement of classes and objects. Patterns describe
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 informationDesign Patterns. CSC207 Fall 2017
Design Patterns CSC207 Fall 2017 Design Patterns A design pattern is a general description of the solution to a well-established problem using an arrangement of classes and objects. Patterns describe the
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 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 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 informationDesign Patterns. CSC207 Fall 2017
Design Patterns CSC207 Fall 2017 Design Patterns A design pattern is a general description of the solution to a well-established problem using an arrangement of classes and objects. Patterns describe the
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 informationPattern 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 informationControl Message. Abstract. Microthread pattern?, Protocol pattern?, Rendezvous pattern? [maybe not applicable yet?]
Control Message An Object Behavioral Pattern for Managing Protocol Interactions Joe Hoffert and Kenneth Goldman {joeh,kjg@cs.wustl.edu Distributed Programing Environments Group Department of Computer Science,
More informationAlternator. An Object Behavioral Design Pattern. John Liebenau
Alternator An Design Pattern John Liebenau lieb@itginc.com Copyright 1999, John Liebenau. Permission is granted to copy for the PLoP 1999 conference. All other rights reserved. July 23, 1999 Page 1 1.
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 informationObject-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 informationAdvanced Object Oriented PHP
CNM STEMulus Center Web Development with PHP November 11, 2015 1/17 Outline 1 2 Diamond Problem Composing vs Inheriting Case Study: Strategy Design Pattern 2/17 Definition is when a class is based on another
More informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: Chain Of Responsibility 1 Chain Of Responsibility Intent Avoid coupling the sender of a request to its receiver by giving more than one object a chance to
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 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 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 informationL18.1 Introduction... 2
Department of Computer Science COS121 Lecture Notes: L18 Iterator Design Pattern 8 September 2014 Copyright c 2014 by Linda Marshall and Vreda Pieterse. All rights reserved. Contents L18.1 Introduction.................................
More informationImplementing GUI context-sensitive help... ECE450 Software Engineering II. Implementing GUI context-sensitive help... Context-sensitive help
Implementing GUI context-sensitive help... ECE450 Software Engineering II Today: Design Patterns VIII Chain of Responsibility, Strategy, State ECE450 - Software Engineering II 1 ECE450 - Software Engineering
More informationDesign 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 informationSoftware Engineering I (02161)
Software Engineering I (02161) Week 10 Assoc. Prof. Hubert Baumeister DTU Compute Technical University of Denmark Spring 2016 Last Time Project Planning Non-agile Agile Refactoring Contents Basic Principles
More informationMVC. 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 informationINCORPORATING ADVANCED PROGRAMMING TECHNIQUES IN THE COMPUTER INFORMATION SYSTEMS CURRICULUM
INCORPORATING ADVANCED PROGRAMMING TECHNIQUES IN THE COMPUTER INFORMATION SYSTEMS CURRICULUM Charles S. Saxon, Eastern Michigan University, charles.saxon@emich.edu ABSTRACT Incorporating advanced programming
More informationSoftware Reengineering Refactoring To Patterns. Martin Pinzger Delft University of Technology
Software Reengineering Refactoring To Patterns Martin Pinzger Delft University of Technology Outline Introduction Design Patterns Refactoring to Patterns Conclusions 2 The Reengineering Life-Cycle (1)
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 informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: Chain Of Responsibility 1 Design patterns, Laura Semini, Università di Pisa, Dipartimento di Informatica. Chain Of Responsibility Intent Avoid coupling the
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 informationWeiss Chapter 1 terminology (parenthesized numbers are page numbers)
Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement
More informationIntroduction to Object-Oriented Programming
1/9 Introduction to Object-Oriented Programming Conception et programmation orientées object, B. Meyer, Eyrolles Object-Oriented Software Engineering, T. C. Lethbridge, R. Laganière, McGraw Hill Design
More informationAs a programmer, you know how easy it can be to get lost in the details
Chapter 1 Congratulations, Your Problem Has Already Been Solved In This Chapter Introducing design patterns Knowing how design patterns can help Extending object-oriented programming Taking a look at some
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 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 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 informationWhat are the characteristics of Object Oriented programming language?
What are the various elements of OOP? Following are the various elements of OOP:- Class:- A class is a collection of data and the various operations that can be performed on that data. Object- This is
More information6.3 Patterns. Definition: Design Patterns
Subject/Topic/Focus: Analysis and Design Patterns Summary: What is a pattern? Why patterns? 6.3 Patterns Creational, structural and behavioral patterns Examples: Abstract Factory, Composite, Chain of Responsibility
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 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 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 informationThe Type Object Pattern
Knowledge Systems Corp. 4001 Weston Pkwy, Cary, NC 27513-2303 919-677-1119 x541, bwoolf@ksccary.com TYPE OBJECT Object Structural Intent Decouple instances from their classes so that those classes can
More information26.1 Introduction Programming Preliminaries... 2
Department of Computer Science Tackling Design Patterns Chapter 27: Proxy Design Pattern Copyright c 2016 by Linda Marshall and Vreda Pieterse. All rights reserved. Contents 26.1 Introduction.................................
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 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 informationGraphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub
Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java
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 informationCSE P 501 Compilers. Implementing ASTs (in Java) Hal Perkins Winter /22/ Hal Perkins & UW CSE H-1
CSE P 501 Compilers Implementing ASTs (in Java) Hal Perkins Winter 2008 1/22/2008 2002-08 Hal Perkins & UW CSE H-1 Agenda Representing ASTs as Java objects Parser actions Operations on ASTs Modularity
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 informationExam in TDDB84: Design Patterns,
Exam in TDDB84: Design Patterns, 2014-10-24 14-18 Information Observe the following, or risk subtraction of points: 1) Write only the answer to one task on one sheet. Use only the front side of the sheets
More information4.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 informationJames Newkirk
Private Interface Class Structural James Newkirk newkirk@oma.com Intent Provide a mechanism that allows specific classes to use a non-public subset of a class interface without inadvertently increasing
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 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 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 informationWhat 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 informationObject Relationships
Object Relationships Objects can work together in three different types of relationships: Uses: An object can use another to do some work (association). Composition: A complex object may be composed of
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 informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
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 informationMicrothread. An Object Behavioral Pattern for Managing Object Execution. 1.0 Intent. 2.0 Also Known As. 3.0 Classification. 4.0 Motivation/Example
Microthread An Object Behavioral Pattern for Managing Object Execution Joe Hoffert and Kenneth Goldman {joeh,kjg}@cs.wustl.edu Distributed Programing Environments Group Department of Computer Science,
More informationadministrivia 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 informationObject-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 informationObjectives. Problem Solving. Introduction. An overview of object-oriented concepts. Programming and programming languages An introduction to Java
Introduction Objectives An overview of object-oriented concepts. Programming and programming languages An introduction to Java 1-2 Problem Solving The purpose of writing a program is to solve a problem
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 informationEgon Borger (Pisa) Capturing Design Pattern Abstractions by ASMs
Egon Borger (Pisa) Capturing Design Pattern Abstractions by ASMs Universita di Pisa, Dipartimento di Informatica, I-56127 Pisa, Italy boerger@di.unipi.it visiting SAP Research, Karlsruhe, Germany egon.boerger@sap.com
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 informationWhat 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 informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: Builder, Chain Of Responsibility, Flyweight 1 Design patterns, Laura Semini, Università di Pisa, Dipartimento di Informatica. Builder 2 Design patterns,
More informationL25.1 Introduction... 2
Department of Computer Science COS121 Lecture Notes: L25 Chain of Respsibility Design Pattern 29 and 30 September 2014 Copyright c 2012 by Linda Marshall and Vreda Pieterse. All rights reserved. Ctents
More informationIntroduction and History
Pieter van den Hombergh Fontys Hogeschool voor Techniek en Logistiek September 15, 2016 Content /FHTenL September 15, 2016 2/28 The idea is quite old, although rather young in SE. Keep up a roof. /FHTenL
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 informationCSE P 501 Compilers. Implementing ASTs (in Java) Hal Perkins Autumn /20/ Hal Perkins & UW CSE H-1
CSE P 501 Compilers Implementing ASTs (in Java) Hal Perkins Autumn 2009 10/20/2009 2002-09 Hal Perkins & UW CSE H-1 Agenda Representing ASTs as Java objects Parser actions Operations on ASTs Modularity
More informationCS 231 Data Structures and Algorithms, Fall 2016
CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard
More informationdeveloper.* The Independent Magazine for Software Professionals Factory Chain: A Design Pattern for Factories with Generics by Hugo Troche
developer.* The Independent Magazine for Software Professionals Factory Chain: A Design Pattern for Factories with Generics by Hugo Troche Introduction The recent Java 5 (a.k.a. Java 1.5) generics implementation
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 informationCocoa Design Patterns. Erik M. Buck October 17, 2009
Cocoa Design Patterns Erik M. Buck October 17, 2009 Topics n What is a design pattern? n Why Focus on design patterns? n What is the Model View Controller design pattern? n Using MVC n When wouldn t you
More informationCrash course on design patterns
Crash course on design patterns Yann-Gaël Guéhéneuc guehene@emn.fr From Olivier Motelet s course (2001/10/17) École des Mines de Nantes, France Object Technology International, Inc., Canada Design patterns
More informationPatterns. Erich Gamma Richard Helm Ralph Johnson John Vlissides
Patterns Patterns Pattern-based engineering: in the field of (building) architecting and other disciplines from 1960 s Some software engineers also started to use the concepts Become widely known in SE
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 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 informationRefining the Observer Pattern: The Middle Observer Pattern
Refining the Observer Pattern: The Middle Observer Pattern Pablo Iaría - iariap@sol.info.unlp.edu.ar Ulises Chesini - uliche@sol.info.unlp.edu.ar Abstract The refinement presented in this paper incorporates
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 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 informationObject 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 informationDesign Patterns. Visitor Pattern. Hans Vangheluwe and Alexandre Denault
Design Patterns Visitor Pattern Hans Vangheluwe and Alexandre Denault 3D Room Scene Graphs Universe Room 1 Room 2 Desk Bed Wardrobe Books Lamp Doors Drawers What if? I want to print out the content of
More informationSpring 2018 Mentoring 8: March 14, Binary Trees
CSM 6B Binary Trees Spring 08 Mentoring 8: March 4, 08 Binary Trees. Define a procedure, height, which takes in a Node and outputs the height of the tree. Recall that the height of a leaf node is 0. private
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 informationL23.1 Introduction... 2
Department of Computer Science COS121 Lecture Notes: L23 Adapter Design Pattern 23 & 26 September 2014 Copyright c 2014 by Linda Marshall and Vreda Pieterse. All rights reserved. Contents L23.1 Introduction.................................
More information