Share
Embed
Beyond Clean Code & Code Quality
Beyond Clean Code & Code Quality slide deck from my talk at CodeEurope, December 5th in Krakow
Papapetrou Patroklos
December 05, 2017
Transcript
43 slides
-
Beyond Clean Code & Code Quality By @softwaregarden Papapetrou Patroklos
Krakow, December 5th 2017 -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Ego Boost • I’m from Thessaloniki, Greece • The city of “White” Tower… • …which is not white at all! -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Ego Boost • I’m from Thessaloniki, Greece • The city of “Frappe” … • …a special coffee that you can find (almost) ONLY in Greece -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Ego Boost • I’m from Thessaloniki, Greece • The city of “Frappe” … • …a special coffee that you can find (almost) ONLY in Greece -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Ego Boost • I’m from Thessaloniki, Greece • The city of “Mpougatsa” … • …a pie you can fill with (almost) everything -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
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 -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden What is this talk NOT about • Quality metrics • Code reviews • Specific tool(s) • Specific programming language(s) • Explaining technical debt -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
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 -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden How it all starts? -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden We measured the code quality! -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
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 -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden We measured the code quality! Now what? -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Focus on 3 categories •Security •Maintainability •Reliability -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Sitting on the Technical Debt smell bomb -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
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 -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden So many questions • How do we get management buy-in? • How Technical Debt affects our team(s)? • What about legacy code? -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
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? -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
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 -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden How to convince my “superior” -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden The human factor of Technical Debt Frustrated developers -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden The human factor of Technical Debt Low morale - People leave -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden The human factor of Technical Debt Hard to get new people in - business collapses -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Should we improve quality of legacy code? • Yes -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Should we improve quality of legacy code? • Yes No -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
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 -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Product team pushes for new features • Do you work for a startup or a Greenfield project ? -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Product team pushes for new features • Do you work for a startup or a Greenfield project ? • YES! -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
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 -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Product team pushes for new features • Do you work for a startup or a Greenfield project ? -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Product team pushes for new features • Do you work for a startup or a Greenfield project ? • No! -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
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 -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
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 -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden What’s the best way to improve code Quality? • No silver bullet • Patience • Consistency • Professionalism • Technical Excellence -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Strategies to tackle technical debt Hold your ground -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Strategies to tackle technical debt Move the goal posts -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Strategies to tackle technical debt The Boy Scout approach -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Strategies to tackle technical debt Code Quality Time - Fix the worst first -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Strategies to tackle technical debt Re-architect / Re-engineer -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
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 -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden Code review made simple Quality Issues found / reported Unit Tests Coverage Integration Tests Coverage -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
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 -
Krakow, December 5th 2017, Beyond Clean Code & Code Quality
by @softwaregarden