Search code examples
umlclass-diagramuse-case

Do I have to make one control class per use case in class diagram?


I'm making class diagram based on ECB pattern. According to Wikipedia, every use case is represented as a control class. Does this mean a 1:1 response?

For example, if I made 'Login' and 'Register' use cases, then does 'LoginController' and 'RegisterController' have to be there?

Can I integate them into 'ValidationContoller?'

I looked up information about the ECB, but it was hard to get detailed information. Thanks in advance for any helps.


Solution

  • No, there is no need for a one-to-one mapping at all.

    As laid down in the wikipedia article:

    ECB classes are first identified when use-cases are analyzed:

    • every use case is represented as a control class;
    • ...

    The classes are then refined and re-structured or reorganized as needed for the design, for example: ...

    So the 1:1 is only the beginning of the analysis, and in no way a guidance for the implementation.

    It is important to understand that this pattern originated in the 90's in a pre-agile context. Ivar Jacobson, the inventor of the use-cases, intended with ECB to be able to derive an implementation from the requirements (represented as use cases), and to keep a perfect traceability of the implementation back to the requirements. If you look for more details on this approach, you may read the Unified Software Development Process by Jacobson, Booch and Rumbaugh.

    Not related: It may be useful to know that Jacobson's more recent work (e.g. Use Case 2.0) no longer mentions ECB, since modern agile approaches do not support the kind of upfront analysis assumed with ECB.