Entity–control–boundary
The entity–control–boundary, or entity–boundary–control, or boundary–control–entity is an architectural pattern used in use-case–driven object-oriented programming that structures the classes composing high-level object-oriented source code according to their responsibilities in the use-case realization.
Origin and evolution
The entity–control–boundary approach finds its origin in Ivar Jacobson's use-case–driven object-oriented software engineering method published in 1992. It was originally called entity–interface–control but very quickly the term "boundary" replaced "interface" in order to avoid the potential confusion with object-oriented programming language terminology.It is further developed in the Unified Process, which promotes the use of ECB in the analysis and design activities with the support of UML stereotypes. Agile modelling and the ICONIX process elaborated on top of the ECB architecture pattern with robustness diagrams.
Principle
The ECB pattern organises the responsibilities of classes according to their role in the use-case realization:- an entity represents long-lived information relevant for the stakeholders ;
- a boundary encapsulates interaction with external actors ;
- a control ensures the processing required for the execution of a use case and its business logic, and coordinates, sequences controls other objects involved in the use case.
ECB classes are first identified when use cases are analyzed:
- every use case is represented as a control class;
- every different relation between a use case and an actor is represented as a boundary class;
- entities are derived from the use-case narrative.
- Factoring out common behaviors in different use-case controls
- Identifying a central boundary class for each kind of human actor and for each external system that would provide a consistent interface to the outside world.
Robustness diagram
Robustness diagrams allow to visually represent the relation between entities, controls, boundaries and actors. It uses graphical stereotypes introduced in Jacobson's early work:The following robustness constraints apply:
- Actors may only know and communicate with boundaries
- Boundaries may communicate with actors and controls only.
- Controls may know and communicate with boundaries and entities, and if needed other controls
- Entities may only know about other entities but could communicate also with controls;
Similarly, the constraint of a boundary class not knowing about other boundary classes only applies at the highest level, and not between classes that cooperate to implement the same boundary.
Relation to other architectural patterns
There is some similarity between ECB and model–view–controller : entities belong to the model, and views belongs to boundaries. However the role of the ECB-control is very different from MVC-controller, since it encapsulates also use-case business logic whereas the MVC controller processes user input which would be of the responsibility of the boundary in ECB. The ECB control increases separation of concerns in the architecture by encapsulating business logic that is not directly related to an entity.The ECB can be used in conjunction with the [Hexagonal Software architecture|architecture (software)|hexagonal architecture], whenever the boundaries form the outer adapter layer.
ECB is compatible with the clean architecture which merges ECB principles with other architectural design paradigms. Clean architecture places entities at the core, and surround them with a use-case ring and a ring with gateways and presenters. However, clean architecture requires a one-way dependency from outside to inside, which requires to split ECB controls into use-case logic and object coordination.