Proxy ਪੈਟਰਨ ਕਿਸੇ ਹੋਰ ਆਬਜੈਕਟ ਤੱਕ ਪਹੁੰਚ ਨੂੰ ਨਿਯੰਤ੍ਰਿਤ ਕਰਨ ਲਈ ਇੱਕ ਪਲੇਸਹੋਲਡਰ ਜਾਂ ਸਥਾਪਨਵਾਰ ਪ੍ਰਦਾਨ ਕਰਦਾ ਹੈ। ਪ੍ਰੌਕਸੀ ਦਾ ਅਸਲ ਆਬਜੈਕਟ ਦੇ ਸਮਾਨ ਇੰਟਰਫੇਸ ਹੁੰਦਾ ਹੈ ਪਰ ਇਹ ਆਚਰਣ ਜੋੜਦਾ ਹੈ — ਜਿਵੇਂ ਸੁਸਤ ਲੋਡਿੰਗ, ਪਹੁੰਚ ਨਿਯੰਤ੍ਰਣ, ਕੈਸ਼ਿੰਗ, ਜਾਂ ਲਾਗਿੰਗ — ਇਸ ਤੋਂ ਪਹਿਲਾਂ ਕਿ ਇਹ ਇਸ ਨੂੰ ਡਲਿਗੇਟ ਕਰੇ।
ਪ੍ਰੌਕਸੀ ਪੈਟਰਨ ਕੀ ਕਰਦਾ ਹੈ
PROXY → an object that STANDS IN for another, controlling access to it:
→ same interface as the real object (clients use it transparently)
→ adds behavior BEFORE/AROUND delegating to the real object
→ controls WHEN and HOW the real object is accessed
→ "a stand-in that adds control/behavior"
