We are required to make a package diagram for our senior project. Since our project uses MVC patter design, we created an MVC class diagram, now, our problem is in creating the package diagrams from our class diagram.

Is it possible to have packages with MVC at the same time? so it would be something like this:

Package: Account

  • Account Model
  • Profile Controller
  • Registration Controller
  • Profile View
  • Registration View

These are the controller that cannot exists without the Account model, so I included them.

Thanks in advance!


2 Answers 2


First thing you have to do is to decide about the semantics of your UML packages. UML does not define any clear semantics, you have to define one that suits your needs.

For example, a package could be a layer in your software (i.e. model layer, view layer, controller layer), so if that is the semantics you pick, this will obviously fit to MVC. I guess that is not the semantics you have in mind, otherwise you would not see any problem here.

A different possible semantics is a namespace, a component, a library, the deployment packaging, or whatever things you want to group together. This is a different point of view, and may or may not conform to the MVC view. If this it doesn't, you may consider making two diagrams, one showing the MVC view and one showing your specific package view.

  • Do not mix packages and components. Components do some common jobs, packages are merely "folders" in which the classes lie. You CAN do packages same as components, but it is very inconvenient.
  • So, the package diagram is very easy - you already have all your packages, only put there the connections about what belongs to which and who imports whom.
  • What you really need, is the component diagram, it is a level higher. Remember the main MVC rule - controllers can speak to anybody, Viewers and Models speak to Controllers only. Put components on the paper/screen and show by arrows, what information they are sending to each other.
  • Also you can move the components so, that M,V and C will be somehow clustered. And show these clusters, by color or by boundaries. But boundaries are usable only on easy diagrams, or you'll have too many lines.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.