Abstract:Although design pattern is quite useful in software reuse, there are still many barriers when instantiating the design patterns, such as pattern overlapping, traceability, and difficulties in reusing the pattern code. A role-based approach for design pattern modeling and implementation is proposed. In this approach, roles of pattern are treated as the independent modeling elements and the RoleOf relationship is used to associate a role with an application class. This can improve the reusability of pattern. The meta-model of the RoleOf relationship for pattern instantiation and its semantics are proposed using UML extension mechanism. The stereotypes and tagged values used for identifying pattern information are provided, and it resolves the traceability and overlapping problem in pattern instantiation. The dynamic binding of application and role logic are implemented through the extension to Java language, called Rava. The approach proposed in this paper can effectively solve the problem such as pattern overlapping and traceability during the pattern instantiation, which improves the reusability of pattern logic and guides the software development using design patterns.