I am currently learning the proxy pattern and have found two different implementations of it in two different books. Please see the links for patterns UML Diagrams as I cannot embed the pictures yet.
My teacher says that Pattern 1 is the correct implementation, although most of the tutorials and sources use the Pattern 2 implementation. My teacher argues that Pattern 2 is wrong because "It allows the proxy to call all public methods on the RealSubject, which makes it not really different from the adapter pattern", while Pattern 1 "enforces that the proxy only can call the functions from the interface class inside the real subject"
My questions are:
- What are the real differences between these two UML diagrams? Don't they show the same thing in essence?
- If Pattern 2 is wrong, why does the majority of sources, including books, use it to show the Proxy pattern?
Thank you for your answers.
Aucun commentaire:
Enregistrer un commentaire