प्रॉक्सी पैटर्न क्या है?
💻 coding

प्रॉक्सी पैटर्न क्या है?

2 min read 327 words
2 min read
ShareWhatsAppPost on X
  • 1The proxy pattern is a design pattern that acts as an interface to another object, providing controlled access and additional functionality.
  • 2Proxies can implement caching or access rights checks, enhancing performance and security when interacting with resource-intensive objects.
  • 3This pattern is part of the GoF design patterns, promoting flexible and reusable object-oriented software design.

AI-generated summary · May not capture all nuances

Key Insight
AskGif

"The proxy pattern is a design pattern that acts as an interface to another object, providing controlled access and additional functionality."

प्रॉक्सी पैटर्न क्या है?

In computer programming, the proxy pattern is a software design pattern.

A proxy, in its most general form, is a class functioning as an interface to something else. The proxy could interface to anything: a network connection, a large object in memory, a file, or some other resource that is expensive or impossible to duplicate. In short, a proxy is a wrapper or agent object that is being called by the client to access the real serving object behind the scenes. Use of the proxy can simply be forwarded to the real object or can provide additional logic. In the proxy, extra functionality can be provided, for example caching when operations on the real object are resource intensive, or checking preconditions before operations on the real object is invoked. For the client, usage of a proxy object is similar to using the real object, because both implement the same interface.

The Proxy design pattern is one of the twenty-three well-known GoF design patterns that describe how to solve recurring design problems to design flexible and reusable object-oriented software, that is, objects that are easier to implement, change, test, and reuse.

What problems can the Proxy design pattern solve?

The access to an object should be controlled.

Additional functionality should be provided when accessing an object.

When accessing sensitive objects, for example, it should be possible to check that clients have the needed access rights.

What solution does the Proxy design pattern describe?

Define a separate Proxy object that

can be used as a substitute for another object (Subject) and

implements additional functionality to control the access to this subject.

This enables to work through a Proxy object to perform additional functionality when accessing a subject. For example, to check the access rights of clients accessing a sensitive object.

To act as a substitute for a subject, a proxy must implement the Subject interface. Clients can't tell whether they work with a subject or its proxy.

source: wiki

Enjoyed this article?

Share it with someone who'd find it useful.

ShareWhatsAppPost on X

AskGif

Published on 1 August 2018 · 2 min read · 327 words

Part of AskGif Blog · coding

You might also like

प्रॉक्सी पैटर्न क्या है? | AskGif Blog