FUTURE CHALLENGES IN SOFTWARE EVOLUTION AND QUALITY ANALYSIS FROM INDUSTRIAL & ACADEMIC PERSPECTIVES Aiko Yamashita, PhD. Centrum Wiskunde & Informatica, Netherlands Oslo and Akershus University College of Applied Sciences, Norway 2016-12-01
A SHORT INTRO ABOUT ME.. Oslo, Norway Gothenburg, Sweden Amsterdam, Netherlands Sapporo, Japan Berkeley, USA San Francisco, USA mom San Jose, Costa Rica dad
Career trayectory...
A METRICS APPROACH FOR SOFTWARE EVOLUTION AND MAINTENANCE Unstructured data Code/Design attributes High-level research focus/question: 00101001 11011011 00010110 00101001 Historical How can we use different ** data Reports metrics to attain better maintainability assessments and to support software Heuristics evolution-related activities? Evaluation/ estimation Heuristics for 8 0 Design programmers 50 restructuring 90 **product-related and project-related (empirical) metrics
METRICS FOCUS: CODE SMELLS A hint about suboptimal implementation choices that can affect negatively future maintenance and evolution.
METRICS FOCUS: CODE SMELLS Shotgun Surgery A change leads to another change, to another, to another.. Move method refactoring Reduce the coupling between components
METRICS FOCUS: CODE SMELLS State of art Detection Tooling Analyze4J D InFusion/InCode PTIDEJ / DECOR JDeodorant NDepend Challenges • Refactoring ROI not clear : e.g., to eliminate a code smell implies a cost (refactoring, rework) and a risk (introduction defects). • Not clear in which contexts (e.g., activities) smell-based analysis performs best , and which are the preconditions (e.g., additional data) required.
LETS GET EMPIRICAL! Goal: Assess wether code smells can be used effectively for assesing the maintainability of software. Research method: Longitudinal, in-vivo case study investigating a Maintenance Project involving 4 Java systems and 6 software professionals. Research techniques: case replication, cross-case synthesis, explanatory models (e.g., regression), grounded theory.
EMPIRICAL STUDY Context Maintenance Tasks • 4 Java Applications Task 1 . Replacing external data source • Same functionality • Different design/code ✔ • Size: 7KLOC to 14KLOC Study Design System System ! D C A B System Task 3 . New Reporting Task 2 . functionality New authentication mechanism Developer
INSIDE THE BELLY OF THE MONSTER fact-sheet • 50,000 Euros • Sep-Dec, 2008 • 7 Weeks Project context • 6 Developers Tasks Programming Development • 2 Companies Moderator System Skill Technology variables Maintenance outcomes Maintainability Effort** Code smells Variables perception* (num. smells** of interest smell density**) Change Maintenance Defects* Size** problems** Open interviews Subversion Audio files/notes Think aloud Task Eclipse database progress activity Video files/notes sheets logs Data Source code sources Trac (Issue tracker), Think aloud Daily interviews Study Acceptance test Video files/notes Audio files/notes diary reports ** System and f le level * Only at system level
LET’S GET SOME “PERSPECTIVES” Aggregated Individual Interconnected
Can code smells Indicate system-level maintainability? Actual Maintainability Maintainability Assessment Systems were ranked Systems were ranked a c c o r d i n g t o t h e i r according to their no. of Do they maintainability, which was code smells, and their smell correspomd? measured by: effort (time) density (no. smells/KLOC). and defects introduced. Standardized scores were calculated for the ranking In addition, smell-based assessment was compared to two previous assessments (CK metrics and Expert judgment) on the systems
Can code smells Indicate system-level maintainability?
Can code smells Indicate system-level maintainability? Number of code smells displayed highest correspondence to actual maintainability Number of code smells is correlated with system size! Expert Judgment was considered as the most flexible approach, because it considers both the effects of system size and potential maintenance scenarios
Do code smell cover important maintainability attributes? Not covered D Appropriate technical platform C A B Coherent naming System Design suited to the problem domain Initial defects Architecture Developer Audio fj le Partially covered Encapsulation Inheritance Libraries Simplicity Transcript Use of components Design consistency Coded Statement Logic Spread Maintainability Factor Covered Duplicated code Cross-case Matrix
LET’S GET SOME “PERSPECTIVES” Aggregated Individual Interconnected
Can code smells explain maintenance effort or problems? Explanatory model for Problem Explanatory model for Effort Dependent variable: Problematic? Dependent variable: Effort (time) Independent variables: 12 smells Independent variables: 12 smells Control variables: Control variables: • File size (LOC) • File size (LOC) • Churn • Number of revisions on a file • System • System • Developer • Round Analysis: Multiple Regression Model Analysis: Logistic Regression Model In addition, principal component analysis (PCA) on the code smell distribution and qualitative analysis was performed.
Can code smells explain maintenance effort or problems? Explanatory model for Problem Explanatory model for Effort • Interface Segregation Principle Violation • A model that includes file size and (ISPV) was able to explain problems number of changes and code smells [Exp(B) = 7.610, p = 0.032] displayed a fit of R2 = 0.58 Some code smells can potentially Code smells are not better at • Data Clump significant contributor of explain the occurrence of • Removing the smells from that model explaining sheer-effort at file model [Exp(B) = 0.053, p = 0.029] but problems during maintenance. did not decrease the fit!! (R2 = 0.58) level, than size and number of associated to less problems! Also, not all smells seem to be revisions. • Only smell that remained significant • PCA indicated that ISPV tends to not problematic… was Refused Bequest, which registered a be associated to code smells that are decrease in effort ( α < 0.01) related to size. • File size and number of changes remain • Qualitative data suggests that ISPV is the most significant predictors of effort related to error/change propagation, and ( α < 0.001) difficult concept location.
LET’S GET SOME “PERSPECTIVES” Aggregated Individual Interconnected
To what extent can code smells explain maintenance problems? Analysis % Non-Source code related difficulties ¡Observa)onal ¡study % Code-smell ¡Daily ¡interviews related difficulties ¡Think-‑aloud ¡protocol % Non-code-smell Maintenance % Source code related difficulties Difficulties related difficulties Principal Component Analysis Dependency Analysis
To what extent can code smells explain maintenance problems? Distribution of maintenance problems according to source
How do Code Smells interact with one another? Some patterns where identified.. Hoarders Feature Envy God Class have dependencies God Method on Data Containers Data Clump could are often found Data Class become together with could Confounders become Wide Interfaces Temporal variable used for several purposes ISP Violation Duplicated code in Shotgun Surgery conditional brances
How do Code Smells interact with one another? P r o b l e m a t i c fi l e s w i t h a t l e a s t o n e G o d M e t h o d System Temp ISPV DUP GM Imp MC DC GC CL RB FE SS File Coupled smells can have similar StudyDatabase A 0 0 0 7 0 1 1 0 0 1 1 1 implications as collocated smells! PrivilegesManageAction B 0 0 0 0 0 1 0 0 0 0 1 0 StudiesEditAction B 0 0 0 0 1 2 0 0 0 0 0 0 StudiesSearchAction B 0 0 0 1 0 1 0 0 0 0 1 0 A B StudySearch B 0 0 0 2 1 2 0 0 0 0 0 0 DB C 0 0 2 16 1 2 1 0 0 0 1 0 ≈ God Class StudyDAO D 0 0 1 10 1 2 1 0 0 1 1 0 God Class Feature Envy Coupling Feature Envy S y s t e m B : Hoarders in System B and how they are distributed across two co Individual File Coupled smells code smells StudySearch.java GC, GM, FE FE, GM, ISPV, GC, SS ObjectStatementImpl.java ISPV, SS MemoryCachingSimula.java GC, TMP ISPV, GC, SS, TMP Simula.java ISPV, SS
How do Code Smells interact with one another? An interesting example case for the interaction effect between code smells and other design flaws… Typed getters and setters
OVERALL FINDINGS • Aggregated and individual code smell analyses are insufficient to understand the role of code smells on maintenance • Code smells interact! (collocated and coupled code smells) • An approach (more promising?) is to incorporate dependency analysis to the study of individual code smells . • There may be other smells not yet discovered… • Role of code smells are dependent of the maintenance context (ex. Data Clumps)
FOLLOW-UP STUDIES?
Recommend
More recommend