Software Design and Architecture Muhammad Nasir Structural Design Patterns

Slides:



Advertisements
Similar presentations
Design Patterns.
Advertisements

What Are Design Patterns and Why Do I Need Them? Software professionals may be familiar with the term "Design Patterns," but many have no idea of where.
Design Patterns based on book of Gang of Four (GoF) Erich Gamma, Richard Helm, Ralph Johnson, and John VlissidesGang of Four (GoF) Elements of Reusable.
Observer Method 1. References Gamma Erich, Helm Richard, “Design Patterns: Elements of Reusable Object- Oriented Software” 2.
Reza Gorgan Mohammadi AmirKabir University of Technology, Department of Computer Engineering & Information Technology Advanced design.
Design and Programming Patterns Associated with Java Networking by Margaret Toews cs843, Spring 2003.
Proxy Pattern Ralph Rodkey Josh Voils. Proxy Intent  Metsker and GoF:  To provide a surrogate, or placeholder, for another object to control access.
Copyright © Active Frameworks Inc. - All Rights Reserved - V2.0More on Structural Patterns - Page L7-1 PS95&96-MEF-L14-1 Dr. M.E. Fayad Creationa.
Design Patterns: Proxy Jason Jacob. What is a Proxy? A Proxy is basically a representative between the Client and the Component. It gives the Client a.
Design Patterns Part IV (TIC++V2:C10) Yingcai Xiao 10/01/08.
Algorithm Programming Structural Design Patterns Bar-Ilan University תשס " ו by Moshe Fresko.
Software Design and Documentation Individual Presentation: Composite Pattern 9/11/03.
PROXY Matt Burden T-Kiang Tan Proxy (prok-se): An agent or substitute authorized to act for another SourceSource: Webster's Revised Unabridged Dictionary,
The Composite Pattern.. Composite Pattern Intent –Compose objects into tree structures to represent part-whole hierarchies. –Composite lets clients treat.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (1) –A structural design pattern.
Proxy Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
Client/Server Software Architectures Yonglei Tao.
Smart Reference Proxy Provides additional actions whenever an object is referenced (e.g., counting the number of references to the object) Firewall Proxy.
1 The Proxy Design Pattern Problem: Defer the cost of object creation and init. until actually used Applicability (possible contexts): – Virtual Proxy:
Team 5: The Infinite Loops Gloria Berumen Patricia Martinez Jose Roberto Salcido Michelle Soto Jose Luis Yanez Omar Zorrilla Design Pattern.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Patterns and Reuse. Patterns Reuse of Analysis and Design.
In the name of Allah The Proxy Pattern Elham moazzen.
Object Oriented Software Engineering Chapter 16 and 17 review 2014/06/03.
Computer Science 209 The Proxy Pattern. Delayed Instantiation if (obj == null) obj = It ’ s expensive to load an image If the user never looks at an image,
Structural Design Patterns
More Design Patterns Horstmann ch.10.1,10.4. Design patterns Structural design patterns –Adapter –Composite –Decorator –Proxy Behavioral design patterns.
Where Do Surrogates Fit into This Proxy Pattern Observer Pattern Visitor Pattern By Kurt Rehwinkel.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns V More Structural Patterns.
02 - Structural Design Patterns – 2 Moshe Fresko Bar-Ilan University תשס"ח 2008.
Design Patterns Structural Patterns. Adapter Convert the interface of a class into another interface clients expect Adapter lets classes work together.
The Proxy Pattern SE-2811 Dr. Mark L. Hornick 1. The Proxy Pattern has many variations, but in general: The Proxy Pattern uses an proxy object as a surrogate.
Proxy, Observer, Symbolic Links Rebecca Chernoff.
08 - StructuralCSC4071 Structural Patterns concerned with how classes and objects are composed to form larger structures –Adapter interface converter Bridge.
Structural Patterns1 Nour El Kadri SEG 3202 Software Design and Architecture Notes based on U of T Design Patterns class.
Proxy.
Proxy Design Pattern By:Diksha Agarwal.
CS616: Software Engineering Spring 2009 Design Patterns Sami Taha.
1 Advanced Object-oriented Design – Principles and Patterns Structural Design Patterns.
Proxy Pattern defined The Proxy Pattern provides a surrogate or placeholder for another object to control access to it by creating a representative object.
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.
Proxy Pattern. What’s a Proxy? A remote proxy acts as a local representative of a remote object Remote Object: instantiated in a different JVM heap (a.
The Proxy Pattern (Structural) ©SoftMoore ConsultingSlide 1.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Broker Design Patterns: Adapters and Proxy.
Week 9, Day 1 Proxy SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1.
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Facade Pattern Jim Fawcett CSE776 – Design Patterns Summer 2010
Software Design Patterns
Design Patterns Lecture part 2.
Dynamic Proxy Proxy: Addition to the Java 1.3 reflection package:
Software Design and Architecture
Software Design and Architecture
Software Design and Architecture
Decorator Design Pattern
More Design Patterns 1.
Design Patterns Satya Puvvada Satya Puvvada.
More Design Patterns 1.
Frameworks And Patterns
Informatics 122 Software Design II
Structural Patterns: Adapter and Bridge
Informatics 122 Software Design II
Software Design Lecture : 38.
15. Proxy SE2811 Software Component Design
Proxy Pattern Definition of “Proxy”: Authority or power to act for another Original Gang of Four pattern, much used Stands in for a “real object” (similar.
Adapter Pattern Jim Fawcett
Software Design Lecture 10.
Adapter Pattern Jim Fawcett
Presentation transcript:

Software Design and Architecture Muhammad Nasir Structural Design Patterns

Proxy Intent Provide a surrogate or placeholder for another object to control access to it. Also Known As Surrogate

Proxy Motivation  A proxy is a person authorized to act for another person an agent or substitute the authority to act for another  There are situations in which a client does not or can not reference an object directly, but wants to still interact with the object.  A proxy object can act as the intermediary between the client and the target object.

Proxy Example  Consider a document editor that can embed graphical objects in a document.  Some graphical objects, like large images, can be expensive to create. But opening a document should be fast.  so we should avoid creating all the expensive objects at once when the document is opened.  These constraints would suggest creating each expensive object on demand, which in this case occurs when an image becomes visible.

Proxy Problem  But what do we put in the document in place of the image?  And how can we hide the fact that the image is created on demand so that we don't complicate the editor's implementation?

Proxy Solution  The solution is to use another object, an image proxy, that acts as a stand-in for the real image.  The proxy acts just like the image and takes care of instantiating it when it's required.

Proxy Structure

Proxy Structure (Class Diagram)

Proxy Structure (Object)

Proxy Applicability Proxies are useful wherever there is a need for a more sophisticated reference to a object than a simple pointer or simple reference can provide. Remote Proxy - Provides a reference to an object located in a different address space on the same or different machine. Virtual Proxy - Allows the creation of a memory intensive object on demand. The object will not be created until it is really needed (image proxy example).

Proxy Protection (Access) Proxy - Provides different clients with different levels of access to a target object. Cache Proxy - Provides temporary storage of the results of expensive target operations so that multiple clients can share the results. Firewall Proxy - Protects targets from bad clients (or vice versa). Smart Reference Proxy - Provides additional actions whenever a target object is referenced such as counting the number of references to the object.

Proxy Participants  Proxy (ImageProxy) Proxy maintains a reference that lets the proxy access the real subject. Proxy controls access to the real subject and may be responsible for creating and deleting it.

Proxy  Subject (Graphic) Defines the common interface for Real- Subject and Proxy so that a Proxy can be used where the Real-Subject is expected.  Real-Subject (Image) Defines the real object that the proxy represents.

Proxy Collaboration Proxy forwards requests to Real-Subject when appropriate, depending on the kind of proxy.

Proxy Consequences  A remote proxy can hide the fact that an object resides in a different address space.  A virtual proxy can perform optimizations such as creating an object on demand.  Proxies can perform additional housekeeping tasks when an object is accessed

Proxy Sample

Proxy

Relevant Patterns Adapter and Decorator are two relevant patterns

The End Thanks for Listening Questions would be appreciated.