2. ABOUT ME
Started with PHP in 2005
Developer at MDS Technologies
@BBreyten on Twitter
lanyrd.com/cfmmrb | joind.in/14838
3. WHAT IS LEGACY SOFTWARE?
“The secondary value of software is its
behavior... It’s achieved when the current
software meets the current needs of the
current user... But the needs of the users
change, and they do so frequently... Thus the
primary value of software is its ability to
change.”
— Robert C. Martin (Uncle Bob)
4. WHAT IS LEGACY SOFTWARE?
Legacy software is software that is unable to change easily
Software that is difficult to read and reuse
8. REFACTORING
Refactoring is the process of restructuring
existing code without changing its external
behavior, in order to improve readability and
reduce code complexity, as to improve source
code maintainability and create a more
expressive internal architecture or object
model to improve extensibility.
https://en.wikipedia.org/wiki/Code_refactoring
9. RULES OF REFACTORING
Small iterative changes
Make sure everything still works
Send to QA, Push to Production
Do the next small change
10. TYPES OF LEGACY SYSTEMS
Standalone App
Framework (MVC)
Plugins/Modules
17. MOVE FUNCTIONALITY INTO CLASSES
Get rid of includes
One class per file
Files should declare new symbols, or cause side effects, but
not do both.
18. REPLACE MAGIC NUMBERS WITH CONSTANTS
if ($status>id === 15)
if ($user>type === 3)
if ($code === 418)
if ($status>id === Status::CANCELLED)
if ($user>type === User::TYPE_ADMIN)
if ($code === Response::HTTP_I_AM_A_TEAPOT)
31. WHEN CAN I REWRITE?
The new system is vastly out of scope, or the current system
simply can’t meet the new requirements.
You have to change Programming Language/Framework
You have lots of time, money and resources
32. RULES OF A REWRITE
Both systems need to run in parallel
Spend as little time as possible between deploys
Fail fast, fail cheap
Don’t try and change everything
Use @deprecated
Work closely with the current devs
Always be ready to implement new features
33. The key to success is not perfection, but making peace with the
term good enough, and then moving on.