Can a component consists of different classes from different layers? [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this questionI am currently drawing a component diagram. The architecture follows what a typical MVC3 application - controllers, services and model (using a repository pattern).
Can a component, says User Management, be comprised off classes from different layer? For example, the User Management component consists of its controller, service and model.
However I present the User Management component as such, how do I show that the service is also a 'component'? That is, it can be swapped out from another service that implements the same interface?
Does it defeat the purpose of a component design if a class by itself is a component?
I'm currently taking a System Integration class where we work quite a lot with component diagrams. I also had the question of whether or not a component can be implemented by a single class, and at least my teacher's position is that that is ok.
In general, UML does not specify how many classes should be in a component, nor how these classes should be structured. The fact that you are using an MVC pattern at the class level is not relevant for your component diagram. The only relevant aspect is that components should be implemented by classes. The number and roles of these classes are up to you.
精彩评论