Content deleted Content added
m moved Talk:Design Pattern - Proxy to Talk:Proxy pattern over redirect: req |
Tag: |
||
(21 intermediate revisions by 18 users not shown) | |||
Line 1:
{{WikiProject banner shell|class=Start|
{{WikiProject Java|auto=inherit|importance=low}}
{{WikiProject Computing|importance=Low}}
{{WikiProject Computer science|importance=mid}}
}}
==proxy==
Isn't the Firewall proxy the same as Protection proxy? no[[User:91.186.200.21|91.186.200.21]] 12:51, 11 November 2007 (UTC)
== ProxyImage code is overengineered ==
<syntaxhighlight lang="java">
import java.util.*;
class RealImage {
private String filename;
private Image image;
public RealImage(String filename) { this.filename = filename; }
public void displayImage() {
if (image == null) {
loadImageFromDisk(); // load only on demand
}
// Display image code here.
}
private void loadImageFromDisk() {
// Potentially expensive operation
// ...
// initializes image object
System.out.println("Loading "+filename);
}
}
class ProxyExample {
public static void main(String[] args) {
RealImage image1 = new RealImage("HiRes_10MB_Photo1") );
RealImage image2 = new RealImage("HiRes_10MB_Photo2") );
image1.displayImage(); // loading necessary
image2.displayImage(); // loading necessary
image2.displayImage(); // no loading necessary; already done
// the third image will never be loaded - time saved!
}
}
</syntaxhighlight>
The proxy pattern isn't needed at all!!! [[User:Diegofd|Diegofd]] ([[User talk:Diegofd|talk]]) 16:11, 16 May 2008 (UTC)
I agree, this is a bad example [[User:Sebastian]] 10.02, 11.04.2012 (GMT+1) <span style="font-size: smaller;" class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/87.79.66.31|87.79.66.31]] ([[User talk:87.79.66.31|talk]]) 08:03, 11 April 2012 (UTC)</span><!-- Template:Unsigned IP --> <!--Autosigned by SineBot-->
== Copyright violation? ==
[http://en.wikipedia.org/w/index.php?title=Proxy_pattern&diff=next&oldid=23670715 This edit] seems a copyright violation from http://userpages.umbc.edu/~tarr/dp/lectures/Proxy.pdf (4/4/2004; 69 KB) the date of pdf is set before the edit [[User:Lusum|Lusum]] ([[User talk:Lusum|talk]]) 11:23, 11 June 2008 (UTC)
== Diagram arrows incorrect? ==
I think the "extends" arrows from both RealSubject and Proxy to Subject interface should be dotted/dashed and not solid. Solid indicates "is a"/generalisation for use in sub-classing of classes or abstract classes, dotted/dashed indicates implementation/realisation of an interface. And note, you can not sub-class an interface. 14:08, 13 April 2012 (UTC) <span style="font-size: smaller;" class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/78.105.136.120|78.105.136.120]] ([[User talk:78.105.136.120|talk]]) </span><!-- Template:Unsigned IP --> <!--Autosigned by SineBot-->
== The example does not seem to demonstrate this pattern ==
This seems like more of a Lazy Initialization pattern than anything else. If it were a true Proxy, wouldn't the RealImage be defined beforehand and passed to the Proxy? The Proxy shouldn't know the filename or be able to create the RealImage. Or am I missing something? - [[User:TheSOB|TheSOB]] ([[User talk:TheSOB|talk]]) 17:54, 25 September 2013 (UTC)
== Copyright violation? ==
The usage and scenario sections are the same as http://www.dotnetexamples.com/2013/07/proxy-design-pattern.html [[Special:Contributions/217.155.35.160|217.155.35.160]] ([[User talk:217.155.35.160|talk]]) 12:01, 22 December 2014 (UTC)
|