Abstract

In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. Design patterns reveal much about the high-level abstract designs of software systems. Accurately discovering design pattern instances in software systems helps developers and maintainers to understand the original design and implementation, and to facilitate the re-development, upgrade and maintenance. In recent years, numerous approaches have been proposed to discover design pattern instances from system source code. Among them, many transform the source code and design patterns into graphs, and then discover the isomorphic sub-graphs of design patterns from the graph of software system. However, as testing sub-graph isomorphism is an NP-complete problem, those approaches usually fail to achieve satisfactory efficiency. On the other hand, a real time response of detecting pattern instance is in fact essential. To address this problem, we propose a novel efficient approach to detect structural design pattern instances based on directed sub-graph isomorphism. In particular, we put forward a well-designed search order, or Ordered Sequences, by which the candidate pattern instances can be rapidly detected. Because the Ordered Sequences guide the search process in such an order that the most representative classes are discovered first, a large number of irrelevant classes can be filtered out at early stage, which greatly reduces the search space. We employ our approach on four well-known open-source systems. The results of extensive experiments for discovering instances of all GoF structural design patterns verify that our approach obtains 100% recall and the high precision. In addition, the experiment conducted on two other large scale open-source projects indicates that our approach runs significantly faster than the compared approach.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.