I'm wondering if a subclass of a Boundary acts as a controller ?
UML - Can subclass of a Boundary acts as controller?
125 Views Asked by adiba aslan AtThere are 2 best solutions below

In short
No it can’t
Long explanation
The architectural approach of Entity-Control-Boundary aims to derive the design from use-cases.
The roles and responsibilities of the boundaries and the controls are incompatible in this model:
- the boundary manages the interaction between a group of actors and a use-case,
- the control manages the execution of the use case and coordinates other involved objects.
This leads to the following robustness constraints:
- A boundary can be associated with a control, but must not be associated with an entity.
- A control can be associated with a control and an entity.
A subclass of a boundary would by definition itself be a boundary class. If it could be at the same time a control this would mean that at the same time it can be associated with an entity but must not be associated with an entity, which is impossible. So, no, these two roles can’t be taken by the same class.
Some nuance
I assumed above that you were using ECB and wrote « controller » but meant « control » with its specific ECB meaning.
But you could have used « controller » on purpose to refer to a more general class responsibility (responsibility driven design terminology). In this understanding a controller just coordinates other classes without taking into consideration larger architectural components. It is possible to have a boundary controller (i.e. a boundary class such as a a dialog box controller) that coordinates other boundary classes (e.g. dialog text boxes and buttons) independently of any specific business logic. This is possible because the notion of controller-class is orthogonal to theECB-Control class
Subclassing means inheritance. That is the subclass inherits from the superclass. In that respect the subclass is still whatever the superclass is. But since it's something new it may as well inherit anything else. So it may inherit from a controller class as well making it a hybrid. Whether that is meaningful depends of course. The MVC paradigm aims towards separating boundaries1 (views) from controllers. Uniting them once again is just working counter that paradigm.
1I'm used to MVC. See Model View Controller vs Boundary Control Entity