Context Object Pattern

We can use a Context Object to encapsulate state in a protocol-independent way to be shared throughout your application.
Context object pattern encapsulating system data in a Context Object allows it to be shared with other parts of the application without coupling the application to a specific protocol.
For example, an HTTP request parameter exists for each field of an HTML form and a Context Object can store this data in a protocol-independent manner while facilitating its conversion and validation. Then other parts of the application simply access the information in the Context Object, without any knowledge of the HTTP protocol. Any changes in the protocol are handled by the Context Object, and no other parts of the application need to change.
A Context Object’s main goal is to share system information in a protocol- independent way, improving the reusability and maintainability of an application.

Table of content

Problem
Forces
Solution
Explanation
Structure - Class Diagram, Sequence Diagram
Participants and Responsibilities
Implementation
Consequences
Applicability
Real world examples
References

Read above topics on www.javaguides.net/2018/08/context-object-design-pattern-in-java.html

Comments