It was fully functional, but not as optimal as it could (or should) be. It wasn't nice to other groups resources, and it had grown somewhat gnarly and untidy even after perltidy's magic.
So I was faced with the choice of whether or not to refactor/rewrite the code, based on what I'd already learned about the problem.
Now, for me at least, this code was complex. It dealt with data structures that were tough for me to get my head around. So, rewriting it actually caused me a certain amount of fear... what if I got halfway through and discovered I'd made a bad choice ? What if it didn't make any difference ? Oh my god this code is untidy, the design is clearly flawed..etc...etc...
The point is, taking the step to walk past that fear and refactor the code was one of those choices that became easy once I decided to do it.
12 hours later (well, maybe 5 hours of coding) the program is shorter, good friends with Devel::SmallProf, and has taken a cut in runtime of a little over 50%. The subroutines are better structured, the data structure is clearer, and testing it is similarly easier.
I think this is the first time I've felt that fear, and wondered if anyone else had ever had the same epiphany ?
In reply to On the fear of re-factoring code by deorth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |