SlideServe
Menu
Préférences
© SlideServe · v2026

Identification of Refused Bequest Code Smells

ide avatar
9 diapositives · 329 Views · Sep 30, 2014

Identification of Refused Bequest Code Smells E. Ligu, A. Chatzigeorgiou , T. Chaikalis, N. Ygeionomakis Department of Applied Informatics University of Macedonia, Greece. ICSM’2013, Early Research Achievements Track, September 24, 2013. Context. Mammal.

Identification of Refused Bequest Code Smells - slide 1
01 / 9Identification of Refused Bequest Code Smells
1 / 17

Télécharger la présentation

Identification of Refused Bequest Code Smells
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Identification of Refused Bequest Code Smells E. Ligu, A. Chatzigeorgiou, T. Chaikalis, N. Ygeionomakis Department of Applied Informatics University of Macedonia, Greece ICSM’2013, Early Research Achievements Track, September 24, 2013

  2. Context Mammal In the world of OO systems, inheritance is not a panacea + breatheAir() + regulateBodyTemp() + giveBirthToLiveYoung() + produceMilkIfFemale() + swim() + breatheAir() + regulateBodyTemp() + giveBirthToLiveYoung() + produceMilkIfFemale() + swim() + breatheAir() + regulateBodyTemp() + giveBirthToLiveYoung() + produceMilkIfFemale() + swim()

  3. Problem Goal: Identification of Refused Bequest Code Smells Refused Bequest: “a subclass does not want to support the interface inherited from its parent class” [Fowler] non-trivial problem to resolve Appropriate Refactoring: Replace Inheritance with Delegation Famous quote: “Favor Composition over Inheritance” [GoF]

  4. Key Concept public interface which is inherited OK is the subclass using the inherited interface? indication of Refused Bequest

  5. Smell Thermometer • Signs of Refused Bequest : • no superclass method is overridden • no inherited method is invoked on subclass instances • no super class method invocations • No argument in favor of inheritance • Refused Bequest is highly improbable: • inherited methods have been re-implemented to provide functionality that is specific to the subclass->goal is to enable polymorphism. • the presence of errors ->inherited functionality is actually employed.

  6. Example SweetHome 3D v.4.0 LOC: 76K, 460 classes, 69 hierarchies, 42 test cases

  7. Tool Implementation on top of the JDeodorant tool http://java.uom.gr/ref_bequest/

  8. Threat to Validity Assumption: unit tests exercise thoroughly system functionality Threat to construct validity: introduced errors might not lead to test failures because tests have not been designed to cause the invocation of the corresponding methods and not because the methods are not actually utilized. Mitigation: perform identification on projects with extensive test coverage

  9. Question 1 (academic): Would you trust an automated tool to identify and resolve design defects on its own? Question 2 (provocative): Do you think that industrial engineers actually regard the resolution of smells as a (serious) way to improve the code? ICSM’2013, Early Research Achievements Track, September 24, 2013