Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Talk:Proxy pattern

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 11 years ago by 217.155.35.160 in topic Copyright violation?

proxy

[edit]

Isn't the Firewall proxy the same as Protection proxy? no91.186.200.21 12:51, 11 November 2007 (UTC)Reply

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)Reply

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)Reply

[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)Reply

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)Reply

[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)Reply