- Java EE 8 Design Patterns and Best Practices
- Rhuan Rocha Jo?o Purifica??o
- 251字
- 2021-07-23 16:54:51
Explaining Proxy
Sometimes, creating a new object can be a big process and several rules can be involved in creating this object. Imagine that we want to create a list of objects, and these objects represent telecommunication equipment, which has a lot of calculus to generate the information of each object. As well as this, these objects will not be accessed at the same time but will be accessed on demand. A good strategy is to create each object when it is accessed, thereby minimizing the cost and time it takes to create all objects and only access some. The Proxy can help us to solve this.
The Proxy pattern is a pattern that surrogates an object instance (original object) to another object instance (Proxy object) that permitting access control to the original object. In the following diagram, you can see the structure of Proxy and how it is designed:

From the preceding diagram, we can see a structure of the Proxy pattern. If Subject is an interface that clients use to access object operations, then RealSubject is the class of the original object and Proxy is the class that works as a Proxy. Then, when the client accesses the object, they will access the Proxy object, and the Proxy object will then access the RealSubject object and return this object to the client.
This pattern is used in frameworks and APIs that implement JPA specification and object relational mapping (ORM).
- Mastering vRealize Operations Manager(Second Edition)
- Learning OpenDaylight
- PLC控制程序精編108例
- 大學計算機應用基礎實踐教程(Windows 7+Office 2013)
- PLC控制系統應用與維護
- 混沌工程:復雜系統韌性實現之道
- Linux使用和管理指南:從云原生到可觀測性
- Joomla! 3 Template Essentials
- OpenStack系統架構設計實戰
- RHCSARHCE 紅帽Linux認證學習指南(第7版)EX200 & EX300
- Python UNIX和Linux系統管理指南
- Raspberry Pi入門指南
- 應急指揮信息系統設計
- Windows網絡編程(第2版)
- 大規模Linux集群架構最佳實踐:如何管理上千臺服務器