8th Light: Day 92

10 May 2016 . 8thlight . Comments #apprenticeship #8thlight #software #proxy #pattern

Proxy pattern

… a surrogate or placeholder for another object to control access to it. SourceMaking

Proxies in the real world

During the Cold War between the United States and the Soviet Union, the number of proxy wars increased significantly.

A proxy war is a conflict between two nations where neither country directly engages the other

Proxy wars were used during the Cold War as a substitute for direct engagement due to fear of nuclear holocaust as a safer way to wage hostile actions.

Proxies in software

A proxy is a class functioning as an interface to something else. While the Adapter pattern provides a different interface to its subject; the Proxy pattern provides the same, though often limited, interface.

Proxies as a security layer

The proxy pattern is able to be used as a layer to add security to an object by restricting the methods that are able to be called (due to the interface).

Derek Banas gives a thorough walk-through on how the proxy pattern can be applied to an ATM machine, restricting methods that are able to be called on the real ATM object.

YouTube link on proxy patterns