Proxy.

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

18-1 Verifying Object Behavior and Collaboration Role playing – the act of simulating object behavior and collaboration by acting out an object’s behaviors.
C15: Design Patterns Gamma,Helm,Johnson,Vlissides (GOF)
Patterns Reusable solutions to common object-oriented programming problems When given a programming problem, re-use an existing solution. Gang of Four.
(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.
Dept. of Computer Engineering, Amirkabir University of Tech. 1 Design Patterns Dr. Noorhosseini Introduction.
Design Patterns CS is not simply about programming
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.
Design Patterns Part IV (TIC++V2:C10) Yingcai Xiao 10/01/08.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
Katie C. O’Shea Dennis T. Tillman 11 February 2K2 Flyweight.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Proxy Design Pattern (1) –A structural design pattern.
CERN – European Organization for Nuclear Research GS Department – Administrative Information Services Design Patterns in Groovy Nicolas Décrevel Advanced.
Client/Server Software Architectures Yonglei Tao.
Vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Idioms and Patterns polymorphism -- inheritance and delegation idioms -- realizing.
Software Waterfall Life Cycle Requirements Construction Design Testing Delivery and Installation Operations and Maintenance Concept Exploration Prototype.
Smart Reference Proxy Provides additional actions whenever an object is referenced (e.g., counting the number of references to the object) Firewall Proxy.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
1 The Proxy Design Pattern Problem: Defer the cost of object creation and init. until actually used Applicability (possible contexts): – Virtual Proxy:
In the name of Allah The Proxy Pattern Elham moazzen.
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.
Computing IV Singleton Pattern Xinwen Fu.
Object Oriented Software Engineering Chapter 16 and 17 review 2014/06/03.
Design Patterns Gang Qian Department of Computer Science University of Central Oklahoma.
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.
Structural Design Patterns
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
Introduction to Design Patterns. Questions What is a design pattern? Who needs design patterns? How different are classes and objects in APL compared.
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.
Design Patterns Structural Patterns. Adapter Convert the interface of a class into another interface clients expect Adapter lets classes work together.
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 Design Pattern By:Diksha Agarwal.
DESIGN PATTERNS COMMONLY USED PATTERNS What is a design pattern ? Defining certain rules to tackle a particular kind of problem in software development.
FACTORY METHOD. Design Pattern Space Purpose ScopeCreationalStructuralBehavioral ClassFactory MethodAdapterInterpreter Template Method ObjectAbstract.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
CS616: Software Engineering Spring 2009 Design Patterns Sami Taha.
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
Design Patterns. 1 Paradigm4 Concepts 9 Principles23 Patterns.
Design Patterns Introduction
Design Patterns SE464 Derek Rayside images from NetObjectives.com & Wikipedia.
Java Design Patterns Java Design Patterns. What are design patterns? the best solution for a recurring problem a technique for making code more flexible.
STRATEGY PATTERN. Design Pattern Space Purpose ScopeCreationalStructuralBehavioral ClassFactory MethodAdapterInterpreter Template Method ObjectAbstract.
Proxy Pattern defined The Proxy Pattern provides a surrogate or placeholder for another object to control access to it by creating a representative object.
The Proxy Pattern (Structural) ©SoftMoore ConsultingSlide 1.
Five Minute Design Patterns Doug Marttila Forest and the Trees May 30, 2009 Template Factory Singleton Iterator Adapter Façade Observer Command Strategy.
PROTOTYPE. Design Pattern Space Purpose ScopeCreationalStructuralBehavioral ClassFactory MethodAdapterInterpreter Template Method ObjectAbstract factory.
7 April 2004CSci 210 Spring Design Patterns 2 CSci 210.
Software Design and Architecture Muhammad Nasir Structural Design Patterns
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Chapter 10 Design Patterns.
Chapter 5:Design Patterns
MPCS – Advanced java Programming
Design Patterns Lecture part 2.
Introduction to Design Patterns
object oriented Principles of software design
WARNING These slides are not optimized for printing or exam preparation. These are for lecture delivery only. These slides are made for PowerPoint 2010.
How to be a Good Developer
Design Patterns in Game Design
Informatics 122 Software Design II
Chapter 8, Design Patterns Singleton
CIS 644 Tues. Nov. 30, 1999 W15A … patterns.
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.
Presentation transcript:

Proxy

Design Pattern Space Purpose Scope Creational Structural Behavioral Class Factory Method Adapter Interpreter Template Method Object Abstract factory Builder Prototype Singleton Adapter Bridge Composite Facade Flyweight Proxy Chain of Responsibility Command Iterator Mediator Memento State Strategy Visitor Observer

Proxy proxy n. pl prox-ies The agency for a person who acts as a substitute for another person, authority to act for another

Structure

The Pattern The proxy has the same interface as the original object Use common interface (or abstract class) for both the proxy and original object Proxy contains a reference to original object, so proxy can forward requests to the original object

Dynamics Runtime Objects

Reasons for Object Proxies Remote Proxy The actual object is on a remote machine (remote address space) Hide real details of accessing the object Used in CORBA, Java RMI

public class HelloClient { public static void main(String args[]) { try { String server = getHelloHostAddress( args); Hello proxy = (Hello) Naming.lookup( server ); String message = proxy.sayHello(); System.out.println( message ); } catch ( Exception error) { error.printStackTrace(); }

Reasons for Object Proxies Continued Virtual Proxy Creates/accesses expensive objects on demand You may wish to delay creating an expensive object until it is really accessed It may be too expensive to keep entire state of the object in memory at one time Protection Proxy Provides different objects different level of access to original object Cache Proxy (Server Proxy) Multiple local clients can share results from expensive operations: remote accesses or long computations

Reasons for Object Proxies Continued Firewall Proxy Protect local clients from outside world Synchronization Proxy Synchronize multiple accesses to real subject

Counting Proxy Delete original object when there are no references to it Prevent accidental deletion of real subject Collect usage statistics Sample use is making C++ pointer safe

Observation All the design patterns in the text are based on: programming to an interface using indirection (composition ) These two elements are used to construct communicating objects and classes that solve a general design problem in a particular context The structures of different patterns may be similar but the problem each pattern solves is different Different pattern's problems may overlay at times