- 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).
- Windows Vista基礎與應用精品教程
- 玩到極致 iPhone 4S完全攻略
- Linux網(wǎng)絡內(nèi)核分析與開發(fā)
- Windows Vista融會貫通
- Windows 7中文版從入門到精通(修訂版)
- 無蘋果不生活 The New iPad隨身寶典
- 從零開始學安裝與重裝系統(tǒng)
- 完美應用Ubuntu(第2版)
- Windows 8完全自學手冊
- 電腦辦公(Windows 7+Office 2016)入門與提高
- Linux指令從初學到精通
- Windows 8玩全不求人
- 電腦辦公(Windows10+Office2016)從新手到高手
- SAP后勤模塊實施攻略:SAP在生產(chǎn)、采購、銷售、物流中的應用
- 電子商務系統(tǒng)建設與管理