Creational. Structural

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

SDC Design patterns GoF

SE 2 [CS 446, CS 646, ECE 452, SE 464] Software Design & Architecture Spring 2011 MIDTERM

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.)

Topics in Object-Oriented Design Patterns

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

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

Object-Oriented Oriented Programming

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns

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

Software Design COSC 4353/6353 D R. R A J S I N G H

An Introduction to Software Architecture. David Garlan & Mary Shaw 94

Design Patterns Reid Holmes

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

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

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

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

An Introduction to Software Architecture

Design Patterns: Structural and Behavioural

Architectural Styles II

Design Pattern and Software Architecture: IV. Design Pattern

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

A Reconnaissance on Design Patterns

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

An Introduction to Software Architecture

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

DESIGN PATTERN - INTERVIEW QUESTIONS

THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS

Architectural Patterns. Architectural Patterns. Layers: Pattern. Architectural Pattern Examples. Layer 3. Component 3.1. Layer 2

Architectural Patterns

Design Patterns. Comp2110 Software Design. Department of Computer Science Australian National University. Second Semester

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

The Design Patterns Matrix From Analysis to Implementation

Introduction to Software Engineering: Object Design I Reuse & Patterns

Design Patterns. An introduction

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

TDDB84: Lecture 6. Adapter, Bridge, Observer, Chain of Responsibility, Memento, Command. fredag 4 oktober 13

1 Software Architecture

Object-Oriented Concepts and Design Principles

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

Design Patterns Design patterns advantages:

Lecture 20: Design Patterns II

Application Architectures, Design Patterns

An Introduction to Patterns

Behavioral patterns. Command Iterator Observer Strategy Template method

Software Eningeering. Lecture 9 Design Patterns 2

Design Patterns Lecture 2

Context-Awareness and Adaptation in Distributed Event-Based Systems

Applying Design Patterns to SCA Implementations

Architectural Styles I

Object Oriented Paradigm

ADVANCED SOFTWARE DESIGN LECTURE 4 SOFTWARE ARCHITECTURE

Architectural Patterns

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

Design Patterns. Architectural Patterns. Contents of a Design Pattern. Dr. James A. Bednar. Dr. David Robertson

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

A few important patterns and their connections

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

P2: Collaborations. CSE 335, Spring 2009

Design Patterns IV Structural Design Patterns, 1

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

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

Appendix A - Glossary(of OO software term s)

The Adapter Pattern. Interface with anything!

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

Design Patterns. Dr. Rania Khairy. Software Engineering and Development Tool

As a programmer, you know how easy it can be to get lost in the details

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

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

Design Patterns in Python (Part 2)

Architectural Design. Architectural Design. Software Architecture. Architectural Models

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions)

Software Architecture

Facade and Adapter. Comp-303 : Programming Techniques Lecture 19. Alexandre Denault Computer Science McGill University Winter 2004

Tuesday, October 4. Announcements

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

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

Design Patterns and Frameworks Command

2.1 Design Patterns and Architecture (continued)

Design Patterns Revisited

Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions

Work groups meeting 3

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

Database Applications

Programming II (CS300)

Using Design Patterns in Java Application Development

Goals of Lecture. Lecture 27: OO Design Patterns. Pattern Resources. Design Patterns. Cover OO Design Patterns. Pattern Languages of Programming

Object-Oriented Design

Object Oriented. Analysis and Design

CS342: Software Design. November 21, 2017

What is Design Patterns?

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


Exam in TDDB84: Design Patterns,

Distribution and Integration Technologies

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

Object-oriented Software Design Patterns

Software Design COSC 4353/6353 D R. R A J S I N G H

Transcription:

Fitness for Future of Design Patterns & Architectural Styles Design patterns are difficult to teach, so we conducted a class collaboration where we all researched and reported on a variety of design patterns and architectural styles. We want to have a sheet where given a problem where specific things need to be changed, we can find which pattern we should use. Summary of Design Patterns Design Pattern Future? Description Singleton No Restricts the instantiation of a class to a single object or a finite set of objects. What is it about? Single global point of access to a single or finite set of objects Controlled instantiation of a single or finite set of objects Creational Adapter Yes Translates on interface for a class (adaptee) into a compatible interface (adaptor). The adapter - switch different adapters in and out for different functionality The adaptee pre-existing code doesn t change Bridge Yes Decouples an abstraction from an implementation so the two can vary independently. Refined abstractions and concrete implementations Abstraction and abstract implementation classes Example Structural Window is abstraction, Frame is refined abstraction Linux and Windows Window/Frame are Implementers/Concrete Implementers, respectively Window and Frame abstraction can vary independently of Windows and Linux Window and Frame implementations (e.g. new version of Windows: Windows Window/Frame implementations change, new feature of GUI toolkit: Window and Frame abstraction change) Composite No Allow uniform treatment of individual objects and compositions of those objects. What is it about? Used for iterating through tree structures composed of heterogeneous

