DOI QR코드

DOI QR Code

A Catalog of Bad Smells in Design-by-Contract Methodologies with Java Modeling Language

  • Viana, Thiago (Coordenacao de Sistemas de Informacao, Instituto Federal de Pernambuco)
  • 투고 : 2013.07.24
  • 심사 : 2013.08.12
  • 발행 : 2013.12.30

초록

Bad smells are usually related to program source code, arising from bad design and programming practices. Refactoring activities are often motivated by the detection of bad smells. With the increasing adoption of Design-by-Contract (DBC) methodologies in formal software development, evidence of bad design practices can similarly be found in programs that combine actual production code with interface contracts. These contracts can be written in languages, such as the Java Modeling Language (JML), an extension to the Java syntax. This paper presents a catalog of bad smells that appear during DBC practice, considering JML as the language for specifying contracts. These smells are described over JML constructs, although several can appear in other DBC languages. The catalog contains 6 DBC smells. We evaluate the recurrence of DBC smells in two ways: first by describing a small study with graduate student projects, and second by counting occurrences of smells in contracts from the JML models application programming interface (API). This API contains classes with more than 1,600 lines in contracts. Along with the documented smells, suggestions are provided for minimizing the impact or even removing a bad smell. It is believed that initiatives towards the cataloging of bad smells are useful for establishing good design practices in DBC.

키워드

참고문헌

  1. M. Fowler, K. Beck, J. Brant, W. Opdyke, and D. Roberts, Refactoring: Improving the Design of Existing Code, Boston, MA: Addison-Wesley, 1999.
  2. B. Meyer, "Design by contract," Advances in Object-Oriented Software Engineering, D. Mandrioli and B. Meyer, editors, New York, NY: Prentice-Hall, 1992, pp. 1-50.
  3. B. Meyer, Eiffel: The Language, New York, NY: Prentice-Hall, 1992.
  4. L. Burdy, Y. Cheon, D. R. Cok, M. D. Ernst, J. R. Kiniry, G.T. Leavens, K. R. M. Leino, and E. Poll, "An overview of JML tools and applications," International Journal on Software Tools for Technology Transfer, vol. 7, no. 3, pp. 212-232, 2005. https://doi.org/10.1007/s10009-004-0167-4
  5. G. T. Leavens and Y. Cheon, "Design by contract with JML," ftp://ftp.cs.iastate.edu/pub/leavens/JML/jmldbc.pdf.
  6. G. T. Leavens, E. Poll, C. Clifton, Y. Cheon, C. Ruby, D. Cok, P. Muller, J. Kiniry, P. Chalin, D. M. Zimmerman, and W. Dietl, "JML reference manual," Technical Report, 2008.
  7. L. Lamport, LATEX: A Documentation Preparation System: User's Guide and Reference Manual, Reading, MA: Addison-Wesley, 1994.
  8. G. T. Leavens, C. Ruby, and A. L. Baker, "Package org.jmlspecs.models," http://www.eecs.ucf.edu/-leavens/JML-release/javadocs/org/jmlspecs/models/package-summary.html.
  9. W. C. Wake, Refactoring Workbook, Boston, MA: Addison-Wesley, 2003.
  10. M. Barnett, K. R. M. Leino, and W. Schulte, "The spec# programming system: an overview," in Proceedings of the International Workshop on Construction and Analysis of Safe, Secure, and Interoperable Smart Devices, Marseille, France, 2004, pp. 49-69.
  11. D. Jackson, Software Abstractions: Logic, Language and Analysis, Cambridge, MA: MIT Press, 2006.
  12. R. Mitchell and J. McKim, Design by Contract, by Example, Boston, MA: Addison-Wesley, 2002.
  13. A. Darvas and P. Muller, "Faithful mapping of model classes to mathematical structures," IET Software, vol. 2, no. 6, pp. 477-499, 2008. https://doi.org/10.1049/iet-sen:20080011
  14. M. Mantyla, J. Vanhanen, and C. Lassenius, "A taxonomy and an initial empirical study of bad smells in code," in Proceedings of the International Conference on Software Maintenance, Amsterdam, The Netherlands, 2003, pp. 381-384.
  15. J. Garcia, D. Popescu, G. Edwards, and N. Medvidovic, "Identifying architectural bad smells," in Proceedings of the 13th European Conference on Software Maintenance and Reengineering, Kaiserslautern, Germany, 2009, pp. 255-258.
  16. N. Tsantalis, T. Chaikalis, and A. Chatzigeorgiou, "JDeodorant: identification and removal of type-checking bad smells," in Proceedings of the 12th European Conference on Software Maintenance and Reengineering, Athens, Greece, 2008, pp. 329-331.
  17. A. Correa, C. Werner, and M. Barros, "An empirical study of the impact of OCL smells and refactorings on the understandability of OCL specifications," in Proceedings of the ACM/IEEE 10th International Conference on Model Driven Engineering Languages and Systems, Nashville, TN, 2007, pp.76-90.
  18. Object Management Group (OMG), UML 2.0 OCL Specification, OMG Adopted Specification ptc/03-10-14, 2003.
  19. J. Cabot and E. Teniente, "Transformation techniques for OCL constraints," Science of Computer Programming, vol. 68, no. 3, pp. 179-195, 2007. https://doi.org/10.1016/j.scico.2007.05.001
  20. L. Reynoso, M. Genero, M. Piattini, and E. Manso, "Does object coupling really affect the understanding and modifying of OCL expressions?" in Proceedings of the ACM Symposium on Applied Computing, Dijon, France, 2006, pp. 1721-1727.
  21. T. L. Massoni, R. Gheyi, and P. Borba, "An approach to invariant-based program refactoring," in Proceedings of the 3rd Workshop on Software Evolution through Transformations: Embracing the Change, Natal, Brazil, 2006.
  22. T. Massoni, R. Gheyi, and P. Borba, "Formal model-driven program refactoring," in Proceedings of the 11th International Conference on Fundamental Approaches to Software Engineering, Budapest, Hungary, 2008, pp. 362-376.