The intent of the proxy-pattern is to provide a placeholder for another object to control access to it. One reason for controlling access to an object is to defer the full cost of its creation and initialization until we actually need to use it.
- A remote proxy is responsible for encoding a request and its arguments and for sending (and retrieving) the request (and the response) to the real object.
- A virtual proxy may cache additional information about the real subject so that it can postpone the access to it.
- A protection proxy checks whether the caller has sufficient access permissions for perform a request.
The goal is to abstract and encapsulate all access to the data and provide an interface.
Use a Data Access Object when:
- you need to access a persistent storage more than one time, especially if you want to exchange the data source later.
- you want to separate a data resource's client interface from its data access mechanisms
- you want to adapt a specific data resource's access API to a generic client interface
- in a larger project, different teams work on different parts of the application: the DAO pattern allows clean separation of concerns.
Most Object-Oriented languages have great flexibility at the method call level through polymorphism. At the creation side however, you have to say new X() where X is a specific type.
Use a Factory Method when
- a class can't anticipate the class of objects it must create.
- a class wants its subclasses to specify the objects it creates.
- classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate.
The aim of the Observer-Pattern is to define a one-to-many dependency between objects so that when the object on the "one-side" changes state, all its dependents are notified and updated automatically.
Most common other names for this pattern are
- Producer/Consumer
- Publish/Subscribe
- Dependents
https://et.wikipedia.org/wiki/R%C3%A4sifunktsioon //räsifunktisoon
http://best-practice-software-engineering.ifs.tuwien.ac.at/patterns/factory.html
https://www.javaworld.com/article/2076690/java-concurrency/build-your-own-objectpool-in-java-to-boost-app-speed.html //objectbool