Nowadays, software designers attempt to employ design patterns in software design phase, but design patterns may be not used in the implementation phase. Therefore, one of the challenging issues is conformance checking of source code and design, i.e., design patterns. In addition, after developing a system, usually its documents are not maintained, so, identifying design pattern from source code can help to achieve the design of an existing system as a reverse engineering task. The variant implementations (i.e., different source codes) of a design pattern make hard to detect the design pattern instances from the source code. To address this issue, in this paper, we propose a new method which aims to map the design pattern detection problem into a learning problem. The proposed design pattern detector is made by learning from the information extracted from design pattern instances which normally include variant implementations. To evaluate the proposed method, we applied it on open source codes to detect six different design patterns. The experimental results show that the proposed method is promising and effective. 
Source code and design conformance, design pattern detection from source code by classification approach