CS 350 – Software Design Principles and Strategies – Chapter 14

Slides:



Advertisements
Similar presentations
CS 350 – Software Design The Bridge Pattern – Chapter 10 Most powerful pattern so far. Gang of Four Definition: Decouple an abstraction from its implementation.
Advertisements

The Bridge Pattern.. Intent Decouple an abstraction from its implementation so that the two can vary independently Also known as: Handle/Body.
More about classes and objects Classes in Visual Basic.NET.
Design Patterns Based on Design Patterns. Elements of Reusable Object-Oriented Software. by E.Gamma, R. Helm, R. Johnson,J. Vlissides.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
Prototype Creational Design Pattern By Brian Cavanaugh September 22, 2003 Software, Design and Documentation.
Chapter 22 Object-Oriented Design
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
CERN – European Organization for Nuclear Research GS Department – Administrative Information Services Design Patterns in Groovy Nicolas Décrevel Advanced.
What Is a Factory Pattern?.  Factories are classes that create or construct something.  In the case of object-oriented code languages, factories construct.
Design Patterns Standardized Recurring model Fits in many location Opposite of customization Fundamental types of pattern Choose and use as desired and.
Design Patterns.
Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 1 Virtual Functions Polymorphism Abstract base classes.
CS 4240: Bridge and Abstract Factory Readings:  Chap. 10 and 11 Readings:  Chap. 10 and 11.
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 The Object Paradigm – Chapter 1 If you were tasked to write code to access a description of shapes that were stored in a database.
The Factory Patterns SE-2811 Dr. Mark L. Hornick 1.
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.
CS 210 Adapter Pattern October 19 th, Adapters in real life Page 236 – Head First Design Patterns.
Refactoring for Testability (or how I learned to stop worrying and love failing tests) Presented by Aaron Evans.
Week 2, Day 2: The Factory Method Pattern Other good design principles Cohesion vs. Coupling Implementing the Strategy Pattern Changing strategies (behaviors)
CS 160: Software Engineering October 22 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
SE-2811 Software Component Design Week 1, Day 2 (and 1-3 and 2-1) SE-2811 Dr. Josiah Yoder Slide style: Dr. Hornick 1.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
CS 350 – Software Design Expanding Our Horizons – Chapter 8 The traditional view of objects is that they are data with methods. Sometimes objects could.
The Strategy Pattern SE-2811 Dr. Mark L. Hornick 1.
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.
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
More Design Patterns From: Shalloway & Trott, Design Patterns Explained, 2 nd ed.
Design Patterns SE464 Derek Rayside images from NetObjectives.com & Wikipedia.
CS 4240: Rethinking Some OOP Ideas and Terms for OOA&D Readings: Chap. 8 in Shalloway and Trott (referred to as S&T in these slides) Wikipedia on information.
Review of Parnas’ Criteria for Decomposing Systems into Modules Zheng Wang, Yuan Zhang Michigan State University 04/19/2002.
Example to motivate discussion We have two lists (of menu items) one implemented using ArrayList and another using Arrays. How does one work with these.
Watching the movie the hard way…. Page 256 – Head First Design Patterns.
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
CS 5150 Software Engineering Lecture 16 Program Design 3.
Multi Dimensional Variance: How to make ultra flexible software!
Chapter Ten The Bridge Pattern Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
CS 350 – Software Design The Adapter Pattern – Chapter 7 Gang of Four Definition: Convert the interface of a class into another interface that the client.
An object's behavior depends on its current state. Operations have large, multipart conditional statements that depend on the object's state.
Inheritance a subclass extends the functionality of a superclass a subclass inherits all the functionality of a superclass don't reinvent the wheel – "stand.
Unit II-Chapter No. : 5- design Patterns
Object-Oriented Programming Concepts
Chapter 10 Design Patterns.
Chapter 5:Design Patterns
MPCS – Advanced java Programming
Introduction to Design Patterns
Chapter 9 - Programming to Interfaces
Object-Orientated Programming
object oriented Principles of software design
Strategy Design Pattern
Software Engineering Lecture 7 - Design Patterns
SE-2811 Software Component Design
OBJECT ORIENTED PROGRAMMING II LECTURE 8 GEORGE KOUTSOGIANNAKIS
What’s changed in the Shibboleth 1.2 Origin
lecture 08, OO Design Principle
Object Oriented Design Patterns - Structural Patterns
Decorator Pattern Richard Gesick.
Interfaces.
CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 A proposition behind design patterns is that quality of software systems can be.
Software Design Lecture : 14.
Object Oriented Practices
Polymorphism Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition, by Kernighan.
SE-2811 Software Component Design
Context Objects Evolution of object behavior Behavioral patterns
Lecture 8 Evolution of object behavior Behavioral patterns
CS 151: Object-Oriented Design October 8 Class Meeting
Software Engineering and Architecture
Presentation transcript:

CS 350 – Software Design Principles and Strategies – Chapter 14 The Open-Closed Principle Modules, methods, and classes should be open for extension, but closed for modification. In other words, design your software so you can extend its capabilities without changing what’s previously been written. i.e. The bridge allows us to extend that capabilities of a system by added new graphic systems, while not modifying the existing code. Technically, except for the factory or constructor that calls the new functionality. In practice this goal is hard to achieve, but striving for it will help with good design.

CS 350 – Software Design Principles and Strategies – Chapter 14 Design from Context Bridge pattern is a good example. Shapes in the case study use the graphic system implementations What are the requirements of the shapes? They need to be able to draw lines, circles, etc. The shapes define the needs of the drawing programs.

CS 350 – Software Design Principles and Strategies – Chapter 14 Look at the Abstract Factory You have four choices of implementation Using derived classes (Create a derivation for each set. Cumbersome, but little modification. Using a single object with switches (requires the factory to be modified a lot) Using a configuration file with switches (More flexible, but modifications still required) Use a configuration file with dynamic class loading – instantiates a class based on the name of the object in a string. Flexible because new classes and combinations can be added without modifying code. How do you pick a method? The likelihood of future variation The importance of not modifying the existing system Who controls the sets of objects to be created (us or another development group) The language being used The availability of a database or config file.

CS 350 – Software Design Principles and Strategies – Chapter 14 The principle of Encapsulating Variation A good goal is to never have a class contain two issues that are varying unless these variations are explicitly coupled to each other. Otherwise when one item varies, it is coupled to the other and you have a maintenance problem. The Bridge pattern is an excellent example of encapsulating variation. The abstract factory is another example. There are many ways to implement it. If you change your mind on how to implement it, the applications using the factory do not change, since they programmed to the factory’s public interface. The adapter encapsulates variations of interfaces so they can be used by a common interface. The author presents the case that the Façade sort of encapsulates variation, but I think he is just trying to make it fit his concepts. It really isn’t encapsulation of variation as much as a simplified interface that you could then code to.