Jump to content

Talk:Proxy pattern

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SineBot (talk | contribs) at 14:09, 13 April 2012 (Signing comment by 78.105.136.120 - "Diagram arrows incorrect?: new section"). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconJava Start‑class Low‑importance
WikiProject iconThis article is within the scope of WikiProject Java, a collaborative effort to improve the coverage of Java on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.
Note icon
This article has been automatically rated by a bot or other tool because one or more other projects use this class. Please ensure the assessment is correct before removing the |auto= parameter.
WikiProject iconComputing Start‑class Low‑importance
WikiProject iconThis article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.
WikiProject iconComputer science Start‑class Mid‑importance
WikiProject iconThis article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
MidThis article has been rated as Mid-importance on the project's importance scale.
Things you can help WikiProject Computer science with:

proxy

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

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]

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?

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)