Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Managing Technical Debt

Every change to a codebase increases technical debt leaving it less stable, bug-prone, and closer to technical bankruptcy requiring a rewrite. Let's explore how to measure technical debt to gain a score and highlight the current condition of a PHP application. We will then introduce simple steps for improving code quality, deliver new features faster, and lower project stress.

  • Soyez le premier à commenter

Managing Technical Debt

  1. 1. Managing Technical Debt By: Adam Culp Twitter: @adamculp
  2. 2. 2 Managing Technical Debt ● About me – OSS Contributor – PHP Certified – Zend Certification Advisory Board – PHP-Fig voting member (IBM i Toolkit) – Consultant at Zend Technologies – Organizer SoFloPHP (South Florida) – Organizer SunshinePHP (Miami) – Long distance (ultra) runner – Photography Enthusiast – Judo Black Belt Instructor
  3. 3. 3 Managing Technical Debt ● About me – OSS Contributor – PHP Certified – Zend Certification Advisory Board – PHP-Fig voting member (IBM i Toolkit) – Consultant at Zend Technologies – Organizer SoFloPHP (South Florida) – Organizer SunshinePHP (Miami) – Long distance (ultra) runner – Photography Enthusiast – Judo Black Belt Instructor I am the PHP Ninja!!!
  4. 4. 4 Managing Technical Debt ● Fan of iteration – Pretty much everything requires iteration to do well: ● Long distance running ● Judo ● Development ● Evading project managers ● Managing Technical Debt!
  5. 5. 5 Managing Technical Debt ● What is Technical Debt?
  6. 6. 6 Managing Technical Debt ● What is Technical Debt? – Code Smells ...a code smell is any characteristic in the source code of a program that possibly indicates a deeper problem… - wikipedia https://en.wikipedia.org/wiki/Code_smell
  7. 7. 7 Managing Technical Debt ● Code “smells” – “Smells” hinting a refactor may be needed: ● Duplicate Code (rule of 3) ● Long Methods ● Large Class ● Long Parameter (argument) List ● Divergent Change – cascade change to accommodate another ● Shotgun Surgery – change ripples as bugs ● Feature Envy – method uses parts from other class ● Switch Statements – sacrifice polymorphism
  8. 8. 8 Managing Technical Debt ● Code “smells” – Cont'd: ● Lazy Class – class not doing much ● Speculative Generality – something built for possible future ● Temporary Field/Variable ● Message Chains – object asking object asking object ● Middle Man – directors in place but serve no real purpose ● Inappropriate Intimacy – classes share private parts ● Data Class – getters and setters, but nothing else ● Comments – where comments cover bad code
  9. 9. 9 ● Comments can also be a bad “smell“ ● Comments are often used to cover up bad code. ● Code should be self-documenting Managing Technical Debt
  10. 10. 10 ● Coding Standards save time ● Gives direction ● PHP Framework Interoperability Group (https://www.php-fig.org). ● Standard NOT important ● Unless it‘s public code ● Choose one ● Stick with it ● Consistency is key Managing Technical Debt
  11. 11. 11 ● Names should be clear ● Functions and variables should tell a story. $elapsedTimeInDays; $daysSinceCreation; $daysSinceModified; $fileAgeInDays; $elapsed; $createdDays; $modifiedDays; $age; GoodBad Managing Technical Debt
  12. 12. 12 ● Shy away from variations of the same name ● To ensure names are different enough to portray difference. $product $productInfo $productData $productDescription What is the difference between these? Managing Technical Debt
  13. 13. 13 ● Certain characters are hard to understand Lower case L Uppercase O (oh) Uppercase I (eye) Bad Managing Technical Debt
  14. 14. 14 ● Technical names help developers who actually read the code. ● Non-technical terms for client documentation. ● Class names should be nouns ● Describe. ● Ex. - Customer, Account, Product, Company. ● Method names should be verbs ● Action. ● Ex. - getCustomer, closeAccount, updateProduct, addCompany. ● Pick a set of keywords and stick with them. ● Ex. - fetch, get, add, update, remove, delete Managing Technical Debt
  15. 15. 15 ● More on Clean Code ● Functions: ● Short ● Single purpose ● As expected ● Well named ● Recognizing bad doesn't mean we know how to make good ● We know a good/bad song, but are not song writers ● Clean code = caring developer ● Does not require many comments Managing Technical Debt
  16. 16. 16 Managing Technical Debt ● What is Technical Debt? – Code Smells – Impossible to avoid – Builds up like credit card
  17. 17. 17 Managing Technical Debt ● Causes of Technical Debt? – Happens while coding ● Adding functionality ● Enhancing logic
  18. 18. 18 Managing Technical Debt ● Causes of Technical Debt? – Happens while coding ● Adding functionality ● Enhancing logic – Architectural ● Passwords in source control ● Domain names in code ● Env info in code
  19. 19. 19 Managing Technical Debt ● Causes of Technical Debt? – Happens while coding ● Adding functionality ● Enhancing logic – Architectural ● Passwords in source control ● Domain names in code ● Env info in code – Deadlines
  20. 20. 20 Managing Technical Debt ● Causes of Technical Debt? – Happens while coding ● Adding functionality ● Enhancing logic – Architectural ● Passwords in source control ● Domain names in code ● Env info in code – Deadlines – Tech un-savvy boss
  21. 21. 21 Managing Technical Debt ● Causes of Technical Debt? – Happens while coding ● Adding functionality ● Enhancing logic – Architectural ● Passwords in source control ● Domain names in code ● Env info in code – Deadlines – Tech un-savvy boss – YOU!
  22. 22. 22 Managing Technical Debt ● What about support items? – Lack of documentation – Lack of license – No Sharing (OSS) – Ignoring Community
  23. 23. 23 Managing Technical Debt ● Why Remove Technical Debt? – More creating and less reading
  24. 24. 24 Managing Technical Debt ● Why Remove Technical Debt? – More creating and less reading – Easier onboarding
  25. 25. 25 Managing Technical Debt ● Why Remove Technical Debt? – More creating and less reading – Easier onboarding – Less bugs – Reduce unexpected behavior
  26. 26. 26 Managing Technical Debt ● Why Remove Technical Debt? – More creating and less reading – Easier onboarding – Less bugs – Reduce unexpected behavior – Happier developers, customers, boss – More money!
  27. 27. 27 Managing Technical Debt ● When To Remove Technical Debt? – Always! – Part of “Normal Development” cycle ● Code...refactor...code...refactor...etc.
  28. 28. 28 Managing Technical Debt ● Tools To Find Technical Debt? – Static Analysis ● 3rd party – Exakat Cloud ● Self-hosted is free ● Cloud hosted commercial product ● Pricing model is complicated
  29. 29. 29 Managing Technical Debt ● Tools To Find Technical Debt? – Static Analysis ● 3rd party ● SaaS – Codacy – CodeClimate – Scrutinizer
  30. 30. 30 Managing Technical Debt ● Tools To Find Technical Debt? – Static Analysis ● 3rd party ● SaaS ● OSS – Codesniffer – PHP Mess Detector (phpmd) – PHP Copy/Paste Detector (phpcpd) – PHPDepend – PHPStan – Phan – PHPMetrics Good source: https://github.com/exakat/php-static-analysis-tools
  31. 31. 31 Managing Technical Debt ● Containers – Job specific images ● https://hub.docker.com/u/adamculp/
  32. 32. 32 Managing Technical Debt ● Containers – Job specific images ● https://hub.docker.com/u/adamculp/
  33. 33. 33 Managing Technical Debt ● Automation – Static Analysis Automated ● Continuous delivery/integration ● Source control hooks ● IDE
  34. 34. ● Thank you! – Code: https://github.com/adamculp/ Adam Culp http://www.geekyboy.com http://RunGeekRadio.com Twitter @adamculp Questions?

×