diff --git a/notes/pics/dp-proxy.png b/notes/pics/dp-proxy.png new file mode 100644 index 00000000..14d96eb2 Binary files /dev/null and b/notes/pics/dp-proxy.png differ diff --git a/notes/设计模式 - 代理.md b/notes/设计模式 - 代理.md index 8e1b123d..bfecfed8 100644 --- a/notes/设计模式 - 代理.md +++ b/notes/设计模式 - 代理.md @@ -1,11 +1,9 @@ ## 代理(Proxy) -### Intent - +### 意图 控制对其它对象的访问。 -### Class Diagram - +### 类图 代理有以下四类: - 远程代理(Remote Proxy):控制对远程对象(不同地址空间)的访问,它负责将请求及其参数进行编码,并向不同地址空间中的对象发送已经编码的请求。 @@ -13,10 +11,9 @@ - 保护代理(Protection Proxy):按权限控制对象的访问,它负责检查调用者是否具有实现一个请求所必须的访问权限。 - 智能代理(Smart Reference):取代了简单的指针,它在访问对象时执行一些附加操作:记录对象的引用次数;当第一次引用一个对象时,将它装入内存;在访问一个实际对象前,检查是否已经锁定了它,以确保其它对象不能改变它。 -