60 likes | 167 Views
Refactoring Towards Sanity. Robert Reppel. ( Sample code is at http ://robertblogs.wordpress.com / ). Why Refactor ?. To get better at fixing bugs To be able to add new features faster. (Arguably) there is no other reason …. . ( Sample code is at http ://robertblogs.wordpress.com / ).
E N D
Refactoring Towards Sanity Robert Reppel ( Sample code is at http://robertblogs.wordpress.com/ )
Why Refactor? • To get better at fixing bugs • To be able to add new features faster. • (Arguably) there is no other reason …. ( Sample code is at http://robertblogs.wordpress.com/ )
What to Refactor • The minimum we can get away with. • The maximum we can sell to The Man. (???) • “The Big Re-Write” is: • Frustrating (for the business) • Not always better than the original (???)
What We’ll Do • Sprout • Wrap • Refactor “When you need to add a new feature to a system and it can be formulated completely as new code, write it in a new method …. At least write tests for the new code … ” -- Michael Feathers … and writing tests, of course …
Real – World Sprout: • Real Estate Conveyancing • Letters for lawyers, etc. need to contain standard phrases for deposit trust amounts, etc. • Different provinces, different conveyancing methods, different requirements. • Letters as Crystal Reports fed by Stored Procedures. (… which contain the business rules … )
Sources / Reading • “Refactoring To Patterns” – Joshua Kerievsky • “Working Effectively With Legacy Code” – Michael Feathers @robertreppel robertblogs.wordpress.com