Download presentation
Presentation is loading. Please wait.
Published byHartanti Hartanto Modified over 6 years ago
1
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 Работа выполняется в рамках работы над кандидатской диссертацией. Результаты апробируются в процессе работы в Транзас Технологии.
2
Source Code Review Informal source code look-through trying to find different kind problems in it
3
Source Code Review Helps to…
increase code quality find errors on early stages know all code of a system keep an eye on novices work
4
Source Control System and Code Changes Review
Source control system keeps development history It allows to review only changed code Change Request (Revision X) Review Developer
5
Code Change Review Example
6
Changes Review Task Complexity
In large project a lot of changes need to be reviewed Project Tortoise SVN Navi-Manager KDE Size, LOC ~ 200 thousand ~ 250 thousand ~ 4.7 million Observation Period ~1 month Changes Count 215 72 11841 (!)
7
New Functionality Implementation
The Solution Split changes into classes Choose class for review New Functionality Implementation Refactoring Bugfix Cosmetics Code Deletion
8
The solution (2) Automate changes classification Source Control System
Automated Changes Classifier Change Change Class Is This Class Interesting ? Developer Review Yes
9
Known Code Changes Classification Methods
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
10
Changes Metrics Clustering Method: Learning Phase
1. Learning Set Preparation 2. Expert Classification of Learning Set 3. Change Metrics Calculation 4. Change Metrics Vectors Clustering 5. Mapping Clusters to Expert Classes
11
Fuzzy Change Metrics Clustering Algorithm
12
Changes Metrics Clustering Method: Changes Classification
1. Changes Metrics Calculation 2. Map Changes to Nearest Clusters of Learning Set 3. Computation of Change Class by Cluster-Class Mapping, Built During Learning
13
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)
14
Metrics Calculation and Clustering of Changes from Navi-Manager Project
Revision CC IC eLOC Nearest Cluster Change Comment 16820 -2 +1 -5 1 Vessel objects now merged in one transaction. 16833 -1 2 Deleted an extra commit command. 17026 +4 +18 3 Full format of lat and lon during polling report. 17029 4 Set MessageSource.UpdateTime after processing of each change. 17038 Revert changes from r There’s no need to update time after each message processed. 17107 +12 +89 Implementation of first version of vessel tracks loading from MonServer.
15
Fuzzy Clusters of Revisions Table
Revision / Cluster 1 2 3 4 16820 0,78 0,14 0,00 0,08 16833 0,02 0,79 0,20 17026 0,21 0,32 0,11 0,36 17029 0,03 0,30 0,67 17038 17107 0,1 0,68
16
Method Learning Example
Project: Navi-Manager Size of Learning Set: 29 changes Number of Clusters: 4 Cluster Expert Class 1 Refactoring 2 Code Deletion 3 New Functionality Implementation 4 Bugfix
17
Classification Example
Revision Nearest Class Nearest Cluster Change Comment 16820 Refactor. 1 Vessel objects now merged in one transaction. 16833 Delete Func. 2 Deleted an extra commit command. 17026 New Feature 3 Full format of lat and lon during polling report. 17029 Bugfix 4 Set MessageSource.UpdateTime after processing of each change. 17038 Del. Func. Revert changes from r There’s no need to update time after each message processed. 17107 Implementation of first version of vessel tracks loading from MonServer.
18
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
19
Code Changes Classification in Software Development Process
Dev.Team Leader Testing Team Developer Project Manager Source Code
20
Changes Control During Important Development Phases
Deny potentially destabilizing changes classes Dev Phase Main Dev Cycle Stop Сode Code Freeze Change Class New Functionality Implementation + – Code Deletion Refactoring Small Bugfixes Critical Bugfixes
21
Request List of Changes by Class
For Example: request refactorings list done in specific version X Automated Source Code Changes Classifier Dev Team Leader Request Refactorings in Version X List of Refactorings in Version X List of Changes in Version X Source Control System
22
Project Statistics Analysis
23
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
24
Automated Changes Classification Tool
Works with Subversion Low depended from program language Calculates CC, CS, eLOC metrics Discovers change classes: New feature implementation Code deletion Refactoring Cosmetic Changes Bugfixes* * Исправление ошибки классифицируется по остаточному принципу: что не классифицируется как любой другой класс, есть исправление ошибки.
25
Future Research Method improvements Refactorings classification
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
26
Thank you! Any questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.