The main feature of the application is the facility to incorporate design patterns in the object oriented design of the project. To do so, the developer can use the existing design pattern plug-in file or create a custom plug-in by using the plug-in editor that comes with the application.
Here is the step by step example :
Lets say the design of your current component looks like this>>
Initial Design before merge.
It has a few classes.. Asterix
, and each class has a few methods/fields and there are a few relations between them.
You want to add the adapter design pattern into the current class diagram and moreover you have identified the roles and responsibilities of the existing classes,...lets say you want the Asterix
class to take up the role of Adaptee
to take up the role of Adapter
to take up the role of Target
... The adapter design pattern looks like this >>
The Adapter Design Pattern.
To complete this design pattern,
- Goto Tools->Add Design Pattern
- Choose the design pattern from the category or a file if you have created custom design pattern.
- A plugin details wizard which will help you in adding the design pattern will appear as shown above
- Select the Class Mappings tab. Here you can map the class in the current component to a class in the design pattern. Click on Add Mapping to add that mapping.
Reivew the pattern, mapping before merge.
- After adding all the mappings click on Next>> , here if the name of a class in the design pattern and the name of a class in the current component are same, but no mapping exists for them, the error message is displayed. This is done to avoid overwriting of the class in the current component.
- If there are no conflicts,you can click on Start @ Merge . Once complete you will see the log, which indicates the new classes, methods, fields,relations that were added to the current component. If an duplicate field/method/relation exists, then they are not added. Also the classes that are present in the design pattern and are not mapped are also added. (Client class in this example).After merging the design pattern and clicking on Finish, the class diagram of the current component is updated and in our example it looks like this.
After adding a design pattern.
- After the merge if you forget which class in the component was mapped with which class in the design pattern, the hover sense message will indicate it!
The hoversense message remembers the design pattern mappings.