Software Engineering and Architecture Pattern Catalog Proxy Proxy
- Slides: 13
Software Engineering and Architecture Pattern Catalog: Proxy
Proxy • A web page contains a lot of images, many of which will never be displayed as they are ‘at the end of the scroll’ where the average user do not see at all. Can we avoid downloading them? – Same for a Word document etc. • Loading from disk also takes time… • Download on demand – i. e. only when they become visible
3 -1 -2
In-Front-Object • Web. Page loads a proxy with the filename of the image – Same interface as Real. Image, but load method does not load anything, just remembers the name of the file – When show() method is invoked then the image is loaded Web. Page Proxy. Image Real. Image CS@AU Henrik Bærbak Christensen 4
Dynamics Note: As no ‘show()’, no image is ever loaded
The load() method is slow Simulating the ‘slow loading’ algorithm Webpage calls load() for all images so wait time is long!
The Proxy defers the load! Now load() is not called until ‘show()’ is called! Images that are never shown are never loaded!
Demo
Another Example • In a short while Hot. Civ will go graphical and distributed… • Issue: Painting the world – Equals 256 x ‘game. get. Tile(p)’ to render… • Issue 2: Distribution over network – Equals 256 remote calls to server… • Observation: Tiles do not change! – I. e. we work hard to get same data as last time… Stupid, right? • Solution: Caching – Caching: Keep a local copy of data on the client, and use that CS@AU Henrik Bærbak Christensen 9
The Proxy Pattern • Caching is an obvious Proxy Pattern behavior Wrap Game in a proxy Only call, if cache is cold CS@AU Henrik Bærbak Christensen 10
Proxy
Consequences • Benefits – Supports all types of access control: deferred access, pay-by-access, access logging (audit trail), access control, … – Decouples domain behavior and access control behavior (potential for reuse) – Is the core technology in remote method invocation The • Java RMI • . Net Remoting book And in SWEA Broker… says ‘logg ing’
Decorator Versus Proxy • The look very alike! – Indeed I almost always code Decorators without the abstract class shown in the UML for Decorator • Thus it looks structurally much more like proxy • But they look at different things – Decorator looks at the object itself (looking inside) • Adding behaviour to the object itself – Proxy looks at the user of the object (looking outside) • Monitoring/controlling who is using the object
- Return architecture
- Data centered architecture
- Ibm software access catalog
- Service broker pattern
- Design patterns software engineering
- Blackboard design pattern
- Architectural pattern in software engineering
- Halstead software metrics example
- Architecture business cycle
- Repository architecture in software engineering
- System architecture example
- Forward engineering and reverse engineering
- Software maintenance in software engineering ppt
- Frank maurer