Content deleted Content added
m →Data |
→Context: added references. |
||
Line 19:
===Context===
The context is the class (or its instance) whose code includes the [[Role-oriented programming|Role]]s for a given algorithm, scenario, or use case, as well as the code to map these Roles into objects at run time and to enact the use case. Each Role is bound to exactly one object during any given use case enactment; however, a single object may simultaneously play several Roles<ref name="Execution model">{{cite web |last1=Reenskaug |first1=Trygve |title=A DCI Execution Model |url=https://fulloo.info/Documents/DCIExecutionModel-2.1.pdf |page=9}}</ref>. A context is instantiated at the beginning of the enactment of an algorithm, scenario, or use case. In summary, a context comprises use cases and [[algorithm]]s in which data objects are used through specific Roles<ref name="Artima" />.
Each context represents one or more use cases<ref name="Artima" />. A context object is instantiated for each enactment of a use case for which it is responsible. Its main job is to identify the objects that will participate in the use case and to assign them to play the Roles which carry out the use case through their responsibilities. A Role may comprise methods, and each method is some small part of the logic of an algorithm implementing a use case. Role methods run in the context of an object that is selected by the context to play that Role for the current use case enactment. The Role-to-object bindings that take place in a context can be contrasted with the polymorphism of vernacular object-oriented programming<ref name="Glossary">{{cite web |author1=Trygve Reenskaug |others=With assistance from Object-composition group |title=The DCI Glossary |url=https://folk.universitetetioslo.no/trygver/2011/DCI-Glossary.pdf}}</ref>. The overall business functionality is the sum of complex, dynamic networks of methods decentralized in multiple contexts and their Roles.
Each context is a scope that includes identifiers that correspond to its Roles<ref name="Artima" />. Any Role executing within that context can refer to the other Roles in that context through these identifiers<ref name="Artima" />. These identifiers have come to be called ''
An example of a context could be a wire transfer between two accounts, where data models (the banking accounts) are used through Roles named SourceAccount and DestinationAccount.
|