TechBubbles Microsoft Technology BLOG

Domain Model Using UML


Unified Modeling Language is a graphical language used to describe objects in a system. This post describes the UML class diagrams and relationships among business entities in the system.

Domain Model represents the relation ship between logical entities in the system. It also illustrates how different entities in application domain would interact with each other.





Class Diagrams

Class diagram represents how different entities are related to each other in an object-oriented system. We are using OrderManagementSystem to demonstrate the class diagram.



The rectangular boxes denote the classes with name and fields. The arrows define relationships between entities.

The following are the relationships among classes

  • Dependency Relationship
  • Association
  • Generalization
  • Realization

Dependency Relationship

This relationship exists between two elements if changes to one element will affect the other. It is a simple relation ship where entity 1 depends on entity 2 in such a way that any change in entity2 might break entity1. This is one way relationship where change in entity 1 will not affect entity2 in any manner..


public class Entity1
public void MethodX (Entity2 en)
// . . .

Association Relationship

Association shows the relationship between instances of classes. It is similar to a dependency except that it specifies the relationship in stricter form. Instead of using Entity2 as a local variable in Association it would be a global variable. Graphically it represents with a strong arrow between the entities.


public class Order //entity1
private Customer _customer;
public Customer GetCustomer ()
return _customer;

In the above code, customer is part of order class. Customer object forms a part of the state of the order. If you have an order object, you can easily identify the customer associated with it. Hence association is a stronger form of dependency.


Aggregation is a part-of relationship between classifiers. The life time of one object is not necessarily controlled by another object. An Aggregation is represented by a straight arrow, with an empty diamond at the tail.


In above example, Entity2 is part of Entity1. If you destroy the parent class(Entity1) in an aggregation relationship, the child class can survive on its own.


OrderLine can have multiple quantities of one product. If OrderLine is destroyed, it does not mean that we delete the product as well. If an order is cancelled then all of its products will not be destroyed. The products will only be disassociated from particular order.


Composition is whole-part relationship where life time of part is controlled by the whole.


In above diagram Entity2 is controlled by Entity-1. If Entity 1 is destroyed in a composition (strong) relationship, Entity 2 destroyed as well.



Customer can place multiple orders; order can have one or more products. An Order object can not exist on its own with out customer object. If customer goes out of scope then order also goes out of scope too.


In UML inheritance is depicted as generalization relationship. A generalization relationship is also known as “is-a” relationship where specialized class is based on a general class



A Realization relationship exists between the two classes where one class implements the behavior specified by other class.

Example: A realization relationship connects an interface to an implementing class.



This post explained the how to data model an application using UML and also explained the relationship among the entities in the UML.

About the author

Kalyan Bandarupalli

My name is kalyan, I am a software architect and builds the applications using Microsoft .NET technologies. Here I am trying to share what I feel and what I think with whoever comes along wandering to Internet home of mine.I hope that this page and its contents will speak for me and that is the reason I am not going to say anything specially about my self here.


TechBubbles Microsoft Technology BLOG

Follow me


Tag Cloud