Using Design Patterns in UML
UML Tools and Design Patterns
Quite a few UML tools in the market support design patterns. Many such tools have a pre-built catalog of well-known design patterns. With this using Creational, Structural or Behavioral design patterns in your system is a breeze! The design patterns can be easily pulled in into your design as templates and then customized for your application design. Some examples of UML tools that support design patterns are Rational Rose and Together ControlCenter.
Applying Design Patterns
Now let us take a look at the Courseware Management System and see if we can identify any possible design patterns. Our class diagram of the Courseware Management System only captured the primary entities in the system. If we go about refining and elaborating the class diagram we will come across a few design patterns.
We can identify atleast a couple of examples of Structural patterns. For instance, one component that is not shown in the class diagram is a database accessing element that will provide database accessing services for all the classes in the class diagram that need to interact with a data store. All database interactions to retrieve or update information required for their business functionality can be routed through this database access element, which acts as a bridge between the database and the application components. This is an example of the Bridge design pattern.
If we take things to the implementation level, we can define a common interface object that is used to package data passed between the different classes. This would help to keep the interface between interacting classes the same while allowing for flexibility in implementation. Such a common interface object is a good example of the ValueObject pattern that falls under the category of Structural design pattern.
The above examples in the Courseware Management System show how design patterns are an integral part of well-designed systems and you should always keep the use of design patterns in mind when you model software systems.
Using patterns does not mean that you have are restricted to using only well defined standard design patterns. If you have pieces in a software system of your organization that you think are reusable and can be applied to other software systems that you may build in future, it would be well worth the effort to capture such specific design patterns using a UML tool for future use. Examples of such organization specific patterns are authentication and authorization mechanisms, approval chains, workflow/process patterns etc that you have put in effort to design and can be easily reused in other systems.
As we saw in this article, design patterns are an extremely useful mechanism to document and learn about common reusable design approaches. Using design patterns you can reduce the designing time for building software systems and more importantly ensure that your system is consistent and stable in terms of architecture and design. The UML class diagrams provide an easy way to capture and document Design patterns. In the next and concluding article of this series we will discuss the Rational Unified Process and how it applies to the lifecycle of building projects.
About the authors
Mandar S. Chitnis, Lakshmi Ananthamurthy and Pravin S. Tiwari are the co-founders of Novusware inc. They have co-authored the book "Teach Yourself BEA WebLogic Server 7.0 in 21 Days" (SAMS publishing Oct 2002) based on the recently launched WebLogic Server 7.0 by BEA Systems inc. For any questions or queries regarding the article contents, please contact email@example.com
Page 2 of 2