components (e.g. hierarchy) Useful for avoiding having to deal with the difference between branch and leaf nodes Designed for fitness for purpose over future Difficult to add new functionality to components since it must be added to each existing class New classes can be easily added as long as they conform to current interface Examples Parse tree (below) File system Organizational hierarchy Facade Yes Provide a simplified interface to a larger body of code. Implementation of underlying code can change Interaction of classes behind the facade can change Interface of facade stays the same Functionality usually can t change Examples J2EE Web Content (Service Layer) Linux File System (System Call Interface, Virtual File System) Command Yes Encapsulates operations within reusable logic so they may be executed at a different time or on a different thread. Time and thread of execution The implementation the instance of reusable logic to be executed Examples GUI Event Loop Undo/Redo Stack Behavioural Interpreter Yes Specifies how to add functionality to a composite pattern structure. New methods on composite structure The existing composite structure Example Evaluate mathematical expression create parse tree composite structure, add method to evaluate Observer Yes Defines a one-to-many relationship so that when the state of the single object (producer) changes, all of the dependent objects (consumers) are notified.

Producer can be changed without changing the consumers (so long as message format remains the same) New consumers can be created without change to the producer Format of message sent out to consumers cannot change without changing all consumers, as well as the interface producer uses to notify consumer Strategy Yes Allows algorithm to be selected at runtime. Can add any number of algorithms as classes Interface of each class of algorithms stays the same (e.g. sorting routines all take and return a list) Visitor Yes Adds the ability to add new operations to data structures without changing the structures themselves. Can add as many new visitors as you like Can change the operations performed the visitor Interface of the underlying data structures The structures themselves

Summary of Architectural Styles Architectural Style Future? Description Pipes n Filters Yes Allows components to be arranged so that the output of each element is the input of the next. Reuse/reorder pipes and filters in new arrangements Add and remove pipes and filters to aid between converstion of input/output format or to add new functionality Need to make sure the input stream is in the format expected Individual pipes and filters typically do not change Layered/Hierarchical Yes Abstracts different portions of functionality into separate layers that build on top of each other. The implementation of a layer can change so long as the interface is held constant When a layer changes, only the layers above and below it must change Relative ordering of each layer not changed easily (e.g. OS memory management usually below networking layer) Repository No Provides a centralized data store, with many components. What is it about? Two types of components: o Datastore holds and represents the system state/data o Data-use components components that operate on the central datastore Type main classifications of repository o Database streams of transactions trigger processes to act on datastore o Blackboard current state/state changes trigger processes Implicit Invocation Yes Allows components to listen and react to events. It allows for easier adding of functionality in the form of a separate component due to low coupling between components, and the only form of communication being indirect New components can be added to the bus at will, provided they adhere to the event format on said bus Harder to change the way that data is represented in an event itself, since data is possibly used by large number of heterogeneous components which rely on a particular event structure

Questions 1. You are designing a web framework that allows for pre-packaged components for common features provided by web applications, such as session management, CSRF checking, authentication, etc., as well as allowing developers to write their own components. You want to allow these components to be used together to build web applications quickly, while providing the flexibility for allowing developers to add their own components when necessary. a. What architectural style would you use to build this web framework? Using Pipes and Filters would be a suitable approach for this kind of framework. b. What advantages does this architectural style give you with regards to fitness for future? Each component is independent of other components; the only commonality between all of them is the data they operate on (i.e. the request, along with any database resources in response to that request). This allows components to be dropped in as needed in the future. c. What design pattern would go well with this architectural style in implementing the framework? How does it contribute to the framework s fitness for future? Something similar to the Command pattern would suit this design well by encapsulating each request as an object describing the request. Each component would read this request object, perform the appropriate operations in response to it, possibly evening modifying the request itself, and then pass it off to the next component. d. Give an example of a currently existing framework that implements this paradigm. The Django framework is a Python web framework that utilizes the Web Server Gateway Interface (WSGI), which defines a universal interface between web servers/applications. In this paradigm, a WSGI application is an application that takes a request (also known as an environment) and performs operations on that environment beforereturning a response or passing it off to the next WSGI application (typically only the last WSGI application returns the response, but preceding applications that received the request first can short circuit the chain in exceptional circumstances). This design is admittedly not a perfect example of pipes and filters, but it is easy to see where the advantages of pipes and filters were taken into consideration when designing the Django framework. 2. You are designing a real-time notifications platform for the new social network Google+. One of the uses will be to support a feature where if one user comments on a photo while another is viewing, that comment appears immediately in the viewing user s browser. However, you expect the new social network will acquire many features requiring this framework over the next year. a. Which design pattern would you utilize when designing this platform at a high level? The Observer pattern works well in this situation, as we can think of any viewing users as consumers and the server as the producer (since it is the first entity to be made aware of the new comment).

b. What is a potential problem you might face if you were to open up this platform to third-party developers? A significant issue to consider with the Observer pattern is the possibility of changing the message format/interface used to notify consumers of events. If third-party developers start developing their applications to use V1 of the notifications platform, and for some reason you have to change the format, all of these applications will break. Thus you will need to version your platform so that existing applications don t break, while still providing a way for you to innovate your platform for use by new clients created by third-party developers.