thoughtworks brazil, code quality
DESCRIPTION
Talk to TW'ers in Brazil, focussing on code quality and understanding what that means.TRANSCRIPT
Ola.
You’re making me refactor.
You won’t like me when I refactor
Refactoring?
ThoughtWorks
a change made to the internal structure of so=ware to make it easier to understand and cheaper
to modify without changing its observable behavior
Don't touch anything that doesn't have coverage.
Otherwise, you're not refactoring; you're just changing shit
ThoughtWorks
a change made to the internal structure of so=ware to make it
easier to understand and cheaper to modify without changing its observable behavior
SomeHmes it just feels right.
Step 1: Measure the
toxicity.
Smells in the code
CyclomaHc Complexity
5 to 7 is decent for most ruby code
Saikuro
Assignments, Branches, Calls with Flog
Watch for scores greater than 40
Flog
DuplicaHon with Flay
Watch for scores greater than 30
Control Couples and more with Reek
Simulated Polymorphism Feature Envy UHlity Methods
LinHng with Dust/Nitpick
JSLint for Ruby
Common smells in Ruby
PrimiHve Obsession
Feature Envy
Meta-‐programming
Keep it simple. Keep it declaraHve
Toxicity is more than code smells
“The real problem I have with the CK suite and similar metrics is that they only measure a single module (or class in this case). I claim that the quality of the design of a system is not something that can be determined by looking at individual classes. It is conceivable that every class in a system could be considered reasonable by whatever single-‐class metrics are being used, but the overall design is considered bad.”
hDp://www.cs.auckland.ac.nz/~ewan/
Ewan Tempero: A Research Agenda
DEPENDENCY
Tangles
Step 2: Make it visible
Treemaps (Max CC)
hbp://mbostock.github.com/protovis/
Treemaps
Dependency matrix
Step 3: Agree on the fix
Step 4: Go fix it
Obrigado