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.
|Tactical Domain-Driven Design||Laracon EU||Workshop||Amsterdam, NL||Aug|
|Experiencing Domain-Driven Design||Value Object Comm.V||Workshop||Amsterdam, NL||Sep 7-9|
|Applying Domain-Driven Design to TYPO3||TYPO3 Developer Days||Workshop||Nürnberg, DE||Aug 31|
|Temporal Modelling||TYPO3 Developer Days||Talk||Nürnberg, DE||Sep 1|
|DDDinPHP||1 day training||workshop||Leuven, BE||Dec 16|
This work by Mathias Verraes is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License.