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.
|Experiencing Domain-Driven Design||Inviqa||Workshop||London, UK||April 22-24|
|Talk TBD||NCRAFTS||Talk||Paris, FR||May 21-22|
|DDD in PHP workshop||SOLIDay Serbia||Workshop||Belgrade, RS||May 29|
|Identity||SOLIDay Serbia||Talk||Belgrade, RS||May 30|
|Decoupling the Model from the Framework||International PHP Conference||Talk||Berlin, DE||Jun 7-11|
|Extract Till You Drop||International PHP Conference||Talk||Berlin, DE||Jun 7-11|
|Experiencing Domain-Driven Design||Zilverline||Workshop||Amsterdam, NL||Jun29-Jul1|
|Experiencing Domain-Driven Design||3 day DDD training||Workshop||Ghent, BE||Aug 12-14|
|Experiencing Domain-Driven Design||3 day DDD training||Workshop||Berlin, DE||Aug 19-21|
|Domain-Driven Design in PHP||Laracon EU||Workshop||Amsterdam, NL||Aug 24|
This work by Mathias Verraes is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License.