Skip to main content
Log in

Rule-based detection of design patterns in program code

  • Regular Paper
  • Published:
International Journal on Software Tools for Technology Transfer Aims and scope Submit manuscript

Abstract

The process of understanding and reusing software is often time-consuming, especially in legacy code and open-source libraries. While some core code of open-source libraries may be well-documented, it is frequently the case that open-source libraries lack informative API documentation and reliable design information. As a result, the source code itself is often the sole reliable source of information for program understanding activities. In this article, we propose a reverse-engineering approach that can provide assistance during the process of understanding software through the automatic recovery of hidden design patterns in software libraries. Specifically, we use ontology formalism to represent the conceptual knowledge of the source code and semantic rules to capture the structures and behaviors of the design patterns in the libraries. Several software libraries were examined with this approach and the evaluation results show that effective and flexible detection of design patterns can be achieved without using hard-coded heuristics.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8

Similar content being viewed by others

Notes

  1. Although they have a few distinguishing features, we use the terms ‘library’, ‘framework’, and ‘software system’ interchangeably.

  2. http://protege.stanford.edu/.

  3. http://simile.mit.edu.

  4. http://www.w3.org/DesignIssues/Notation3.

  5. http://www.jhotdraw.org/.

  6. http://jena.apache.org/.

  7. http://www.junit.org.

  8. http://jrefactory.sourceforge.net/.

  9. The Mediator pattern is also supported but no results included since Semaptrec did not recover any pattern instances in these frameworks and other tools do not support this pattern.

