Chapter Ten The Bridge Pattern Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.

Slides:



Advertisements
Similar presentations
Chapter 13 Graphics classes Bjarne Stroustrup
Advertisements

CS 350 – Software Design The Bridge Pattern – Chapter 10 Most powerful pattern so far. Gang of Four Definition: Decouple an abstraction from its implementation.
Chapter 14 Graph class design John Keyser’s Modifications of Slides by Bjarne Stroustrup
S.T.A.I.R.. General problem solving strategy that can be applied to a range problems.
The Bridge Pattern.. Intent Decouple an abstraction from its implementation so that the two can vary independently Also known as: Handle/Body.
More Interfaces, Dynamic Binding, and Polymorphism Kirk Scott.
More about classes and objects Classes in Visual Basic.NET.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
Automatically Extracting and Verifying Design Patterns in Java Code James Norris Ruchika Agrawal Computer Science Department Stanford University {jcn,
Marcelo Santos – OOAD-CDT309, Spring 2008, IDE-MdH 1 Object-Oriented Analysis and Design - CDT309 Period 4, Spring 2008 Object-oriented concepts.
MAHARISHI INTERNATIONAL UNIVERSITY M AHARISHI U NIVERSITY of M ANAGEMENT Engaging the Managing Intelligence of Nature.
Chapter One The Object-Oriented Paradigm Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering.
Chapter 22 Object-Oriented Design
Unit 11 Latches and Flip-Flops Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
Unit 12 Registers and Counters Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
Unit 12 Registers and Counters Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
Unit 12 Registers and Counters Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
3.7 Absolute Value Equations and Inequalities I can solve equations and inequalities involving absolute value.
Unit 11 Latches and Flip-Flops Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
Creational Patterns Making Objects The Smart Way Brent Ramerth Abstract Factory, Builder.
CS 4240: Bridge and Abstract Factory Readings:  Chap. 10 and 11 Readings:  Chap. 10 and 11.
樣式導向設計 (Pattern-Oriented Design) 課程簡介 Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering.
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.
Model-View-Controller Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
CS 325: Software Engineering March 17, 2015 Applying Patterns (Part A) The Façade Pattern The Adapter Pattern Interfaces & Implementations The Strategy.
CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 A proposition behind design patterns is that quality of software systems can be.
Chapter Five An Introduction to Design Patterns Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
CS 350 – Software Design The Strategy Pattern – Chapter 9 Changes to software, like other things in life, often focus on the immediate concerns and ignore.
DAAD project “Joint Course on OOP using Java” On Object Oriented modeling in Java (Why & How) Ana Madevska Bogdanova Institute of informatics Faculty of.
Chapter Two The UML – Unified Modeling Language Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information.
GoF Sections Design Problems and Design Patterns.
Unit 13 Analysis of Clocked Sequential Circuits Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information.
CS 160: Software Engineering October 22 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Chapter 18 The Observer Pattern Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
Software Engineering Chapter 10 Formal Specification Ku-Yaw Chang Assistant Professor Department of Computer Science and Information.
CS 350 – Software Design Expanding Our Horizons – Chapter 8 The traditional view of objects is that they are data with methods. Sometimes objects could.
Chapter 21 Design Patterns Reviewed from the New Perspective of Object-Oriented Design Ku-Yaw Chang Assistant Professor, Department.
Design Patterns. 1 Paradigm4 Concepts 9 Principles23 Patterns.
More Design Patterns From: Shalloway & Trott, Design Patterns Explained, 2 nd ed.
Menu Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
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.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Chapter Eight Expanding Our Horizons Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering.
An object's behavior depends on its current state. Operations have large, multipart conditional statements that depend on the object's state.
CS 350 – Software Design The Decorator Pattern – Chapter 17 In this chapter we expand our e-commerce case study and learn how to use the Decorator Pattern.
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
IB Computer Science Content developed by Dartford Grammar School Computer Science Department UML.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
DEVRY COMP 220 iLab 7 Polymorphism Lab Report and Source Code Check this A+ tutorial guideline at
Unit II-Chapter No. : 5- design Patterns
Chapter 10 Design Patterns.
Chapter Six The Facade Pattern
Introduction to Design Patterns
CS 350 – Software Design The Strategy Pattern – Chapter 9
Chapter Nine The Strategy Pattern
CMPE 135: Object-Oriented Analysis and Design October 24 Class Meeting
More Interfaces, Dynamic Binding, and Polymorphism
object oriented Principles of software design
Informatics 122 Software Design II
CS 350 – Software Design A Standard Object-Oriented Solution – Chapter 4 Before studying design patterns, many programmers solve a problem by starting.
Ms Munawar Khatoon IV Year I Sem Computer Science Engineering
CS 350 – Software Design Principles and Strategies – Chapter 14
CMPE 135 Object-Oriented Analysis and Design March 21 Class Meeting
Overview of Programming Paradigms
Informatics 122 Software Design II
Object Oriented Design & Analysis
The Object Paradigm Classes – Templates for creating objects
Presentation transcript:

Chapter Ten The Bridge Pattern Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University

2Ku-Yaw ChangThe Bridge Pattern Outline Overview Introducing the Bridge Pattern Learning the Bridge Pattern: An Example An Observation About Using Design Patterns Learning the Bridge Pattern: Deriving It Field Notes: Using the Bridge Pattern Summary

3Ku-Yaw ChangThe Bridge Pattern Overview Provides an example to help you derive the Bridge pattern. Presents the key features of the pattern. Presents some observations on the Bridge pattern from my own practice

4Ku-Yaw ChangThe Bridge Pattern Outline Overview Introducing the Bridge Pattern Learning the Bridge Pattern: An Example An Observation About Using Design Patterns Learning the Bridge Pattern: Deriving It Field Notes: Using the Bridge Pattern Summary

5Ku-Yaw ChangThe Bridge Pattern Introducing the Bridge Pattern Intent To decouple an abstraction from its implementation so that the two can vary independently. To decouple an abstraction from its implementation so that the two can vary independently.

6Ku-Yaw ChangThe Bridge Pattern Outline Overview Introducing the Bridge Pattern Learning the Bridge Pattern: An Example An Observation About Using Design Patterns Learning the Bridge Pattern: Deriving It Field Notes: Using the Bridge Pattern Summary

7Ku-Yaw ChangThe Bridge Pattern Learning the Bridge Pattern: An Example A simple problem Drawing shapes Drawing shapesRectangles Different drawing programs Different drawing programs

8Ku-Yaw ChangThe Bridge Pattern Learning the Bridge Pattern: An Example Proper use of inheritance We don’t want the code that draws the rectangles to worry about what type of drawing program it should use. We don’t want the code that draws the rectangles to worry about what type of drawing program it should use. V1Rectangle uses DP1 V2Rectangle uses DP2 Changing requirements: add a new shape - circle Changing requirements: add a new shape - circle

9Ku-Yaw ChangThe Bridge Pattern Learning the Bridge Pattern: An Example Design with inheritance

10Ku-Yaw ChangThe Bridge Pattern Learning the Bridge Pattern: An Example Sequence diagram

11Ku-Yaw ChangThe Bridge Pattern Learning the Bridge Pattern: An Example Combinatorial explosion Another new drawing program Another new drawing program Six different kinds of Shapes 2 Shape concepts times three drawing programs 2 Shape concepts times three drawing programs Another type of Shape Another type of Shape Nine different kinds of Shapes 3 Shape concepts times three drawing programs 3 Shape concepts times three drawing programs

12Ku-Yaw ChangThe Bridge Pattern Learning the Bridge Pattern: An Example Reason Tightly coupled Tightly coupled The abstraction ( the kinds of Shapes ) and the implementation ( the drawing programs)

13Ku-Yaw ChangThe Bridge Pattern Learning the Bridge Pattern: An Example The Bridge pattern To decouple an abstraction from its implementation so that the two can vary independently To decouple an abstraction from its implementation so that the two can vary independently Abstraction 1 Implementation A Abstraction 2 Implementation B Abstraction 3 Implementation C...…

14Ku-Yaw ChangThe Bridge Pattern Outline Overview Introducing the Bridge Pattern Learning the Bridge Pattern: An Example An Observation About Using Design Patterns Learning the Bridge Pattern: Deriving It Field Notes: Using the Bridge Pattern Summary

15Ku-Yaw ChangThe Bridge Pattern An Observation About Using Design Patterns A new way to look at design patterns Focus on the context of the pattern – the problem it is trying to solve Focus on the context of the pattern – the problem it is trying to solve Not on the solutions the patterns offer The bridge pattern An abstraction that has different implementations An abstraction that has different implementations Allow the abstraction and the implementation to vary independently of each other Allow the abstraction and the implementation to vary independently of each other

16Ku-Yaw ChangThe Bridge Pattern Outline Overview Introducing the Bridge Pattern Learning the Bridge Pattern: An Example An Observation About Using Design Patterns Learning the Bridge Pattern: Deriving It Field Notes: Using the Bridge Pattern Summary

17Ku-Yaw ChangThe Bridge Pattern Learning the Bridge Pattern: Deriving It A new paradigm for finding objects Commonality Commonality Variability Variability Strategies to handle variation Find what varies and encapsulate it Find what varies and encapsulate it Favor aggregation over inheritance Favor aggregation over inheritance

18Ku-Yaw ChangThe Bridge Pattern Learning the Bridge Pattern: Deriving It Represent the variations

19Ku-Yaw ChangThe Bridge Pattern Learning the Bridge Pattern: Deriving It Tying the classes together What uses what? What uses what?

20Ku-Yaw ChangThe Bridge Pattern Learning the Bridge Pattern: Deriving It Expanding the design

21Ku-Yaw ChangThe Bridge Pattern Separation of abstraction and implementation

22Ku-Yaw ChangThe Bridge Pattern Outline Overview Introducing the Bridge Pattern Learning the Bridge Pattern: An Example An Observation About Using Design Patterns Learning the Bridge Pattern: Deriving It Field Notes: Using the Bridge Pattern Summary

23Ku-Yaw ChangThe Bridge Pattern Field Notes: Using the Bridge Pattern The Bridge pattern often incorporates the Adapter pattern Compound design patterns Compound design patterns Instantiating the objects of the Bridge pattern The objects representing the abstraction were given their implementation while being instantiated. The objects representing the abstraction were given their implementation while being instantiated.

24Ku-Yaw ChangThe Bridge Pattern Field Notes: Using the Bridge Pattern Generic structure of the Bridge pattern

25Ku-Yaw ChangThe Bridge Pattern Outline Overview Introducing the Bridge Pattern Learning the Bridge Pattern: An Example An Observation About Using Design Patterns Learning the Bridge Pattern: Deriving It Field Notes: Using the Bridge Pattern Summary

26Ku-Yaw ChangThe Bridge Pattern Summary Basic strategies for dealing with variation: Find what varies and encapsulate it. Find what varies and encapsulate it. Favor aggregation over inheritance. Favor aggregation over inheritance. More effective in picking patterns that will help you Understand whys and whats of the patterns Understand whys and whats of the patterns

The End