Saturday, May 17, 2014

Virtual Proxy Pattern in Java


Simple Note

(From SO)
A Virtual Proxy creates expensive objects on demand

(From Wiki)
Lazy initialization is the tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed.

Program

https://github.com/benbai123/JSP_Servlet_Practice/tree/master/Practice/JAVA/DesignPattern/src/proxy/virtualproxy

Run TestMain.java to test.

ProxyFactorial will create and cache the Factorial object on demand.

Reference:

Proxy pattern

Lazy initialization

Great answer at SO

Factorial

No comments:

Post a Comment