Balancing technical debt and getting things done is one of the hardest problems we have. When should we write beautiful, elegant, clean code and when should we just hammer away blindly at the keyboard until it's done? This talk goes in to why this balance is so difficult and covers everything from estimations to refactoring and testing, with a focus on real world PHP apps.
14. Aims
●
How to run fast (in general)
●
How to sprint (sneeze)
●
How to run a marathon (clean code)
●
Why you should sprint
●
Why you should run a marathon
15. How to run fast (in general)
●
Developers
– Skilled, Passionate, Healthy, Focused, Disciplined
– (Relevant) conferences, user groups (hello)
– Read books, blogs, code
– Write code, Open Source contributions
16. How to run fast (in general)
●
Projects
– Good communication
– Good specifications / requirements
– Fast feedback
– Good clients
17.
18. How to run slow (in general)
●
Complexity
– Code / System
●
Bad / slow / no tests
●
Bugs
●
Lack of investment
– Servers / Workstations / Software
19. How to run slow (in general)
●
Interruptions
●
Being blocked / waiting
●
Internal processes
●
Too many meetings
20. Aims
●
How to run fast (in general)
●
How to sprint (sneeze)
●
How to run a marathon (clean code)
●
Why you should sprint
●
Why you should run a marathon
29. Causes of technical debt
●
Deciding to release before it's ready
●
Deciding to use a RAD framework
●
Deciding to skip tests & documentation
●
Lack of understanding (requirements, code)
●
Premature optimisation
●
Software entropy
30. Consequences of technical debt
●
Interest; interest on interest
●
More time on maintenance
●
Less time on new features
●
Harder to estimate new features
●
Miss deadlines
31.
32.
33. Aims
●
How to run fast (in general)
●
How to sprint (sneeze)
●
How to run a marathon (clean code)
●
Why you should sprint
●
Why you should run a marathon
34. How to run a marathon
(clean code)
●
Non-code speed-ups: time & money
investment
– Staff training
– Tools and processes
– Planning / requirements
35.
36.
37.
38. How to run a marathon
(clean code)
●
Clean Code (Uncle Bob)
– SOLID
●
TDD
– Run every bit of code that you write, ASAP
●
DDD
– Model the domain completely in PHP classes that
don't touch the UI, database or framework
43. Refactoring
●
Key to keeping up speed in big projects
●
Restructuring without changing behaviour
●
No direct measurable user benefit (not a user
story)
●
Makes it easier to read, understand, test,
change, add new features to
●
IDE makes refactoring easier
44.
45. Refactoring
●
Inject dependencies
●
Decouple (fewer “use” statements)
●
Create interfaces to type hint to
●
Extract functions
●
Rename
●
Reduce cyclomatic complexity (number of
if/else/for/foreach/while/switch in a method)
●
Change depth of inheritance
48. Aims
●
How to run fast (in general)
●
How to sprint (sneeze)
●
How to run a marathon (clean code)
●
Why you should sprint
●
Why you should run a marathon
49. Why you should sprint
●
Help you deliver faster in the short term
●
Long term strategy
●
MVP (prove a theory)
●
Disposable prototype
50. Why you should sprint
●
Treat your servers like cattle, not pets
●
Sometimes code is similar
51.
52. Examples
●
Laravel
– RAD framework
– Sacrifices SOLID code (a bit) for ease of use
– Static “facades” (instead of using injected
dependencies)
– $user->save() (instead of $userRepository-
>persist($user) )
54. Aims
●
How to run fast (in general)
●
How to sprint (sneeze)
●
How to run a marathon (clean code)
●
Why you should sprint
●
Why you should run a marathon
55. Why you should run a marathon
●
Technical debt is a risk
– Especially with big projects
●
Quality is valuable
●
Deliver faster in the long term
56. Aims
●
How to run fast (in general)
●
How to sprint (sneeze)
●
How to run a marathon (clean code)
●
Why you should sprint
●
Why you should run a marathon
57. Sprint vs Marathon
Sprint (example) Marathon (example)
Peripheral component (logs) Central component (DB)
Trivial (make a CSV) Complex (search algorithm)
Few consequences of bugs (game) Important (nuclear reactor)
Isolated (contact form) Reused (authentication)
Abandonable (migration script) Continued updates
One developer Big team
Time & money to pay technical debt
later
Long term delivery
58. Bonus: estimating
●
Estimates for new features need to include
refactoring
– (if you don't want to increase technical debt)
– Refactoring doesn't add perceived value so it's
hard to sell
●
Technical debt is expensive
– Sprint + paying technical debt interest costs more
than running a marathon + continual refactoring
59. Bonus: Testing
●
TDD is about running your code ASAP
●
Write a test when you fix a bug
●
Fix bugs before writing new code (The Joel
Test)
60. Wish list
●
A script to track TODOs over time (Jenkins?)
●
A tool that helps you decide whether to
sprint or run a marathon
61. Resources
●
Books that I've read at least a few chapters of
– Mythical Man-Month: Essays on Software Engineering,
Frederick Brooks
– Clean Code: A Handbook of Agile Software
Craftsmanship, Robert C Martin
– Implementing Domain-Driven Design, Vaughn Vernon
– Modernizing Legacy Applications In PHP, Paul M.
Jones
– More: http://amzn.to/Y29TAK
62. Resources
●
Refactoring http://refactoring.com/catalog/
●
Speed in Software Development
http://www.targetprocess.com/articles/spee
d-in-software-development.html
●
Technical debt
http://www.construx.com/10x_Software_Dev
elopment/Technical_Debt/
●
Images: HBO, Reddit, XKCD, the Internet