Design Patterns References: Xiaoping Jia, Object-Oriented Software Development Using Java;Douglas C.Schmidt, Design Pattern Case Studies with C++

Slides:



Advertisements
Similar presentations
Design Patterns.
Advertisements

Chapter 3 Data Modeling Copyright © 2014 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent.
Design Patterns Section 7.1 (JIA’s) Section (till page 259) (JIA’s) Section 7.2.2(JIA’s) Section (JIA’s)
CS590L - Lecture 6 1 CS590L Distributed Component Architecture References: - E. Gamma, R. Helm, R. Johnson, J. Vlissides, Design Patterns: Elements of.
COP 3331 Object Oriented Analysis and Design Chapter 7 – Design by Abastraction Jean Muhammad.
OOP Design Patterns Chapters Design Patterns The main idea behind design patterns is to extract the high level interactions between objects and.
Plab – Tirgul 12 Design Patterns
Design Patterns Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
. Plab – Tirgul 12 Design Patterns. Design Patterns u The De-Facto Book on Design Patterns:
Design and Programming Patterns Associated with Java Networking by Margaret Toews cs843, Spring 2003.
Spring 2010CS 2251 Design Patterns. Spring 2010CS 2252 What is a Design Pattern? "a general reusable solution to a commonly occurring problem in software.
Software Engineering I Object-Oriented Design Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Design Patterns.
ECE 355 Design Patterns Tutorial Part 2 (based on slides by Ali Razavi) Presented by Igor Ivković
Design Patterns Ref : Chapter 15 Bennett et al. useful groups of collaborating classes that provide a solution to commonly occuring problems. provide.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design 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.
Şabloane de Proiectare Daniel POP, Ph.D. 2 The Plan Introducing fundamental patterns (today) 18 design patterns will be covered based on the case study.
Data Access Patterns. Motivation Most software systems require persistent data (i.e. data that persists between program executions). In general, distributing.
Introduction to software design patterns For CSE 3902 By: Matt Boggus.
Design Patterns Trends and Case Study John Hurst June 2005.
UML Unified Modeling Language. What is UML? Unified Modeling Language (UML) is a standardized, general-purpose modeling language in the field of software.
Design Patterns.
Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
CIT241 Prerequisite Knowledge ◦ Variables ◦ Operators ◦ C++ Syntax ◦ Program Structure ◦ Classes  Basic Structure of a class  Concept of Data Hiding.
Design Dan Fleck CS 421 George Mason University. What is the design phase? Analysis phase describes what the system should do Analysis has provided a.
Design patterns. What is a design pattern? Christopher Alexander: «The pattern describes a problem which again and again occurs in the work, as well as.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Creational Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Patterns in programming 1. What are patterns? “A design pattern is a general, reusable solution to a commonly occurring problem in software. A design.
A Reference Model for Event Patterns Christian Silberbauer
Y2 eProjects Session 4 – Advanced Topics. Objectives  Dynamic Models  Design Patterns (Optional)  Software testing (for S4) ACCP i7.1\Sem3_4\eProject\T4.
Object-Oriented Design Principles and Patterns. © 2005, James R. Vallino2 How Do You Design? What principles guide you when you create a design? What.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
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.
Design Principle & Patterns by A.Surasit Samaisut Copyrights : All Rights Reserved.
ECE450S – Software Engineering II
Patterns in programming1. 2 What are patterns? Answers to common design problems. A language used by developers –To discuss answers to design problems.
05/26/2004www.indyjug.net1 Indy Java User’s Group May Knowledge Services, Inc.
Design Patterns Yonglei Tao. Design Patterns  A design pattern describes a recurring design problem, a solution, and the context in which that solution.
CSC 480 Software Engineering Design With Patterns.
12 Chapter 12: Advanced Topics in Object-Oriented Design Systems Analysis and Design in a Changing World, 3 rd Edition.
Design Patterns Introduction
Java Design Patterns Java Design Patterns. What are design patterns? the best solution for a recurring problem a technique for making code more flexible.
1 Chapter 5:Design Patterns. 2 What are design pattern?  Schematic description of design solution to recurring problems in software design and,  Reusable.
CS251 – Software Engineering Lectures 18: Intro to DP Slides by Rick Mercer, Christian Ratliff, Oscar Nierstrasz and others 1 و ابتغ فيما آتاك الله الدار.
Advanced Object-oriented Design Patterns Creational Design Patterns.
The Strategy Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Duke CPS Programming Heuristics l Identify the aspects of your application that vary and separate them from what stays the same ä Take what varies.
1 Good Object-Oriented Design Dr. Radu Marinescu Lecture 4 Introduction to Design Patterns.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Examples (D. Schmidt et al)
GRASP – Designing Objects with Responsibilities
Design Patterns: MORE Examples
Strategy: A Behavioral Design Pattern
Design Patterns: Brief Examples
Strategy Design Pattern
Software Design Patterns
Design Patterns Introduction
Presented by Igor Ivković
Software Engineering Lecture 7 - Design Patterns
Web Programming Language
Beta Release Retrospective
Patterns.
DESIGNING YOUR SYSTEM.
Introduction to Design Patterns
Presented by Igor Ivković
Presentation transcript:

