Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Proxy pattern and Virtual proxy pattern

I knew of the proxy pattern till now and recently read this article that says a virtual proxy is basically used to defer the Object Creation process of memory-intensive components thereby speeding up the Application.

But after reading that article it looks like the proxy pattern and the virtual proxy pattern are the same thing. Am I right or have I understood this wrong?

like image 421
user20358 Avatar asked Jul 25 '11 16:07

user20358


1 Answers

There are different types of proxy patterns. Virtual Proxy is one of them. Others (from GOF) are Protection Proxy, Remote Proxy, Smart Reference. From GOF:

A remote proxy provides a local representative for an object in a different address space.

A virtual proxy creates expensive objects on demand.

A protection proxy controls access to the original object. Protection proxies are useful when objects should have different access rights.

A smart reference is a replacement for a bare pointer that performs additional actions when an object is accessed

like image 188
taskinoor Avatar answered Oct 19 '22 17:10

taskinoor