what is context object design pattern ?
The context object is an internal JSON structure that is available during an execution, and contains information about your state machine and execution. This allows your workflows access to information about their specific execution. You can access the context object from the following fields: InputPath. OutputPath.
A Context object contains a list of properties in the form of NamedValue objects. These properties represent information about the client, the environment, or the circumstances of a request and generally are properties that might be inconvenient to pass as parameters.
Context is an anti pattern, since it is used as a container for what is unknown a priori.
A Context represents your environment. It represents the state surrounding where you are in your system. For example, in web programming in Java, you have a Request, and a Response. These are passed to the service method of a Servlet. A property of the Servlet is the ServletConfig, and within that is a ServletContext.
A Context is a collection of data, often stored in a Map
or in a custom class which acts as a struct with accessors and modifiers. It is used for maintaining state and for sharing information within a system. See this PDF for an indepth description. Though it can be used for efficient and effective data sharing, you should note that many are wary of the Context
pattern as an anti-pattern.
An example for it might be the HttpSession object: you have attributes which is basically a map with String keys and Object elements. This provides state information between http requests. Another example is the ServletRequest which provides state information between Servlets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With