Published on 20 September 2013 by @mathiasverraes
“Extract Till You Drop” is a live refactoring demo that I used to do at conferences and as a webinar. There are no slides, it’s all coding.
Update Sep 6, 2014 (Replaced my home made recording with the one from PHP Tour Lyon. The talk has evolved slightly during the months I presented it at conferences. Find other recordings of that talk on Youtube.)
The title refers to a quote from Robert C. Martin about applying Extract Method and other refactors until every element in your system has just one responsibility:
Perhaps you think this is taking things too far. I used to think so too. But after programming for over 40+ years, I’m beginning to come to the conclusion that this level of extraction is not taking things too far at all. In fact, to me, it looks just about right. So, my advice: Extract till you just can’t extract any more. Extract till you drop.
I owe a lot to Sandro Mancuso, who did a similar, much more advanced presentation in Java, which greatly inspired me to try this in PHP. Many of the ideas here are borrowed from him.
We’ve all seen them: applications out of control. Under the pressure of deadlines and endless change requests, with the weight of years of legacy, the code has become unmaintainable. Adding features is a slow hit and miss process. You know something needs to be done, but nobody knows how. To change the code safely, you need tests, but to make it testable, you need to change it. Rebuilding the system from scratch is not an option.
With the right tools, techniques, and mindset, any codebase can be brought under test, and be refactored towards a better architecture. All without affecting the behavior of the system, and allowing the business to continue.
This presentation is not for the weak of heart. We’ll skip the theory and dive straight into the spaghetti code. We’ll wrestle in the mud, and we’ll tame the beast, whether it wants to or not. It’s live coding, and it may fail. But it will change how you approach legacy code forever.
Follow @mathiasverraes on Twitter.
|DDDinPHP||1 day training @ Coosto||workshop||Eindhoven, NL||Oct 28|
|On Being Explicit||DDD London||meetup||London, UK||Nov 9|
|On Being Explicit||Agile Testing & BDD eXchange 2016||keynote||London, UK||Nov 10|
|On Being Explicit||Frankfurt Software Architecture Meetup||talk||Frankfurt, DE||Dec 5|
|DDDinPHP||1 day training||workshop||Leuven, BE||Dec 16|
|Modelling Heuristics||Workshop @ Domain-Driven Design Europe||workshop||Amsterdam, NL||Feb 1|
|Conference||Domain-Driven Design Europe 2017||organiser||Amsterdam, NL||Jan 31 - Feb 3|
This work by Mathias Verraes is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License.