First read the Fowler's 'Refactoring' book; it was written just for you. Then:
1. Identify a small and easily separable piece of code (what you woud call a component in a normal system.)
2. Write tests covering every (important?) edge-case of the piece of code you want to rewrite.
3. Mercilessly refactor until it's nice and squeeky clean.
4. Lather, rinse and repeat.
And of course, make sure your client acknowledges that it's a giant clusterf... and is on board with you pulling the system out of the stone age.
Also, if you want to make life a bit more interesting for yourself, get the PHP code's AST and programmatically rewrite existing code to shared conventions for kicks.
As the title hints, it was written specifically and expressly for the "I just got a huge amount of complete shit of a codebase shoved unto me, how do I survive". Just check the TOC of part 2 (the meat of the book): http://my.safaribooksonline.com/book/software-engineering-an...
> And of course, make sure your client acknowledges that it's a giant clusterf...
That's hugely important. No promises of delivery, and that the client understands it's not a cakewalk.
Comments
First read the Fowler's 'Refactoring' book; it was written just for you. Then:
1. Identify a small and easily separable piece of code (what you woud call a component in a normal system.)
2. Write tests covering every (important?) edge-case of the piece of code you want to rewrite.
3. Mercilessly refactor until it's nice and squeeky clean.
4. Lather, rinse and repeat.
And of course, make sure your client acknowledges that it's a giant clusterf... and is on board with you pulling the system out of the stone age.
Also, if you want to make life a bit more interesting for yourself, get the PHP code's AST and programmatically rewrite existing code to shared conventions for kicks.
> First read the Fowler's 'Refactoring' book; it was written just for you.
"Refactoring" is not the tool for the job, although it's a nice sidearm.
What OP needs is the big gun, Feathers's "working effectively with legacy code": http://www.amazon.com/Working-Effectively-Legacy-Michael-Fea...
As the title hints, it was written specifically and expressly for the "I just got a huge amount of complete shit of a codebase shoved unto me, how do I survive". Just check the TOC of part 2 (the meat of the book): http://my.safaribooksonline.com/book/software-engineering-an...
> And of course, make sure your client acknowledges that it's a giant clusterf...
That's hugely important. No promises of delivery, and that the client understands it's not a cakewalk.