UML Tutorial for Beginners
Blog containing resources for uml like lecture notes, lecture videos, lab manual, uml diagrams, objective bits, important questions and more.

10/08/2013 Categories: Structural Modeling. 2 Comments on Class Diagrams

To learn class diagrams, you must know about the concepts of classes, advanced classes, relationships and advanced relationships.


Now, let’s start learning about class diagrams in UML:


Class diagrams are most commonly found diagrams while modeling software systems. A class diagram consists of classes, collaborations and interfaces. A class diagram is used to model the static design view of the system.


Common Properties


The class diagram shares the common properties with the rest of the diagrams, a name and graphical elements that are a projection into the model. What distinguish the class diagram from the others are the contents of the diagram.




Class diagram contains the following:

  • Classes
  • Interfaces
  • Collaborations
  • Generalization, dependencies and associations


Like other diagrams, class diagrams may also contain notes and constraints. Class diagrams may also contain packages or subsystems which are used to organize the elements into groups. Generally, the class diagrams are used for:

  • Modeling the vocabulary of the system
  • Modeling the collaborations
  • Modeling the logical database schema


Common Modeling Techniques


Modeling Simple Collaborations


To model simple collaborations,

  1. Identify the function or behavior of the part of a system you would like to model.
  2. For each function or mechanism identify the classes, interfaces, collaborations and relationships between them.
  3. Use scenarios (sequence of activities) to walk through these things. You may find new things or find that existing things are semantically wrong.
  4. Populate the things found in the above steps. For example, take a class and fill its responsibilities. Now, convert these responsibilities into attributes and operations.


Modeling a Logical Database Schema


To model a schema,

  1. Identify the classes whose state must be saved over the lifetime of the application.
  2. Create a class diagram and mark these classes as persistent by using tagged values.
  3. Provide the structural details for these classes like the attributes, associations with other classes and the multiplicity.
  4. Minimize the common patterns which complicate the physical database design like cyclic associations, one-to-one associations and n-ary associations.
  5. Provide the behavior for these classes by listing out the operations that are important for data access and integrity.
  6. Wherever possible, use tools to convert the logical design to physical design.


class diagram database schema


Forward and Reverse Engineering


To forward engineer a class diagram,

  1. Identify the rules for mapping the models to the implementation language of your choice.
  2. Depending on the semantics of the language, you may want to restrict the information in your UML models. For example, UML supports multiple inheritance. But some programming languages might not allow this.
  3. Use tagged values to specify the target language.
  4. Use tools to convert your models to code.


To reverse engineer the code,

  1. Identify the rules for mapping the implementation language to a model.
  2. Using a tool, navigate to the code that you want to reverse engineer. Use the tool to generate a new model.

Related Links:

Note: Do you have a question on this article or have a suggestion to make this article better? You can ask or suggest us by filling in the below form. After commenting, your comment will be held for moderation and will be published in 24-48 hrs.


You can follow any responses to this entry through the RSS 2.0 feed.

I like the article

    Ohhh Really???

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll Up