Question

I wanna draw class diagram so I found some entity and boundary classes ( something like picture below ) But i don't have any idea how to connect these classes to each other (in fact i don't know how use controller classes ) can anyone explain it to me or give an example.

enter image description here

Was it helpful?

Solution

These UML stereotypes were created to support the MVC pattern or similar style of modelling. On a certain abstraction level, all systems have elements like user interface, logic and data. Sometimes they are all mixed up and interconnected, therefore hard to separate, but sometimes they are nicelly decoupled. A possible way to achieve it described in the mentioned MVC pattern.

So...

  • Boundary class represents a UI element or some other module that communicates witht he external world (like driver, some gateway, etc). Boundary is the V from MVC.
  • Control class is the C part from MVC pattern. It holds the application logic, business rules, typically components that enable communication between Boundary and Entity.
  • Entity can be seen as the M part of the pattern. It is an abstraction of all kinds of data manipulated by a system (DB, files, images, configuration artifacts, etc)

you might notice that these abstractions also mimic the common 3-Tier system architecture (presentation, logic, data).

This is a summary of the UML related theory of these elements.

The way you use them is however your own decision and depends on your system design. Typically a Boundary communicates with Control and it in turn has access to the DB. If you want to have direct communication between B and E, you can of course also draw it that way, that's the creative part of the modelling.

In your example, it is probably reasonable to add a Control class LoginManager or similar, that is invoked from the LoginInterface form and in turn accesses User entity.

Boundary's attributes are clearly UI related elements, while Entity's can be fields in a DB.

Always keep in mind, that B, C and E are UML classes. This defines and restricts possible further elements and relationships, that you can use on your diagram, and defines their meaning. They can hold attributes and methods, derive each other, have associations, dependencies.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top