Organize Domain and Implementation Model
May 04, 2016
This tutorial is aimed to introduce the concept of organizing project with the use of model. By reading this tutorial, you will learn how to create domain model, how to transcribe it into implementation model, and eventually compare their differences.
Creating domain class model
- Create a new project by selecting Project > New from the application toolbar. In the New Project window, enter Order Processing as project name and click Create Blank Project.
- Open the Project Browser by selecting View > Project Browser from the application toolbar.
- Open the Model Structure page.
- On the left hand side, keep the project node selected in the list and then click New Model.
- In the Model Specification window, enter Domain Model as model name. Click OK to confirm.
- Keep Domain Model selected in the list. Then, click Add New Diagram.
- In the New Diagram window, select Class Diagram and then click Next to continue.
- Keep the diagram name unchanged and then click OK to create the diagram.
- Draw a domain model class diagram like this:
Creating implementation class model
Having completed the domain model, we are going to transcribe it into implementation model.
- Right click on the diagram background and select Utilities > Transit to New Diagram... from the popup menu.
- In the Select Parent Model of New Diagram window, select the project root node.
- Click New Model at the top right of window.
- In the Model Specification window, enter Implementation Model as model name. Click OK to confirm.
- Keep Implementation Model selected, click OK to confirm. This forms a new diagram with name Implementation Model, which looks the same as Domain Model. What we are going to do is to refine the design to make it become an implementation model.
- Delete the class Customer by selecting it, and hit the delete key.
- Rename class Order line to OrderLine.
- Create a class OrderController.
- Add an operation createOrder() : Order into OrderController.
- Right click on the operation createOrder() : Order, select Show Dependencies from the popup menu.
Up to now, the implementation model should look like this:
Using Model Transitor
Let's refresh our memory on what we have changed for the class OrderLine
- Move your mouse pointer over the class OrderLine.
- Click on the Model Transitor resource icon at the bottom right of the class shape and then select Transit From > Domain Model.Order line from the popup menu.
This populates the domain model, with former version of class OrderLine selected, which was named Order line.
Comparing models with Visual Diff
In order to identify all the refinements made in implementation model, we need to make use of the Visual Diff tool.
- Open Visual Diff by selecting Modeling > Visual Diff from the application toolbar.
- In the Visual Diff window, select Transitor as Strategy.
- We wanted to know the changes of model element details rather than view details such as shape coordinate. Therefore, next to Strategy we select Model Element to Compare.
- For the diagram pane on the right, keep Use Working Project selected, and pick up Implementation Model for the diagram to compare.
- Now, we have obtained the differences between domain (left hand side) and implementation (right hand side) model, at the bottom pane. Click on the node OrderController (New). From the tag (New), and from the diagram, we know that it is newly added in the implementation model.
- Select and expand the node Order line (Modified). We know that it is renamed.
- Select the node Customer (Deleted). We can see that it does not exist anymore in the implementation model.