the proxy design pattern in Java is using everywhere ,but only a handful of people know it. Hibernate for lazy loading entity.Spring for AOP proxy.
the definiton of proxy design:allow object level access control by acting as a pass though entity.it means when at running time ,proxy object can control the behavior of the real object.there are several proxy type:
1 virtual proxy.this proxy can delay the creation and initialization of the exepensive objects when on demands.like image proxy system.as we know ,the high resolution images occupy much momory,if we load all images at runtime,it is wastful.using virtual proxy,we can have access conrol of the object, just load selected images.
let us take a look at the following features:
a) the high resolution images load only when need,
b) if method is not called,it will never need to load images,so images will not occupy memory.it save a lot of memory ,and improve performance to a great extent
2 remote proxy: the local represention of the remote objects ,like RMI, when in a JVM a object need to communicate with another object in another JVM,we use stub ,the proxy of the remote objects,the stub is charging of call remote objects.