Talk:Proxy pattern
![]() | This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||||||||||||||||||||||||||
|
proxy
[edit]Isn't the Firewall proxy the same as Protection proxy? no91.186.200.21 12:51, 11 November 2007 (UTC)
ProxyImage code is overengineered
[edit]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!
}
}
The proxy pattern isn't needed at all!!! Diegofd (talk) 16:11, 16 May 2008 (UTC)
I agree, this is a bad example User:Sebastian 10.02, 11.04.2012 (GMT+1) — Preceding unsigned comment added by 87.79.66.31 (talk) 08:03, 11 April 2012 (UTC)
Copyright violation?
[edit]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 Lusum (talk) 11:23, 11 June 2008 (UTC)
Diagram arrows incorrect?
[edit]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) — Preceding unsigned comment added by 78.105.136.120 (talk)
The example does not seem to demonstrate this pattern
[edit]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? - TheSOB (talk) 17:54, 25 September 2013 (UTC)
Copyright violation?
[edit]The usage and scenario sections are the same as http://www.dotnetexamples.com/2013/07/proxy-design-pattern.html 217.155.35.160 (talk) 12:01, 22 December 2014 (UTC)
- Start-Class Java articles
- Low-importance Java articles
- Automatically assessed Java articles
- WikiProject Java articles
- Start-Class Computing articles
- Low-importance Computing articles
- All Computing articles
- Start-Class Computer science articles
- Mid-importance Computer science articles
- WikiProject Computer science articles