CSE 403 Lecture 14 Design Patterns. Today’s educational objective Understand the basics of design patterns Be able to distinguish them from design approaches.

Slides:



Advertisements
Similar presentations
Welcome to. Who am I? A better way to code Design Patterns ???  What are design patterns?  How many are there?  How do I use them?  When do I use.
Advertisements

Lecture 9 Design Patterns CSCI – 3350 Software Engineering II Fall 2014 Bill Pine.
18-1 Verifying Object Behavior and Collaboration Role playing – the act of simulating object behavior and collaboration by acting out an object’s behaviors.
CS590L - Lecture 6 1 CS590L Distributed Component Architecture References: - E. Gamma, R. Helm, R. Johnson, J. Vlissides, Design Patterns: Elements of.
Patterns Reusable solutions to common object-oriented programming problems When given a programming problem, re-use an existing solution. Gang of Four.
05/26/2004www.indyjug.net1 Indy Java User’s Group June Knowledge Services, Inc.
(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.
GoF: Document Editor Example
Design Patterns CS is not simply about programming
GoF: Document Editor Example A Case Study.
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.
Software Design and Documentation Individual Presentation: Composite Pattern 9/11/03.
(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.
The Composite Pattern.. Composite Pattern Intent –Compose objects into tree structures to represent part-whole hierarchies. –Composite lets clients treat.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
GoF Sections 2.7 – 2.9 More Fun with Lexi. Lexi Document Editor Lexi tasks discussed:  Document structure  Formatting  Embellishing the user interface.
Katie C. O’Shea Dennis T. Tillman 11 February 2K2 Flyweight.
(c) 2010 University of California, Irvine – André van der Hoek1July 16, 2015 – 13:45:31 Informatics 122 Software Design II Lecture 8 Nick Lopez Duplication.
樣式導向設計 (Pattern-Oriented Design) 課程簡介 Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering.
Patterns 1 Patterns in OO - history 77 - Work of the architect Christopher Alexander 80s - Kent Beck playing with Smalltalk 91 - Gamma’s PhD thesis on.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
Design a Document Editor Oksana Protsyk Yaroslav Kaplunskiy.
CSSE 374: Introduction to Gang of Four Design Patterns
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
CSSE 374: 3½ Gang of Four Design Patterns These slides derived from Steve Chenoweth, Shawn Bohner, Curt Clifton, and others involved in delivering 374.
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
Powerpoint Templates Page 1 Powerpoint Templates What is Design Patterns ? by Indriati Teknik Informatika – UB.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 27. Review UML dynamic view – State Diagrams.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
DESIGN PATTERNS CSC532 Adv. Topics in Software Engineering Shirin A. Lakhani.
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.
GoF: Document Editor Example Rebecca Miller-Webster.
CSE 403, Spring 2008, Alverson Software Design “There are two ways of constructing a software design: one way is to make it so simple that there are obviously.
Testing Extensible Design Patterns in OO Frameworks through Scenario Templates D.S. Sanders Software Verification & Validation.
Methods: Deciding What to Design In-Young Ko iko.AT. icu.ac.kr Information and Communications University (ICU) iko.AT. icu.ac.kr Fall 2005 ICE0575 Lecture.
ECE450S – Software Engineering II
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
1 Design Patterns Object-Oriented Design. 2 Design Patterns 4Reuse of design knowledge and experience 4Common in many engineering disciplines 4Avoids.
Creational Patterns
What to know for the exam. Smalltalk will be used for questions, but there will not be questions about the grammar. Questions might ask – how particular.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
CS616: Software Engineering Spring 2009 Design Patterns Sami Taha.
Design Patterns. 1 Paradigm4 Concepts 9 Principles23 Patterns.
Design Patterns Introduction
CS251 – Software Engineering Lectures 18: Intro to DP Slides by Rick Mercer, Christian Ratliff, Oscar Nierstrasz and others 1 و ابتغ فيما آتاك الله الدار.
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
The Object-Oriented Thought Process Chapter 15
Chapter 10 Design Patterns.
樣式導向設計 (Pattern-Oriented Design) 課程簡介
Chapter 5:Design Patterns
Software Design Patterns
MPCS – Advanced java Programming
Introduction to Design Patterns
Design Patterns Lecture part 2.
Introduction to Design Patterns
Design Patterns (cont.) and Coding
object oriented Principles of software design
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
WARNING These slides are not optimized for printing or exam preparation. These are for lecture delivery only. These slides are made for PowerPoint 2010.
Software Engineering Lecture 7 - Design Patterns
Design Patterns A Case Study: Designing a Document Editor
Informatics 122 Software Design II
CSE 403 Software Design.
DESIGN PATTERNS : Introduction
Informatics 122 Software Design II
Chapter 8, Design Patterns Introduction
Presentation transcript:

CSE 403 Lecture 14 Design Patterns

Today’s educational objective Understand the basics of design patterns Be able to distinguish them from design approaches such as information hiding and layering Be able to find patterns that meet specific needs Know what the Gang of Four is

Experts vs. Novices Experience Higher level thought Chunking Idioms Techniques Examples

Examples of expertise Chess playing Experts view pieces in groups Mathematics Integration by trigonometric substitution Programming for (int i = 0; i < n; i++) a[i] = b[i];

Design patterns in Architecture Alexander: "Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to the problem. In such a way that you can use this solution a million times over, without ever doing it the same way twice."

Design Pattern Pattern name: Strip mall. Problem: Make small commercial establishments and franchises accessible to car driving customers. Solution: Parking area with store fronts facing parking. Uniform construction. Consequences: Traffic flow, congestion, parking availability, building rents.

Gang of Four Gamma, Helm, Johnson, Vlissides Catalog of design patterns for software

Case study Lexi Editor (Calder) Document structure Formatting Embellishing UI Multiple look and feel standards Multiple window systems User operations Spelling checking and hyphenation

Document structure Characters, pictures, lines, words, paragraphs, columns, tables,... Represent uniformly Recursive solution Glyph – display object

Composite pattern Intent Tree structures Structure

Composite Pattern Participants Component (Graphic) Leaf Composite Client

Composite Pattern Consequences Simple client Easy to extend Runtime check required to restrict components

Composite Pattern Implementation issues Explicit parent references Sharing components Child ordering Responsibility for deletion (in non-GC language)

Document structure An object allocated for every character! Solution (trick, hack) Table of character objects Reference into the table

Flyweight pattern

Formatting Break text into lines Approach – insert row glyphs to break text into lines Want to allow different algorithms for formatting Compositor class – formatting algorithm Composition glyph has a compositor Compositor is responsible for formatting children

Strategy pattern Context, strategy pair Specific algorithms subclass strategy ConcreteStrategy

UI Embellishment Add border or scrollbar to component MonoGlyph extends Glyph Border extends MonoGlyph ScrollBar extends MonoGlyph Decorator Pattern

Multiple look and feel standards Motif menus, Mac menus GuiFactory guiFactory = new MotifFactory(); ScrollBar sb = guiFactory.CreateScrollBar(); Button bu = guiFactory.CreateButton(); Abstract Factory Pattern

Supporting Multiple Window Systems Window Class Hierarchy WindowImp Class Hierarchy Extend WindowImp for each different system Avoid polluting Window Class with system dependencies Bridge Pattern Link between Window and WindowImp

User commands and spell check/hyphenation User commands Command Pattern Includes Undo functionality Spell check and hyphenation Iterate over words of document Iterator Pattern and Visitor pattern

Classification of patterns Creational Abstract factory, builder, factory method, prototype, singleton Structural Adapter, bridge, composite, decorator, façade, flyweight, proxy Behavioral Chain of responsibility, command, interpreter, iterator, mediator, memento, observer, state, strategy, template method, visitor Original GoF patterns