Design Patterns References: Xiaoping Jia, Object-Oriented Software Development Using Java;Douglas C.Schmidt, Design Pattern Case Studies with C++

Design Patterns Generic (reusable) solutions to a recurring problem Evolved from Christopher Alexander’s patterns for architecture. “Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice.” – Alexander et. al., A Pattern Language (Oxford U.Press,1977)

Design Patterns–a ‘Hot Topic’ OOPSLA Workshops – 17% Patterns for Software Architecture Killer Examples for Design Patterns & Objects First Patterns in Distributed Real Time & Embedded Systems Patterns for Customer Interaction & Expectation Management Software Development Process Patterns

Design Patterns–a ‘Hot Topic’ OOPSLA Tutorials – 20% Pattern-oriented Software Architectures for Networked and Concurrent Applications Patterns of Enterprise Application Architecture Patterns at Work Patterns for Writing Effective Use Cases Dungeons and Patterns! Patterns and Application Experiences for Real-time Object Request Brokers Refactoring to Patterns Object-oriented Reengineering: Patterns & Techniques Patterns for EJB Development How to Use Design Patterns in Java and .NET

Design Patterns Categories of Software Design Patterns Creational : deal with process of creation Structural : deal with static composition and structure of classes and objects Behavioral : deal with dynamic interaction among classes and objects

Design Patterns Each pattern is described as follows: Pattern name Category : creational, structural or behavioral Intent : short description of problem addressed AKA: other names for the pattern Applicability : where pattern can be applied Structure : diagram that describes participants in the pattern & relationships among them Participants : list of classes and/or objects that participate in the pattern

Singleton Pattern Category: creational Intent: ensure that a class has only one instance and provide global point of access to it Applicability: use where there must be exactly one instance of a class and it must be accessible to clients from a well-known access point (e.g. database)

Singleton Pattern Structure Singleton static getInstance() operation() getData() static Singleton theInstance data return theInstance

Singleton Pattern Participants : only one Singleton declares the unique instance of the class as a static variable and defines a static method getInstance() for clients to access the unique instance.

Singleton Pattern public class Singleton { public static Singleton getInstance() { return theInstance; } private Singleton() { //initialize instance fields //…. private static Singleton theInstance = new Singleton();

Strategy Pattern Category : behavioral Intent: define a family of algorithms, encapsulate each one and make them interchangeable

Strategy Pattern Applicability: use when many related classes differ only in behavior plotting different functions different variations of algorithm are needed sorts an algorithm uses data that clients should not know about LayoutManager in the AWT a class defines many behaviors which appear as multiple conditional statements in its methods

Structure of Strategy Pattern Context contextInterface() Strategy algorithmInterface() Concrete Strategy A algorithmInterface() Concrete Strategy C algorithmInterface() Concrete Strategy B algorithmInterface() Note: arrowheads should be unfilled

Using the Strategy Pattern Pivot Strategy getPivot() quicksort pivotStrategy.getPivot(array,lo,hi) Random Median of Three Select First Concrete Strategies Strategy pattern resolves how to extend policies for selecting a pivot value without modifying main quicksort algorithm

A tutorial presented by Steve Metsker and William Wake Dungeons & Patterns A tutorial presented by Steve Metsker and William Wake At OOPSLA 2001

Why Design Patterns? Patterns record previous successes in a reusable form Design patterns are well-worn solutions to problems at about a class level

How the Game Works Each table has a pattern master who has a map of a dungeon You must adventure through the dungeon to reclaim pearls of wisdom from a dragon Your primary helper is an Ahobbit With capricious magical abilities

Ahobbits Your Ahobbit has a magical ring that Cannot be removed You can activate by getting him/her to say “Aha” Ahobbits are enlightened only when they understand a design pattern Ahobbits learn from real-world examples in the dungeon

Adventuring Find a room in the dungeon When you enter Examine the device or contents therein Determine which pattern it shows Use the device to explain to your Ahobbit the intent of the pattern (2 guesses) When the Ahobbit says “Aha,” something magical will occur

Beginning We shall begin as one huge exploration party Before breaking into one party per table or group You stand before a door that leads to the dungeon What do you do?