Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to model in UML 2.0 a Java servlet application that has three classes

  • Servlet class; essentially a main class that acts as the controller
  • DatabaseLogic; contains methods for database operations
  • XMLBuilder; builds an XML from a query result string

The classes use a variety of packages from the Java library. I am unsure how to model this in UML

Do I have to create a package and show which libraries are used for each individual class or can I just have one large package in the diagram with all the libraries showing which classes have dependencies on which.

As per this diagram

enter image description here

This is my first time working with java properly (im a C++ guy)

Apart from being a bit messy , is this a correct UML representation of the system I described?

Does a Package in UML mean the same as a Package in Java?

share|improve this question

migrated from Dec 11 '12 at 15:23

This question came from our site for professional and enthusiast programmers.

Would you add arrows? ARI --makes-conn-with--> Database or Database --makes-conn-with--> ARI first would be correct for the controller I think. – User Dec 11 '12 at 16:17
up vote 3 down vote accepted

It looks like you've roughly got it right! A package in a UML class diagram does equate to a package in Java. The JVM/Java's APIs are so large that often its treated as one black box in these diagrams (or not shown at all).

Going forwards I'd worry less about the formal UML notation and more about 'does my colleague grok this'. Java class diagrams can get very complex beyond a certain size.

share|improve this answer
Thanks! I made some changes to make it easier to read for my colleague grok! :) – kaleeway Dec 12 '12 at 12:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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