Skip to Main Content
Identifying design patterns from source code is one of the most promising methods for improving software maintainability, reusing experience and facilitating software refactoring. In this paper, an approach that combines static and dynamic analysis on detecting design patterns from java source code is presented. Static structure analysis of identifying pattern instances is illustrated. Especially, to improve the detecting precision, multiplicity analysis of object creation is executed to validate creational pattern candidates and dynamic analysis which is the process of monitoring sequence of method calls in pattern candidates and judging if it is consistent to the expected pattern behavior is executed to validate behavior pattern candidates. After the validation of behavior candidates, those instances belong to patterns which have similar structure but different behavior are distinguished successfully. Finally, a tool of extracting design pattern from java source code is implemented and the feasibility of this approach is verified through the results of applying it on an open source software.