Knowledge is power. We love to share it.

News related to Mono products, services and latest developments in our community.


Creating domain models using Enterprise Architect


Every real-world project needs to be properly documented. UML (Unified Modeling Language) provides nice means for generating documentation for projects of all sizes. It is used to specify, visualize, modify, construct and document the artifacts of an object-oriented software-intensive system under development.

Keeping project documentation up to date can be a tedious work. Fortunately, there are some excellent tools to help us deliver accurate documentation quickly and provide us with generated code classes for easier implementation of the documented functionality.

I just started to work with one of such tools. It is called Sparx Systems Enterprise Architect and its latest version is 9.3

EA is a tool for UML based modeling and covers every part of a business process. It allow us to keep track of project issues, project glossary, implementation details, dependency details, testing details and many more. I have also found Agile/ICONIX Add-In which improves integration of EA in an agile team and includes nice utilities for creating diagrams and code. Process supported by this add-in is called Agile ICONIX process.

In this post I’ll show you how to use UML tool for creating a domain model.

Suppose that we already have our business use cases and want to start creating the domain Model.

We need to identify our real-word domain objects and create them in our domain. In EA we can use Use Case text description for creating domain objects. We just select a word from the text and choose to create a new element from the context menu.

When working with the ICONIX process we don’t need to spend too much time on the first version of a domain model since we will repeatably return to it when analyzing use cases.

Let's say that we want to create a domain model with Bill, BillItem, PriceList, Book as domain objects. We start by creating a new diagram in EA. Domain diagrams are created using Class diagram type. We simply click on Add new diagram on the model node in the Project Browser and choose Class Diagram as a diagram type.


We keep this diagram with no attributes because this is only a conceptual model and we don’t want to clutter diagrams with unnecessary info.

Now that we have our domain objects we can define relations between them. Following our application logic, we know that BillItems are contained in Bills and Bills are contained in Books so we will model that using Aggregation links.


Our first step in modeling project is finished - at least for for now. We will come back later when analyzing use cases.

With the act of creating a domain model,  we have created CIM (Computation Independent Model). CIM can be subsequently transformed to PIM (Project Independent Model) and from PIM we can create PSM (Platform Specific Model) for concrete implementation.

EA includes transformation templates which allow us to perform these transformations. For example, we can simply transform our current  domain model to the C# model, to DDL, or we can create our custom transformation template.

Right click on the package in the Project Browser, and choose transformation and destination for transformed objects. Typicall, the destination will be somewhere in a Class Model.


Transformation templates will automatically create new classes for us including required properties, so our transformed model will look like this:


Use Tools->Options…->Source Code Engineering->Collection classes to define custom collection classes for our project.


After creating a PSM we can easily convert our model to code.

EA supports code generation for multiple languages (custom templates can be also used). Code generation is done by right clicking on a package in the Project Browser and selecting option for Code Engineering.


After setting the required options, just click on "Generate" and all your code will be stored in files, ready for further manipulation.

Rated 2.30, 10 vote(s).