Content deleted Content added
remove copyright content copied from http://www.javier8a.com/itc/bd1/articulo.pdf |
m →External links: HTTP to HTTPS for SourceForge |
||
(9 intermediate revisions by 7 users not shown) | |||
Line 1:
{{short description|Software design pattern}}
In [[computer programming]], the '''proxy pattern''' is a [[software design pattern]]. A ''proxy'', in its most general form, is a class functioning as an interface to something else. The proxy could interface to anything: a network connection, a large object in memory, a file, or some other resource that is expensive or impossible to duplicate. In short, a proxy is a wrapper or agent object that is being called by the client to access the real serving object behind the scenes. Use of the proxy can simply be [[Forwarding (object-oriented programming)|forwarding]] to the real object, or can provide additional logic. In the proxy, extra functionality can be provided, for example caching when operations on the real object are resource intensive, or checking preconditions before operations on the real object are invoked. For the client, usage of a proxy object is similar to using the real object, because both implement the same interface.
Line 8 ⟶ 9:
that describe how to solve recurring design problems to design flexible and reusable object-oriented software, that is, objects that are easier to implement, change, test, and reuse.
===What problems can the Proxy design pattern solve?
Source:<ref>{{cite web|title=The Proxy design pattern - Problem, Solution, and Applicability|url=http://w3sdesign.com/?gr=s07&ugr=proble|website=w3sDesign.com|access-date=2017-08-12}}</ref> * The access to an object should be controlled.
* Additional functionality should be provided when accessing an object.
Line 18 ⟶ 19:
Define a separate <code>Proxy</code> object that
* can be used as a substitute for another object (<code>Subject</code>), and
* implements additional functionality to control the access to this subject.
This makes it possible to work through a <code>Proxy</code> object to perform additional functionality when accessing a subject
To act as a substitute for a subject, a proxy must implement the <code>Subject</code> interface. Clients can't tell whether they work with a subject or its proxy.
See also the UML class and sequence diagram below.
Line 72:
{{Commons category}}
* {{cite web |last1=Geary |first1=David |date=2002-02-22 |df=mdy |url=https://www.infoworld.com/article/2074068/take-control-with-the-proxy-design-pattern.html |title=Take control with the Proxy design pattern |work=[[JavaWorld]] |access-date=2020-07-20}}
* [
* {{webarchive |url=https://web.archive.org/web/20120311202925/http://www.netobjectives.com/PatternRepository/index.php?title=AdapterVersusProxyVersusFacadePatternComparison |title=Adapter vs. Proxy vs. Facade Pattern Comparison}}
* [https://sourcemaking.com/design_patterns/proxy Proxy Design Pattern]
|