Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What parts does the web proxy pattern consist of

Shulou Source: shulou.com Published: 2022-06-01 03:45:12 09月26日 Update

This article mainly explains the "web agent model consists of which parts", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "which parts of the web agent model" bar!

structure

Participant

Listed in parentheses are the corresponding classes in the protection agent instance in the previous article.

Proxy (AccessorProxy)

Manage a reference so that the agent can access the entity. The Proxy in the resulting class diagram manages objects of type RealSubject, and Proxy can manage objects of type Subject if possible, so Proxy can be more versatile.

-provides the same interface as the Subject interface so that proxies can be used to replace entities. In other words, nothing seems to have changed from the customer.

-provide additional operations to meet customer needs according to requirements.

Subject (DbAccessor)

-define a common interface between RealSubject and Proxy so that Proxy can be used anywhere you use RealSubject. From the user's point of view, whether it's RealSubject or Proxy, it's the same.

RealSubject (RealAccessor)

-the entity represented by Proxy.

In the actual development, it is possible that the first thing that exists is the Subject that implements the function. When additional requirements arise (memory savings, access protection, etc.), the functionality of Subjec can be transferred to the new class RealSubject, and Subject itself becomes an abstract class. Next, define the Proxy according to the interface of Subject and give it to the user. This can be seen as an example of refactoring.

Collaboration

The agent forwards the request to the agent object at an appropriate time and manner in accordance with its duties.

Thank you for your reading, the above is the content of "what are the components of the web agent model". After the study of this article, I believe you have a deeper understanding of the problem of which parts of the web agent model is composed of, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Agents patterns parts interfaces entities objects requirements learning management content functions instances customers users articles types protection same appropriate next Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Docker Apple vpn MariaDB