Apr 30, 2007

about refactoring and the programmer block

For a long time I did not released any code, at first I thought it would be just a little lapse, as I was busy working, busy being sick, busy moving, busy working even more etc. and then it will come back to normal ... all naturaly.

But there was also something else, the programmer block.

I'm not talking about procrastination here, it's not like I had better things to do than programming but more like my mind was busy thinking about programming and not ready to do it.

And this already happened in the past, but not to that extend.
Every few years, while learning, studying programming, I always had those moments where I think about it, where I think about what is usefull or not, about what worth it or not, but usually it never lasted more than few weeks, and here well... it took months!

My problem is that I see that as a waste of time, thinking without doing is a double edged sword, it can make you progress as much as it can make you regress, and not only about programming.
From a kung-fu teacher about 15 years ago, she said

You have to practice every day, for each day you don't practice it's like you lost 1 year
, I see this kind of pattern in programming, it's something you have to do every day.
But I contrast it also from something said by a school teacher
Don't overwork that poem too much, you gonna ruin it.
, and this also is true about programming, thinking too much about the design can break your flow, maybe something as free-writing-code could be good from time to time.

Maybe it's that balance between thinking about a code design and digging into the code itself without a plan, that make me freeze for longer that I would have wanted.
I got that strange idea that most of my code needed refactoring, ok not so strange as I'm into that refactoring process now (even if I progress slowly), but still it gave me that strange feeling that all those codes that I was considering achieved, that maybe needed some polishing, needed in fact to be completely redone.

Not that people were not happy with the code (as far as I know), but I was not happy with it because I was seeing flaw into it: too much dependencies there, half-baked function there, unstable results, etc.
And those flaw were not that obvious before, and even if people were not seeing anything wrong in the code the fact that I spoted that made me want to rewrite it all, or at least improve it a lot.

And it's at that moment that you realize it gonna be a hard task, a very very hard task, so I suppose I chickened out at that time.
As much the same feeling when those 3 times I was about to send a CV to Google, you really want to do it, you see it as the dream job, but at the last second when you realize that they hire ex-nasa engineer or that having a PhD is a requirement, well you just drop it because you think you're not up to the task.

Doubt. What if by rewriting the code I'll make it worst, totally useless to those few users that count on it ?
And then you think that if you rewrite it, it really really have to be good, no... wait... it have to be better, simpler to use, more powerfull, lighter to load, faster, etc.

It's like playing a video game, you don't have to beat the computer, you have to beat yourself, if you refactor you have to outskill yourself.
It's a scary process, but if it pass it's where you grow as a programmer, it's where you assemble knowledge from books, white papers, blogs, other sources, and apply it to yourself to make you better at writing code.

And eventually it's where you rediscover why you liked programming in the first place, not because it's an easy process that can be done quickly, no.. you like it because it's hard, because it make you think, because it take a long time to be good at it, and in the end refactoring should not scare you, even if it take twice as long as writing the original code, you know it gonna be so rewarding at the end.

Be the first to comment