E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Huang-Ming Huang, Shih-Ling Chen, Sajeeva Pallemulle.

Slides:



Advertisements
Similar presentations
Design Patterns.
Advertisements

General OO Concepts and Principles CSE301 University of Sunderland Harry R. Erwin, PhD.
SWE 4743 Strategy Patterns Richard Gesick. CSE Strategy Pattern the strategy pattern (also known as the policy pattern) is a software design.
Chapter 6: Using Design Patterns
Design Patterns. CS351 - Software Engineering (AY2007)Slide 2 Behavioral patterns Suppose we have an aggregate data structure and we wish to access the.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Design Patterns.
The Composite Pattern.. Composite Pattern Intent –Compose objects into tree structures to represent part-whole hierarchies. –Composite lets clients treat.
Design Pattern – Bridge (Structural) References Yih-shoung Chen, Department of Information Engineering, Feng Chia University,Taiwan, R.O.C. The Bridge.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VI Composite, Iterator, and Visitor Patterns.
CERN – European Organization for Nuclear Research GS Department – Administrative Information Services Design Patterns in Groovy Nicolas Décrevel Advanced.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Idioms and Patterns polymorphism -- inheritance and delegation idioms -- realizing.
Dependency Injection and Model-View-Controller. Overview Inversion of Control Model-View-Controller.
Behavioral Patterns  Behavioral patterns are patterns whose purpose is to facilitate the work of algorithmic calculations and communication between classes.
Singleton Christopher Chiaverini Software Design & Documentation September 18, 2003.
Design Patterns.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
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.
CS 325: Software Engineering March 17, 2015 Applying Patterns (Part A) The Façade Pattern The Adapter Pattern Interfaces & Implementations The Strategy.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 6: Using Design Patterns 1.
Abstract Factory Design Pattern making abstract things.
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Guandong Wang, Zhenning Hu, Zhenghui Xie Department of.
Pattern Hatching - John Vlissides Pages 85 – 101 Todd Anderson
Proactor Pattern Venkita Subramonian & Christopher Gill
1 Computer Science 340 Software Design & Testing Inheritance.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Chris Gill Department of Computer Science and Engineering Washington University in St. Louis.
Architectural pattern: Interceptor Source: POSA II pp 109 – 140POSA II Environment: developing frameworks that can be extended transparently Recurring.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 6: Using Design Patterns.
Design Patterns Gang Qian Department of Computer Science University of Central Oklahoma.
GoF: Document Editor Example Rebecca Miller-Webster.
ECE450S – Software Engineering II
OO Methodology Elaboration Iteration 2 - Design Patterns -
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
CSE 332: Design Patterns Review: Design Pattern Structure A design pattern has a name –So when someone says “Adapter” you know what they mean –So you can.
Inheritance Revisited Other Issues. Multiple Inheritance Also called combination--not permitted in Java, but is used in C++ Also called combination--not.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 6: Using Design Patterns.
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
Design Patterns Introduction
1 Chapter 5:Design Patterns. 2 What are design pattern?  Schematic description of design solution to recurring problems in software design and,  Reusable.
Interceptor CS562 Spring 2002 Jan Anand Krishnan Morgan Deters Venkita Subramonian.
The Strategy Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Ying Huang, Marc Sentany Department of Computer Science.
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.
S.Ducasse Stéphane Ducasse 1 Decorator.
The Decorator Pattern (Structural) ©SoftMoore ConsultingSlide 1.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
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.
Facade Pattern Jim Fawcett CSE776 – Design Patterns Summer 2010
Introduction to Generic Programming in C++
Design Patterns: MORE Examples
Sections Inheritance and Abstract Classes
Abstract Factory Pattern
Chapter 5:Design Patterns
Conception OBJET GRASP Patterns
Software Engineering Fall 2005
Facade Pattern Jim Fawcett CSE776 – Design Patterns Summer 2010
object oriented Principles of software design
Abstract Factory Pattern
Informatics 122 Software Design II
Object Oriented Design Patterns - Structural Patterns
Decorator Pattern Richard Gesick.
Structural Patterns: Adapter and Bridge
Informatics 122 Software Design II
Presentation transcript:

