Since a large part of what I do for a living is programming and I've been involved in a number of long-term projects, I've had a lot of run-ins with legacy code. I found an interesting book recently called Working Effectively With Legacy Code (by Michael C. Feathers). I saw a good recommendation and thought it'd be right up my alley.
Having skimmed through I reckon it was a good purchase. One thing I read about was Scratch Refactoring, which is when you pull a complicated piece of code apart and refactor it purely to try to understand its purpose and method. I realised I've done this a lot over the years, but I never did it with the thought "and I'll just throw the refactored code away in the end". I've almost always felt that I has to refactor it correctly then and there, otherwise it wasn't worth bothering with. Having read this laid out in black and white it just resonated with me - treat the refactoring episode as a means to understanding rather than producing working software.
This makes me think that perhaps I worry too much about doing everything right first time. Why did I have to read this in a book to make it feel OK to allow myself to do it. It's as though because I read it in a book it's an official way of doing things so I am OK to do it. I should trust my intuition more I think!
No comments:
Post a Comment