280 likes | 468 Views
Automated Source Code Changes Classification. for Effective Code Review and Analysis. Evgeny G. Knyazev Senior developer « Transas Technologies » Post-graduate student SPb State University of Information Technologies, Fine Mechanics and Optics. Source Code Review.
E N D
Automated Source Code Changes Classification for Effective Code Review and Analysis Evgeny G. Knyazev Senior developer «Transas Technologies» Post-graduate student SPb State University of Information Technologies, Fine Mechanics and Optics
Source Code Review • Informal source code look-through trying to find different kind problems in it
Source Code Review Helps to… • increase code quality • find errors on early stages • knowall code of a system • keep an eye on novices work
Source Control System andCode Changes Review • Source control system keeps development history • It allows to review only changed code Source Control System Change Request (Revision X) Review Developer
Changes Review Task Complexity • In large project a lot of changes need to be reviewed
The Solution • Split changes into classes • Chooseclassfor review
The solution (2) • Automate changes classification Source Control System Automated Changes Classifier Change Change Class Is This Class Interesting ? Developer Review Yes
KnownCode Changes ClassificationMethods • Changes Comments Classification • “bug”, “fixed” – a bug fix • “implement”, “feature” – new feature implementation • Refactoring Search Using Changes Metrics • Extract parent class (DIT>0 и NOM<0, …) • Move to other class (DIT=0 и NOM<0, …) • Split method(NOM < T, ...) • Difference Search in Semantic Graphs • Build code graph before and after the change • Generate transition script • Search refactoring templates
Changes Metrics • Calculated as subtraction of revisions metrics • ∆M = Mr–Mr-1 • CC – Cyclomatic Complexity (number of linearly independent paths in execution graph) • CS– number of Classes/Structures • eLOC– Effective Lines of Code (without empty and comment lines)
Metrics Calculationand Clustering of Changes fromNavi-Manager Project
Method Learning Example • Project: Navi-Manager • Size of Learning Set: 29 changes • Number of Clusters: 4
Classification Fuzziness • Change r16833 «Deleted an extra commit command» classified as: • On 2% as refactoring • On 79% as code deletion • On 0% as new functionality implementation • On 20% as bugfix
Project Manager Dev.Team Leader Source Code Developer Testing Team Leader Code Changes Classification in Software Development Process
Changes Control During Important Development Phases • Denypotentially destabilizing changes classes
Request List of Changes by Class • For Example: request refactoringslist done in specific versionX Automated Source Code Changes Classifier Dev Team Leader Request Refactorings in Version X List of Refactorings in VersionX List of Changes in Version X Source Control System
Achieved Results on Navi-Manager Project • Effectiveness • More than 50% time economy on code review • Development Problems Discover • Too much bugfixes comparing to new feature implementations
Automated Changes Classification Tool • Works with Subversion • Low depended from program language • CalculatesCC, CS, eLOC metrics • Discovers change classes: • New feature implementation • Code deletion • Refactoring • Cosmetic Changes • Bugfixes*
Future Research • Method improvements • Gustavson-Kessel Clustering • Object and coupling metrics usage • Refactorings classification • Application widening • Usage in development process on constant basis • Adaptability analysis for different types of projects
Thank you! Any questions? evgeny.knyazev@gmail.com