PHP Benelux 2019 edition
Working effectively with legacy code isn’t all about creating test harnesses before refactoring algorithms. The “safety first” strategy doesn’t always apply. Not if the code you’re looking at is LYING IN YOUR FACE anyway.
In this talk I’ll show you what brutal refactoring is. I’ll show you the red glowy eyes of the Churn. And I’ll hold up some big warning signs that should prevent you from producing legacy code today.
Table flips allowed.
18. Domain knowledge has left the building
if ($product->isGrewBilly() && $customer->prefersPayTotum()) {
$this->emailManager->sendTotumBillyAnnuitySummary();
}
50. You know what to do...
●
Write tests from the start
●
Document code and architecture decisions
●
Agree on a coding style
●
Enforce a coding standard
●
Run static analysis tools
And so on...
51. You can hope that people will do this from
now on (actually, force them...)