Refactor or Die - Mikhail Matrosov - CppCon 2017

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Refactor or die

Mikhail Matrosov
Technical Manager at Align Technology
mmatrosov@aligntech.com
Refactor or die - Mikhail Matrosov - CppCon 2017 2
Refactor or die - Mikhail Matrosov - CppCon 2017 3
Impact=Risk=P(bug)=P(💀)

Business process

User

Application Functional change:


unlimited impact
Library
Refactoring:
Class
limited impact
Function

Refactor or die - Mikhail Matrosov - CppCon 2017 4


Functional change
P(💀)/LOC P(💀)/LOC Refactoring

💀
LOC touched LOC touched
Refactor or die - Mikhail Matrosov - CppCon 2017 5
Tests?
• Tests failed. What did we do wrong, exactly?
• Never 100% coverage
• Cannot test tests
• Cannot test users
• Easier to check that nothing changed than to check that a change is correct

Refactor or die - Mikhail Matrosov - CppCon 2017 6


• To fix a bug:
1. Refactor current code so that the bug is obvious and easy to fix
2. Fix the bug smoothly, with as little changes as possible
• To implement a feature:
1. Refactor current architecture so that the feature now fits into it
2. Implement the feature smoothly, with as little changes as possible
• Don’t forget to make separate commits

Refactor or die - Mikhail Matrosov - CppCon 2017 7


Kind of change

Modification
Bug fix
New feature
Refactoring
Trivial change

Refactor or die - Mikhail Matrosov - CppCon 2017 8


Kind of change Impact

Modification
Bug fix Unlimited
New feature
Refactoring
Limited
Trivial change

Refactor or die - Mikhail Matrosov - CppCon 2017 9


Kind of change Impact Mark

Modification (*)
Bug fix Unlimited (–)
New feature (+)
Refactoring (~)
Limited
Trivial change (=)

Refactor or die - Mikhail Matrosov - CppCon 2017 10


Kind of change Impact Mark Affected SemVer
version
Modification (*)
Major
Bug fix Unlimited (–)
New feature (+) Minor
Refactoring (~)
Limited Patch
Trivial change (=)

Refactor or die - Mikhail Matrosov - CppCon 2017 11


Kind of change Impact Mark Affected SemVer Reviewer
version attention
Modification (*)
Major High
Bug fix Unlimited (–)
New feature (+) Minor Moderate
Refactoring (~) Low
Limited Patch
Trivial change (=) None

Refactor or die - Mikhail Matrosov - CppCon 2017 12


Refactoring in progress…
Refactor or die - Mikhail Matrosov - CppCon 2017 13

You might also like