References

  1. Alnusair, A., Zhao, T.: Towards a model-driven approach for reverse engineering design patterns. In: 2nd International Workshop on Transforming and Weaving Ontologies in Model Driven Engineering (TWOMDE’09) at ACM/IEEE MoDELS’09. Denver CO., USA (2009)

  2. Alnusair, A., Zhao, T.: Source Code Representation Ontology (SCRO), Design Pattern Ontologies, and Framework Ontologies. (2012) Available online at http://www.indiana.edu/~awny/index.php/research/ontologies

  3. Balanyi, Z., Ferenc, R.: Mining design patterns from C++ source code. In: Proceedings of the 19th IEEE International Conference on Software Maintenance (ICSM’03), pp. 305–314. The Netherlands, Amsterdam (2003)

  4. Berners-Lee, T., Hendler, J., Lassila, O.: The semantic web. Sci. Am. 284(5), 34–43 (2001)

    Article  Google Scholar 

  5. Binun, A., Kniesel, G.: DPJF-design pattern detection with high accuracy. In: Proceedings of the 16th European Conference on Software Maintenance and Reengineering (CSMR’12), pp. 245–254. Szeged, Hungary (2012)

  6. Chen, L., Shadbolt, N.R., Globe, C.A.: A semantic web-based approach to knowledge management for grid applications. IEEE Trans. Knowl. Data Eng. 19(2), 283–296 (2001)

    Article  Google Scholar 

  7. Cinneide, M.O., Nixon, P.: A methodology for the automated introduction of design patterns. In: Proceedings of the IEEE International Conference on Software Maintenance (ICSM’99), pp. 463–472. UK, Oxford (1999)

  8. De Lucia, A., Deufemia, V., Gravino, C., Risi, M.: Behavioral pattern identification through visual language parsing and code instrumentation. In: Proceedings of 13th European Conference on Software Maintenance and Reengineerig (CSMR’09), pp. 99–108. Kaiserslautern, Germany (2009)

  9. De Lucia, A., Deufemia, V., Gravino, C., Risi, M.: Improving behavioral pattern detection through model checking. In: Proceedings of 14th European Conference on Software Maintenance and Reengineerig (CSMR’10), pp. 176–185. Spain, Madrid (2010)

  10. Dietrich, J., Elgar, C.: A formal description of design patterns using OWL. In: Proceedings of the Australian Software Engineering Conference (ASWEC 2005), pp. 243–250. Brisbane, Australia (2005)

  11. Dietrich, J., Elgar, C.: Towards a web of patterns. In: Workshop on Semantic Web Enabled Software Engineering (SWESE), pp. 117–132. Galway, Ireland (2005)

  12. Emami, M., Rakesh, G., Hendren, L.: Context-sensitive interprocedural points-to analysis in the presence of function pointers. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’94), pp. 242–256 (1994)

  13. Falbo, R., Guizzardl, G., Duarte, K.C., Natali, A.C.: Developing software for and with reuse: an ontological approach. In: ACIS International Conference on Computer Science, Software Engineering, Information Technology, e-Business and Applications (CSITeA-2002), pp. 311–316. Foz do Iguacu, Brazil (2002)

  14. Ferenc, R., Beszedes, A., Fulop, L., Lele, J.: Design patterns mining enhanced by machine learning. In: Proceedings of the 21st IEEE International Conference on Software Maintenance (ICSM’05), pp. 295–304. Budapest, Hungary (2005)

  15. Gamma, E., Helm, E., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley Professional Computing Series (1995)

  16. Gruber, T.R.: A translation approach to portable ontology specification. Knowl. Acquis. 5(2), 192–220 (1993)

    Article  Google Scholar 

  17. Guéhenéuc, Y.G.: P-MARt: pattern-like micro architecture repository (2007). Retrieved 27 July 2012, from http://ptidej.dyndns.org/downloads/pmart/

  18. Guéhenéuc, Y.G., Antoniol, G.: DeMIMA: a multilayered approach for design pattern identification. IEEE Trans. Softw. Eng. 34(5), 667–684 (2008)

    Article  Google Scholar 

  19. Horrocks, I.: Ontologies and the semantic web. Commun. ACM 51(12), 58–67 (2008)

    Article  Google Scholar 

  20. Jasper, R.J., Uschold, M.F.: A framework for understanding and classifying ontology applications. In: IJCAI99 Workshop on Ontologies and Problem-Solving Methods. Stockholm, Sweden (1999)

  21. Kirasić, D., Basch, D.: Ontology-based design pattern recognition. In: Proceedings of the International Conference on Knowledge-Based and Intelligent Information and Engineering Systems (KES’08), pp. 384–393 (2008)

  22. Kramer, C., Prechelt, L.: Design recovery by automated search for structural design patterns in object oriented software. In: Proceedings of Working Conference on Reverse, Engineering (WCRE96), pp. 208–215 (1996)

  23. Manola, F., Miller, E.: RDF primer. W3C Recommendation (2004). Retrieved July 7 2012, from http://www.w3.org/TR/rdf-primer/

  24. Motik, B., Grau, B.C., Sattler, U.: Structured objects in OWL: representation and reasoning. In: Proceedings of the International World Wide Web Conference (WWW’08), pp. 555–564. Beijing, China (2008)

  25. Motik, B., Patel-Schneider, P.F., Grau, B.C.: OWL Web Ontology Language Reference. W3C Recommendation (2009). Retrieved 4 July 2012, from http://www.w3.org/TR/owl2-direct-semantics/

  26. Noy, F.N., McGuinness, D.L.: Ontology Development 101: A Guide to Creating your First Ontology. Stanford Knowledge System Laboratory Technical Report KSL-01-05 and Stanford Medical Informatics Technical, Report. SMI-2001-0880 (2001)

  27. O’Connor, M.J., Knublauch, H., Tu, S., Grosof, B., Dean, M., Grosso, W., Musen, M.: Supporting rule systems interoperability on the semantic web with SWRL. In: Proceedings of the 4th International Semantic Web Conference. Galway, Ireland (2005)

  28. Olson, D.L., Delen, D.: Advanced Data Mining Techniques. Springer, Verlag (2008)

    MATH  Google Scholar 

  29. Prud’hommeaux, E., Seaborne, A.: SPARQL query language for RDF. W3C Recommendation (2008). Retrieved 7 July 2012, from http://www.w3.org/TR/rdf-sparql-query/

  30. Rasool, G., Mader, P.: Flexible design pattern detection based on feature types. In: Proceedings of the International Conference on Automated Software Engineering (ASE’11), pp. 243–252. Lawrence, KS, USA (2011)

  31. Sartipi, K., Hu, L.: Behavior-driven design pattern recovery. In: Proceedings of the Twelfth International Conference on Software Engineering and Applications(SEA’08), pp. 179–185. Orlando, Florida, USA (2008)

  32. Shi, N., Olsson, R.A.: Reverse engineering of design patterns from Java source code. In: Proceedings of the 21st IEEE/ACM International Conference on Automated Software Engineering (ASE’06), pp. 123–132. Tokyo, Japan (2006)

  33. Sirin, E., Parsia, B., Grau, B.C., Kalyanpur, A., Kartz, Y.: Pellet: a practical OWL-DL reasoner. Web Semant. Sci Serv. Agents World Wide Web 5(2), 51–53 (2007)

    Article  Google Scholar 

  34. Tsantalis, T., Stephanides, A., Halkidis, S.: Design pattern detection using similarity scoring. IEEE Trans. Softw. Eng. 32(11), 896–909 (2006)

    Article  Google Scholar 

  35. Uschold, M., Healy, M., Williamson, K., Clark, P., Woods, S.: Ontology reuse and application. In: Proceedings of the 1st International Conference on Formal Ontology in Information Systems (FOIS 1998), pp. 179–192 (1998)

  36. Wang, W., Tzerpos, V.: Design pattern detection in Eiffel systems. In: Proceedings of the 12th Working Conference on Reverse, Engineering (WCRE’05), pp. 165–174 (2005)

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Awny Alnusair.

Additional information

A. Alnusair was partially supported by the Indiana University fellowship research grant.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Alnusair, A., Zhao, T. & Yan, G. Rule-based detection of design patterns in program code. Int J Softw Tools Technol Transfer 16, 315–334 (2014). https://doi.org/10.1007/s10009-013-0292-z

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10009-013-0292-z

Keywords

Navigation