strategic code deletion
play

Strategic Code Deletion Michael Feathers R7K Research & - PowerPoint PPT Presentation

Strategic Code Deletion Michael Feathers R7K Research & Conveyance (everyone wants to delete code) When Can We Delete Code? Varieties of Useless Code And another one.. Low Value code No wikipedia entry (yet) :-) Coverage gprof


  1. Strategic Code Deletion Michael Feathers R7K Research & Conveyance

  2. (everyone wants to delete code)

  3. When Can We Delete Code?

  4. Varieties of Useless Code

  5. And another one.. Low Value code No wikipedia entry (yet) :-)

  6. Coverage

  7. gprof

  8. https://nylas.com/blog/performance/

  9. Mutation Testing

  10. Feature Probe

  11. Feature Probe scythe_probe(“marker”);

  12. Feature Probe scythe_probe(“marker”); • Record marker • Periodically check for absence of marker

  13. Feature Probe

  14. - Accept gift card - Split charge (2 customers) - Select home delivery - Produce/Meat by weight - Daily specials - Weekly specials - Restock perishable schedule - Record invalid scans - Change till procedure - Cashier login Pricer Scan Devices - Register reconcile Promotions Reconciliation Edge Client Inventory

  15. The Cost Case

  16. Unreachable Code Dead Code Low Value Code Compiler Errors / Warnings Mutation Testing Feature Probes / Stack Sampling / Coverage Delete on Detect Delete on Detect Strategize

  17. Strategy • Delete Unreachable and Dead Code on Detection • Disable Low Value Code at entry points • Verify in sample

  18. Human in the Loop for Internal Pruning

  19. Systematic Rewrite

  20. Most rewrites are motivated by technology or architectural change

  21. Most rewrites are motivated by technology or architectural change “Cleaning rewrites” should be focused and selective

  22. (from Jez Humble)

  23. Key Actions for Rewrite • Can you find all inputs and outputs? • Are you reducing conditionality? • Are you scoped for Characterization Testing? • Can you run redundant?

  24. Searching for Pinch Points

  25. Characterization Testing Tests you write to describe the current behavior of your system

  26. Characterization Testing Tests you write to describe the current behavior of your system How is this different from other testing?

  27. Is this a bug?

  28. Simple Case Heuristics

  29. Simple Case Heuristics • Start with “x” • Use expressive (long) names • Rename to tell a story • Make the call on bugs • Be curious!

  30. Simple Case Heuristics • Start with “x” • Use expressive (long) names • Rename to tell a story • Make the call on bugs • Be curious!

  31. Simple Case Heuristics • Start with “x” • Use expressive (long) names • Rename to tell a story • Make the call on bugs • Be curious!

  32. Simple Case Heuristics • Start with “x” • Use expressive (long) names • Rename to tell a story • Make the call on bugs • Be curious!

  33. Simple Case Heuristics • Start with “x” • Use expressive (long) names • Rename to tell a story • Make the call on bugs • Be curious!

  34. What was our goal?

  35. ✔ balance ✔ gallons ✘ RESIDENTIAL_MIN ✘ RESIDENTIAL_BASE

  36. Tooling Varies

  37. Reducing Conditionality

  38. Apache

  39. Microsoft IIS

  40. if (…) { … }

  41. Edge-Free Programming

  42. Redund Until Replace

  43. Redund Until Replace When you have a pure section of code that is a replacement, run it in parallel and log if there are differences

  44. Conclusion

  45. - Accept gift card - Split charge (2 customers) - Select home delivery - Produce/Meat by weight - Daily specials - Weekly specials - Restock perishable schedule - Record invalid scans - Change till procedure - Cashier login Pricer Scan Devices - Register reconcile Promotions Reconciliation Edge Client Inventory

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend