Top Banner

Click here to load reader

WCRE09b.ppt

Feb 10, 2017

Download

Technology

Ptidej Team
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • BackgroundBackground

    Work on the detection of bad smells

    Idea is that when something smells bad, it should be changed

    02/08/10 1WCRE2009 - S. Vaucher et al.

  • Open IssuesOpen Issues

    Identify factors that cause these smells to guide engineering efforts for : Prevention

    Detection

    Correction

    02/08/10 2WCRE2009 - S. Vaucher et al.

  • How to Track SmellsHow to Track Smells

    Use a nose

    Follow the evolution of a smell

    02/08/10 3WCRE2009 - S. Vaucher et al.

  • Overview of the PresentationOverview of the Presentation

    Nose

    Systems

    Analysis

    Results

    Thoughts on prevention and correction

    02/08/10 WCRE2009 - S. Vaucher et al. 4

  • The Nose

    02/08/10 WCRE2009 - S. Vaucher et al. 5

  • The Nose The Nose In two slides (1)In two slides (1)

    We built one in previous work [QSIC2009]

    Works with God classes

    Probability of a God class given symptoms: Cohesion

    Naming

    Size

    Presence of data classes

    02/08/10 6WCRE2009 - S. Vaucher et al.

  • Nose Nose In Two Slides (2)In Two Slides (2)

    Size Lexical Little Cohesion

    Deals with data classes

    Large Controller Class?

    God class?

    MAX MAX MAX MAX

    47%

    Conditional probabilities

    02/08/10 7WCRE2009 - S. Vaucher et al.

  • Systems

    02/08/10 8WCRE2009 - S. Vaucher et al.

  • Xerces-J Eclipse JDT

    02/08/10 9WCRE2009 - S. Vaucher et al.

  • System statisticsSystem statistics

    Xerces-J Eclipse JDT

    10-15% god classes

    70% start as god classes

    30% of god classes are deleted

    2% god classes

    61% start as god classes

    19% of god classes are deleted

    02/08/10 10WCRE2009 - S. Vaucher et al.

  • Analysis

    02/08/10 WCRE2009 - S. Vaucher et al. 11

  • 3 Step Program 3 Step Program -- AnalysisAnalysis

    Find patterns in the evolution of the smell

    Label these patterns

    Analyse the commonalities of these patterns

    02/08/10 12WCRE2009 - S. Vaucher et al.

  • DataData02/08/10 13WCRE2009 - S. Vaucher et al.

  • TimeTime--independent Analysisindependent Analysis

    Use DTW to compare time-independent signals

    Apply clustering to discover patterns

    Apply classification to group and analyse

    02/08/10 14WCRE2009 - S. Vaucher et al.

  • Finding PatternsFinding Patterns

    Hierarchical agglomerative clustering using DTW as a distance measure

    Constant (smelly)

    Gradualimprovement

    Sharpimprovement

    Gradualdegradation

    Sharpdegradation

    TemporaryRelief

    Temporarybadness

    Time

    Sig

    nal

    02/08/10 15WCRE2009 - S. Vaucher et al.

  • Classifying PatternsClassifying Patterns02/08/10 16WCRE2009 - S. Vaucher et al.

  • Pattern DistributionPattern Distribution

    Xerces-J Eclipse JDT

    02/08/10 17WCRE2009 - S. Vaucher et al.

  • Constant PatternConstant Pattern

    ~65% are always smelly

    Questions: Quick and dirty design or willful decision? Look for signs of design effort

    Ask the developers

    02/08/10 18WCRE2009 - S. Vaucher et al.

  • Constant Pattern Constant Pattern -- ResultsResults

    Xerces main developer mentioned that problems were complex and required complex design

    Similarly, 82% of classes play a role in a design pattern

    The code is not a hack

    02/08/10 19WCRE2009 - S. Vaucher et al.

  • DegradationDegradation

    ~18% of smelly classes were okay initially

    In most cases, sharp degradation occurs when developers add data classes to already large class

    Degradation always requires new code to be added

    02/08/10 20WCRE2009 - S. Vaucher et al.

  • Degradation Degradation growth trends in growth trends in

    XercesXerces

    02/08/10 21WCRE2009 - S. Vaucher

  • ImprovementsImprovements

    More classes are removed than are corrected (30% in Xerces)

    Reason justifying the study of antipatterns is to find some standard solutions

    Were they used?

    02/08/10 22WCRE2009 - S. Vaucher et al.

  • Improvements Improvements results results

    Eclipse, lots of added responsibility to data classes (rebalancing)

    Xerces, few textbook refactorings

    Not obvious since design correction often occurs with enhancements

    02/08/10 WCRE2009 - S. Vaucher et al. 23

  • PreventionPrevention

    Rule mining:

    When large amounts of code are added to a class, the probability of it being a god class increases

    Inputs: Use code/method change metrics (added/removed/modified)

    Current state (clean, borderline, smelly)

    Output: Increase, stable, decrease probability of god class

    02/08/10 WCRE2009 - S. Vaucher et al. 24

  • Rules Rules 02/08/10 WCRE2009 - S. Vaucher et al. 25

  • Correcting god classesCorrecting god classes

    Gap between theoretical refactorings and their applications.

    Too little cohesion (LCOM5): should lead to an extract class refactoring, but almost never used (and metric change not reflected)

    Responsibility distribution: move methods. Done more regularly, but almost never from god to data class

    02/08/10 WCRE2009 - S. Vaucher et al. 26

  • What was saidWhat was said

    Methodology to track smells in systems

    Discussed the introduction and removal of smells in two open-source systems

    02/08/10 WCRE2009 - S. Vaucher et al. 27

  • What to rememberWhat to remember

    Most god classes tends to be god classes from the start and do not improve

    More deletions than improvements

    Improvements are hard to classify

    Degradation is the result of significant growth (>100%), or because responsibilities are unbalanced

    02/08/10 WCRE2009 - S. Vaucher et al. 28

    et al.