CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.

Slides:



Advertisements
Similar presentations
The Bridge Pattern.. Intent Decouple an abstraction from its implementation so that the two can vary independently Also known as: Handle/Body.
Advertisements

Design Patterns A brief introduction to what they are, why they are useful, and some examples of those that are commonly used.
(c) 2009 University of California, Irvine – André van der Hoek1June 13, 2015 – 21:42:16 Informatics 122 Software Design II Lecture 8 André van der Hoek.
Dept. of Computer Engineering, Amirkabir University of Tech. 1 Design Patterns Dr. Noorhosseini Introduction.
BehavioralCmpE196G1 Behavioral Patterns Chain of Responsibility (requests through a chain of candidates) Command (encapsulates a request) Interpreter (grammar.
Design Patterns CS is not simply about programming
Design Patterns. What are design patterns? A general reusable solution to a commonly occurring problem. A description or template for how to solve a problem.
DESIGN PATTERNS Redesigning Applications And
Dept. of Computer Engineering, Amir-Kabir University 1 Design Patterns Dr. Noorhosseini Lecture 2.
(c) 2010 University of California, Irvine – André van der Hoek1June 29, 2015 – 08:55:05 Informatics 122 Software Design II Lecture 8 André van der Hoek.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
Reuse Activities Selecting Design Patterns and Components
Basic Design Patterns 1. Introduction Gabriel Mañana Ed. 453 Of. 120 Ext
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VI Composite, Iterator, and Visitor Patterns.
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
Creational Patterns Making Objects The Smart Way Brent Ramerth Abstract Factory, Builder.
Vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Idioms and Patterns polymorphism -- inheritance and delegation idioms -- realizing.
Design Patterns Discussion of pages: xi-11 Sections: Preface, Forward, Chapter
Design Patterns Alan Shalloway, James Trott, Design Patterns Explained, Addison-Wesley, Gamma, Helm, Johnson, Vlissides, Design Patterns, Elements.
BDP Behavioral Pattern. BDP-2 Behavioral Patters Concerned with algorithms & assignment of responsibilities Patterns of Communication between Objects.
Design Patterns.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
Case Studies on Design Patterns Design Refinements Examples.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 27. Review UML dynamic view – State Diagrams.
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns IX Interpreter, Mediator, Template Method recap.
GoF Sections Design Problems and Design Patterns.
18 April 2005CSci 210 Spring Design Patterns 1 CSci 210.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
Design Patterns CS 124 Reference: Gamma et al (“Gang-of-4”), Design Patterns.
Structural Design Patterns
ECE450S – Software Engineering II
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns IV Structural Patterns.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VIII Chain of Responsibility, Strategy, State.
DESIGN PATTERNS Sanjeeb Kumar Nanda 30-Aug What is a pattern? Pattern is a recurring solution to a standard problem Each Pattern describes a problem.
Behavioural Design Patterns Quote du jour: ECE450S – Software Engineering II I have not failed. I've just found 10,000 ways that won't work. - Thomas Edison.
DESIGN PATTERNS COMMONLY USED PATTERNS What is a design pattern ? Defining certain rules to tackle a particular kind of problem in software development.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Copyright © Active Frameworks Inc. - All Rights Reserved - V2.0Design Pattern Catalog - Page L3-1 PS95&96-MEF-L10-1 Dr. M.E. Fayad Creationa.
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
Behavioral Patterns1 Nour El Kadri SEG 3202 Software Design and Architecture Notes based on U of T Design Patterns class.
Design Patterns Introduction
BEHAVIORAL PATTERNS 13-Sep-2012 Presenters Sanjeeb Kumar Nanda & Shankar Gogada.
Design Patterns Introduction “Patterns are discovered, not invented” Richard Helm.
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
Chapter 8 Object Design Reuse and Patterns. More Patterns Abstract Factory: Provide manufacturer independence Builder: Hide a complex creation process.
Five Minute Design Patterns Doug Marttila Forest and the Trees May 30, 2009 Template Factory Singleton Iterator Adapter Façade Observer Command Strategy.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Design Patterns: MORE Examples
Design Patterns: Brief Examples
Design Patterns Spring 2017.
Design Patterns A brief introduction to what they are, why they are useful, and some examples of those that are commonly used.
Chapter 10 Design Patterns.
Chapter 5:Design Patterns
Software Design Patterns
MPCS – Advanced java Programming
Design Patterns Lecture part 2.
Factory Patterns 1.
Introduction to Design Patterns
Behavioral Design Patterns
object oriented Principles of software design
9/21/2018 Sima Emadi.
DESIGN PATTERNS B.TECH IV YR II SEMESTER(TERM 08-09)
Design Patterns Satya Puvvada Satya Puvvada.
Software Engineering Lecture 7 - Design Patterns
Informatics 122 Software Design II
Informatics 122 Software Design II
Chapter 8, Design Patterns Introduction
Presentation transcript:

CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym

WHAT IS A DESIGN PATTERN ? The design patterns are descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context.

DESIGN PATTERNS UNDER MVC

DESCRIBING DESIGN PATTERNS Pattern Name and Classification Structure Participants Collaborations Consequences Implementation Intent Also Known As Motivation Applicability

TWO CRITERIA CLASSIFICATION

TABLE OF PATTERNS

PURPOSE Purpose reflects what a pattern does. Patterns can have either creational, structural, or behavioral purpose. Creational patterns concern the process of object creation. Structural patterns deal with the composition of classes or objects. Behavioral patterns characterize the ways in which classes or objects interact and distribute responsibility.

SCOPE Scope specifies whether the pattern applies primarily to classes or to objects. Class patterns deal with relationships between classes and their subclasses. These relationships are established through inheritance, so they are static — fixed at compile-time. Object patterns deal with object relationships, which can be changed at run-time and are more dynamic.

PATTERNS RELATIONSHIPS

EVEN MORE CLASSIFICATION

DETERMINING OBJECT GRANULARITY Objects can vary tremendously in size and number. They can represent everything down to the hardware or all the way up to entire applications. How do we decide what should be an object? Facade – represents complete subsystems as objects. Flyweight – describes how to support huge numbers of objects at the finest granularities. Abstract Factory, Builder yield objects whose only responsibilities are creating other objects. Visitor, Command yield objects whose only responsibilities are to implement a request on another object or group of objects.

SPECIFYING OBJECT INTERFACES Design patterns help define interfaces by identifying their key elements and the kinds of data that get sent across an interface. A design pattern might also tell you what not to put in the interface. Memento describes how to encapsulate and save the internal state of an object so that the object can be restored to that state later. Design patterns also specify relationships between interfaces. Decorator, Proxy require the interfaces of their objects to be identical to the decorated and proxied objects. Visitor interface must reflect all classes of objects that visitors can visit.

CLASS VERSUS INTERFACE INHERITANCE Class inheritance defines an object's implementation in terms of another object's implementation. Interface inheritance (or subtyping) describes when an object can be used in place of another. Chain of Responsibility must have a common type, but usually they don't share a common implementation. In the Composite pattern, Component defines a common interface, but Composite often defines a common implementation. Command, Observer, State, and Strategy are often implemented with abstract classes that are pure interfaces.

PROGRAM TO AN INTERFACE, NOT AN IMPLEMENTATION. There are two benefits to manipulating objects solely in terms of the interface defined by abstract classes: Clients remain unaware of the specific types of objects they use, as long as the objects adhere to the interface that clients expect. Clients remain unaware of the classes that implement these objects. Clients only know about the abstract class(es) defining the interface. By abstracting the process of object creation, Creational patterns give you different ways to associate an interface with its implementation transparently at instantiation. Creational patterns ensure that your system is written in terms of interfaces, not implementations.

FAVOR OBJECT COMPOSITION OVER CLASS INHERITANCE. Favoring object composition over class inheritance helps you keep each class encapsulated and focused on one task. Your classes and class hierarchies will remain small and will be less likely to grow into unmanageable monsters. On the other hand, a design based on object composition will have more objects (if fewer classes), and the system's behavior will depend on their interrelationships instead of being defined in one class.

DELEGATION In delegation, two objects are involved in handling a request: a receiving object delegates operations to its delegate. The main advantage of delegation is that it makes it easy to compose behaviors at run-time and to change the way they're composed. Delegation works best when it's used in highly stylized ways—that is, in standard patterns. The State, Strategy, Visitor patterns depend on it. Delegation is an extreme example of object composition. It shows that you can always replace inheritance with object composition as a mechanism for code reuse.

PARAMETERIZED TYPES Parameterized types give us a third way to compose behavior in object- oriented systems. Parameterized types let you change the types that a class can use. But neither inheritance nor parameterized types can change at run-time. Which approach is best depends on your design and implementation constraints. None of the patterns concerns parameterized types.

REDESIGNING FOR CHANGE

CREATING AN OBJECT BY SPECIFYING A CLASS EXPLICITLY Specifying a class name when you create an object commits you to a particular implementation instead of a particular interface. This commitment can complicate future changes. To avoid it, create objects indirectly. Design patterns: Abstract Factory, Factory Method, Prototype.

DEPENDENCE ON SPECIFIC OPERATIONS When you specify a particular operation, you commit to one way of satisfying a request. By avoiding hard-coded requests, you make it easier to change the way a request gets satisfied both at compile-time and at run-time. Design patterns: Chain of Responsibility, Command

DEPENDENCE ON HARDWARE AND SOFTWARE PLATFORM External operating system interfaces and application programming interfaces (APIs) are different on different hardware and software platforms. Software that depends on a particular platform will be harder to port to other platforms. It may even be difficult to keep it up to date on its native platform. It's important therefore to design your system to limit its platform dependencies. Design patterns: Abstract Factory, Bridge.

DEPENDENCE ON OBJECT REPRESENTATIONS OR IMPLEMENTATIONS Clients that know how an object is represented, stored, located, or implemented might need to be changed when the object changes. Hiding this information from clients keeps changes from cascading. Design patterns: Abstract Factory, Bridge, Memento, Proxy

ALGORITHMIC DEPENDENCIES Algorithms are often extended, optimized, and replaced during development and reuse. Objects that depend on an algorithm will have to change when the algorithm changes. Therefore algorithms that are likely to change should be isolated. Design patterns: Builder, Iterator, Strategy, Template Method, Visitor.

TIGHT COUPLING Tight coupling leads to monolithic systems, where you can't change or remove a class without understanding and changing many other classes. The system becomes a dense mass that's hard to learn, port, and maintain. Loose coupling increases the probability that a class can be reused by itself and that a system can be learned, ported, modified, and extended more easily. Design patterns: Abstract Factory, Bridge, Chain of Responsibility, Command, Facade, Mediator, Observer.

EXTENDING FUNCTIONALITY BY SUBCLASSING Every new class has a fixed implementation overhead (initialization, finalization, etc.). Defining a subclass also requires an in-depth understanding of the parent class. An overridden operation might be required to call an inherited operation. And subclassing can lead to an explosion of classes, because you might have to introduce many new subclasses for even a simple extension. Design patterns: Bridge, Chain of Responsibility, Composite, Decorator, Observer, Strategy.

INABILITY TO ALTER CLASSES CONVENIENTLY Sometimes you have to modify a class that can't be modified conveniently. Perhaps you need the source code and don't have it (as may be the case with a commercial class library). Or maybe any change would require modifying lots of existing subclasses. Design patterns offer ways to modify classes in such circumstances. Design patterns: Adapter, Decorator, Visitor.

PATTERNS VERSUS FRAMEWORKS A framework is a set of cooperating classes that make up a reusable design for a specific class of software. 1.Design patterns are more abstract than frameworks 2.Design patterns are smaller architectural elements than frameworks 3.Design patterns are less specialized than frameworks