E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Huang-Ming Huang, Shih-Ling Chen, Sajeeva Pallemulle Department of Computer Science and Engineering Washington University, St. Louis Extension Interface Pattern

Handle/Body Idiom (Bridge Pattern) ACE_Reactor ACE_Reactor_Impl ACE_Select_Reactor_ImplACE_WFMO_Reactor_Impl pImpl – Pointer to Implementation class A_Impl; class A { public: void foo() private: A_Impl *pImpl; }; #include “A.h” #include “A_Impl.h” A::A() { pImpl = new A_Impl; } A::foo() { } A.h A.cpp Client code does not have to be recompiled even if A_Impl.h changes

Limitation: Interface Changes Does pImpl help with interface changes? class A_Impl; class A { public: void foo() private: A_Impl *pImpl; }; A.h class A_Impl; class A { public: void foo(); void bar(); private: A_Impl *pImpl; }; Answer - No

Extending Functionality Add methods to the existing interfaces –Pros: Simple, most languages support this –Cons: Bloated interfaces Client recompilation class A { public: void foo(); void bar(); }; class A { public: void foo(); };

Extending Functionality (continued) Multiple inheritance of new interfaces –Pros: Well known “mixin” approach (also class form of Adapter pattern) Flexible –Cons: Proliferation of subclasses with lots of roles Versioning is difficult class A2 { public: void bar(); }; class A_Impl : public A, public A2 { }; class A { public: void foo(); }; class A_Impl : public A { };

Extending Functionality (continued) Decorator –Pros: Run-time extensibility –Cons: Client must explicitly track different interfaces Visitor –Pros: Flexible addition of new roles –Cons: Hard to attach new state to component, add components Need fixed component class hierarchy

Intent of the Extension Interface Pattern Extending or Modifying the functionality of a component. –Allows multiple interfaces to be exported by a component Each corresponds to a role the component plays –Prevents bloating of interfaces Roles are at least partly disjoint Common case: each role narrower than union of roles –Prevents breaking existing client code Allows versioning of interfaces Component Interface1 Interface2 Interface3

Design Forces Do not break existing client code –Backward compatibility –Behavioral consistency –No client recompilation required Minimize changes to existing component code Location, language, etc. transparency

Solution Separate interfaces by roles Clients use role-appropriate interfaces Must support at least one interface –Always have access to a “root” interface All provided interfaces are accessible –Can iterate through interfaces dynamically Export new interfaces by addition to set –Without changing existing ones

Structure Client Component Factory create() find() Root Interface getExtension() Extension Interface service() Component service() > * Play different roles. Provide extension interfaces Return initial interface to component factory Defines a meta-interface - functionality each interface must support Accesses factories to create components. Uses extension interfaces to access component functionality Implement interfaces for creating components. (optional) also, interfaces for locating components Defines a concrete interface for a particular role. Also gives access to root capabilities.

Versioning Variant (COM Approach) Published interface cannot be changed. –Once published, an interface is a contract –Add new interface instead of changing existing one Aggregation is used to emulate inheritance –An object can offer the interfaces of base object

Dynamics : Client : Factory CreateInstance(Ext.Intf. 1) new Ref. To Extension1 create service_1 QueryInterface(Extension Interface 2) Ref. To Extension2 : Component : Extension 1 : Extension 2

Design Considerations Benefits –Extensibility –Separation of concerns –Polymorphism –Decoupling of components and their clients –Support for interface aggregation and delegation Liabilities –Increased component design and implementation effort –Increased client programming complexity –Additional indirection and run-time overhead

Known uses Microsoft’s COM/COM+ CORBA 3 OpenDoc Administrator dashboards –For example consider lab 3 assignment –Instead of interacting only with Producer, user (or administrator) could interact with any Producer, Director, or Player –Could dynamically query and collect interfaces and then tie them into producer- like menu-based interfaces

Related Paradigms Subject-Oriented Programming (SOP) oriented_programming Aspect-Oriented Programming (AOP) oriented_programming