Skip to main content

Advertisement

Log in

What you like in design use to correct bad-smells

  • Published:
Software Quality Journal Aims and scope Submit manuscript

Abstract

Over the past decades, many techniques and tools have been developed to support maintenance activities in order to improve software quality. One of the most efficient ones is software refactoring to eliminate bad-smells. A majority of existing work propose “standard” refactoring solutions that can be applied by hand for each kind of defect. However, it is difficult to prove or ensure the generality of these solutions to any kind of bad-smells or software codes. In this paper, we propose an approach to correct bad-smells using well-designed code. We use genetic algorithms to generate correction solutions defined as a combination of refactoring operations that maximize, as much as possible, the similarity between the corrected bad-smells and examples of well-designed code. We report the results of an evaluation of our approach using four open-source projects. Our proposal achieved high correction scores by fixing the majority of expected bad-smells.

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
Fig. 9
Fig. 10

Similar content being viewed by others

References

  • Alikacem, H. & Sahraoui, H. (2006). Détection d’anomalies utilisant un langage de description de règle de qualité, in actes du 12e colloque LMO.

  • Bratko, I. & Muggleton, S. (1995). Applications of inductive logic programming. In Communications of the ACM 38, 11, (pp. 65–70).

  • Brown, W. J., Malveau, R. C., Brown, W. H., McCormick, H. W., I. I. I., & Mowbray, T. J. (1998). Anti patterns: Refactoring software, architectures, and projects in crisis (1st ed.). March: John Wiley and Sons.

    Google Scholar 

  • Brudno, M. (2004). Algorithms for comparison of dna sequences. Ph.D. dissertation, Stanford, CA, USA, adviser-Batzoglou, Serafim.

  • Dhambri, K., Sahraoui, H. A. & Poulin, P. (2008). Visual detection of design anomalies. In CSMR. IEEE (pp. 279–283).

  • Erni, K., & Lewerentz, C. (1996). Applying design metrics to object-oriented frameworks, In Proceedings of the IEEE symposium software metrics, IEEE Computer Society Press.

  • Fowler, M. (1999). Refactoring: Improving the design of existing code (1st ed.). USA: Addison-Wesley.

    Google Scholar 

  • Goldberg, D. E. (1989). Genetic algorithms in search, optimization and machine learning. Boston, MA, USA: Addison-Wesley Longman Publishing Co., Inc.

    MATH  Google Scholar 

  • Grant, S. & Cordy, J. R. (2003). An interactive interface for refactoring using source transformation. In Proceedings of the first international workshop on refactoring: achievements, challenges, effects (REFACE’03) (pp. 30–33).

  • Guéhéneuc, Y.-G. & H. Albin-Amiot. (2001). Using design patterns and constraints to automate the detection and correction of inter-class design defects. In Li, Q., Riehle, R., Pour, G., & Meyer, B., (Eds) In Proceedings of the 39th conference on the technology of object-oriented languages and systems, (pp. 296–305). IEEE Computer Society Press.

  • Harman, M. & Clark, J. A. (2004). Metrics are fitness functions too. In IEEE METRICS. IEEE Computer Society (pp. 58–69).

  • Heckel, R. (1995). Algebraic graph transformations with application conditions. M.S. thesis, TU Berlin.

  • Izurieta, C. & Bieman, J. M. (2012). A multiple case study of design pattern decay, grime, and rot in evolving software systems. Springer Software Quality Journal, ISSN: 0963-9314. doi:10.1007/s11219-012-9175-x.

  • Kamiya, T., Kusumoto, S., & Inoue, K. (2002). CCFinder: A multilinguistic token-based code clone detection system for large scale source code. TSE, 28(7), 654–670.

    Google Scholar 

  • Kataoka, Y., Ernst, M. D., Griswold, W. G., & Notkin, D. (2001). Automated support for program refactoring using invariants. In Proceedings Int’l conference software maintenance (pp. 736–743). IEEE Computer Society.

  • Kessentini, M., Kessentini, W., Sahraoui, H., Boukadoum, M. & Ouni, A. (2011). Design defects detection and correction by example. In Proceedings of the ICPC 2011, IEEE, (pp. 81–90).

  • Kessentini, M., Sahraoui, H. A., Boukadoum, M., & Wimmer, M. (2011) Search-based design defects detection by example. In 15th international conference on fundamental approaches to software engineering, FASE (pp. 401–415). IEEE Computer Society.

  • Kessentini, M., Vaucher, S., & Sahraoui, H. (2010). Deviance from perfection is a better criterion than closeness to evil when identifying risky code, In Proceedings of the international conference on automated software engineering. ASE’10.

  • Khomh, F., Vaucher, S., Guéhéneuc, Y.-G., & Sahraoui, H. (2009). A bayesian approach for the detection of code and design smells, In Proceedings of the ICQS’09.

  • Kirkpatrick, S., Gelatt, C. D., & Vecchi, M. P. (1983). Optimization by simulated annealing. Science, 220, 671–679.

    Article  MathSciNet  MATH  Google Scholar 

  • Kothari, S. C., Bishop, L., Sauceda, J., & Daugherty, G. (2004). A pattern-based framework for software anomaly detection. Software Quality Journal, 12(2), 99–120.

    Article  Google Scholar 

  • Koza, J. R. (1992). Genetic programming: On the programming of computers by means of natural selection. Cambridge, MA, USA: MIT Press.

    MATH  Google Scholar 

  • Liu, H., Yang, L., Niu, Z., Ma, Z., & Shao, W. (2012).Facilitating software refactoring with appropriate resolution order of bad smells, In Proceedings of the ESEC/FSE’09 (pp. 265–268).

  • Kim, M., Sazawal, V., & Notkin, D. (2005). An empirical study of code clone genealogies. In ESEC/FSE (pp. 187–196).

  • Mantyla, M., Vanhanen, J., & Lassenius, C. (2003). A taxonomy and an initial empirical study of bad smells in code, In Proceedings of the ICSM’03, IEEE Computer Society.

  • Marinescu, R. (2011). Detection strategies: Metrics-based rules for detecting design flaws, In Proceedings of ICM’04 (pp. 350–359).

  • Mens, T., & Tourwé, T. (2004). A survey of software refactoring. IEEE Transactions on Software Engineering, 30(2), 126–139.

    Article  Google Scholar 

  • Moha, N., Guéhéneuc, Y.-G., Duchien, L. & Meur, A.-F., Decor, L. (2009). A method for the specification and detection of code and design smells. Transactions on Software Engineering (TSE), (p. 16).

  • Nanni, L., & Lumini, A. (2008). Generalized needleman-wunsch algorithm for the recognition of t-cell epitopes. Expert Systems with Applications, 35(3), 1463–1467.

    Article  Google Scholar 

  • O’Keeffe, M., & Cinnéide, M. (2008). Search-based refactoring: An empirical study. Journal of Software Maintenance, 20(5), 345–364.

    Google Scholar 

  • Opdyke, W. F. (1992). Refactoring: A program restructuring aid in designing object-oriented application frameworks. Ph.D. thesis, University of Illinois at Urbana-Champaign.

  • Raedt, D. (1996). Advances in inductive logic programming, 1st. Amsterdam: IOS Press.

    Google Scholar 

  • Sahraoui, H. A., Godin, R., & Miceli, T. (2000). Can metrics help to bridge the gap between the improvement of oo design quality and its automation? In ICSM’00 : Proceedings of the international conference on software maintenance (ICSM’00), (p 154). Washington, DC, USA. IEEE Computer Society. ISBN: 0-7695-0753-0.

  • Simon, F., Steinbr¨uckner, F., & Lewerentz, C. (2001). Metrics based refactoring. In Proceedings of the European conference software maintenance and reengineering (pp. 30–38). IEEE Computer Society.

  • Tahvildari, L. & Kontogiannis, K. (2004). Improving design quality using meta-pattern transformations: a metric-based approach. Journal of Software Maintenance, 16(4–5):331–361.

    Google Scholar 

  • Van Belle, T. & Ackley, D. H. (2002). Code factoring and the evolution of evolvability. In Proceedings of the genetic and evolutionary computation conference (GECCO ‘02) (pp. 1383–1390). Morgan Kaufmann Publishers Inc., San Francisco, CA, USA.

  • www.jhotdraw.org/.

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Marouane Kessentini.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Kessentini, M., Mahaouachi, R. & Ghedira, K. What you like in design use to correct bad-smells. Software Qual J 21, 551–571 (2013). https://doi.org/10.1007/s11219-012-9187-6

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11219-012-9187-6

Keywords

Navigation