by @softwaregarden Ego Boost(seriously now) • Principal Software Engineer @ • Co-author of “SonarQube in Action” book • Software Quality evangelist - Software Gardener • Local Tech Community Leader • Father of two
by @softwaregarden What is this talk NOT about • Quality metrics • Code reviews • Specific tool(s) • Specific programming language(s) • Explaining technical debt
by @softwaregarden I had a dream… ...that one day code quality management will be as much as important and essential as is today source code management
by @softwaregarden We measured the code quality! Now what? Duplications Density Code Coverage Cyclomatic Complexity Cognitive Complexity Branch Coverage Line Coverage Quality Flows Incoming coupling Outgoing coupling Performance Issues Style / Format inconsistencies Lack of Documentation Security vulnerabilities
by @softwaregarden Technical Debt Definition If the debt grows large enough, eventually the company will spend more on servicing its debt than it invests in increasing the value of its other assets Steve McConell - Author of Code Complete
by @softwaregarden So many questions • Product team pushes for new features. No time for refactoring. What should we do? • Is there a silver bullet to tackle code quality? • What to fix / improve first?
by @softwaregarden How to convince my “superior” • Wear different hats for technical and non-technical people • Speak the management language • Provide a single number in terms of currency or time to market • Don’t ask for permission • Do a PoC
by @softwaregarden Should we improve quality of legacy code? • Yes No It depends • Useless to refactor code that is never changing • Keep an eye on code churn • Avoid refactoring for the shake of refactoring
by @softwaregarden Product team pushes for new features • Do you work for a startup or a Greenfield project ? • YES! - Great then just stop adding crappy code
by @softwaregarden Product team pushes for new features • Do you work for a startup or a Greenfield project ? • No! - Then you are in deep shit • Try to keep a balance • Pretend you are in a Greenfield project
by @softwaregarden Bonus slide - Automation • Step #0 - Define a common set of objective quality rules, agreed by all team members • Step #1 - Automatically check your code locally (Pre-commit checks) • Step #2 - Integrate with your favourite CI engine • Step #3 - Integrate with your favourite code review tool (Post-commit checks) • Step #4 - Reject PRs if quality threshold is hit
by @softwaregarden Take - aways • The fight against technical debt starts once you understand the metrics - it doesn’t end that time • Poor code quality has side-effects to the team’s psychology • Be patient and don’t give up • One size doesn’t fit all. Experiment. Find your way