Abstract: Design patterns (DPs) represent an abstract design approach and are commonly reflected in software code. Design pattern detection (DPD) can help programmers quickly grasp the main structure of the code, thereby reducing the difficulty of software understanding. Micro-structures (MSs), are basic components of the code, have smaller granularity and clearer semantics, and can be used for the DPD task. This paper proposes a syntax-independent code design semantic representation method based on the heterogeneous information network (HIN). A representation and classification of micro-structures is given based on meta-paths of HIN, based on which a DP can be decomposed into MSs. The DPD procedure is then implemented through three steps of DP decomposition, MS matching and MS combination. The method is evaluated on three open-source systems with four other detection tools. The results show that our approach effectively detects DP instances and alleviates the variant problem, which also shows the great potential of applying network science methods to software engineering.
Loading