Friday, August 26, 2011

Zen Coding

You wrote the code, now you have to build it, it takes a while before you can see the results. You see the results, bring down the application, write more code and build again. In most serious applications the build time is something considerable. It is the time the machine needs in order to be prepared for your commands. To you it can feel like a short recess, or is it?

The build time is very clear for the machine but it is a very critical time for the coder. Why you say? Lets see. There is a huge tendency for coders to fly away during this time, which can be sometimes rather long (it can include both the code build time and the application startup and initialization time), it seems to be the best time to check the emails again, read a bit more of that article in the open browser, do a few more clicks on that sporadic junk web MMO, try to be cool in the social net or a million other small time suckers that we are all aware of. Why should it matter anyway, the machine is building and there is nothing else for me to do!

Well, there are three main issues with the above scenario:

1 - A shift of attention during this time is a context switch for the brain which can help you forget all the thought process and data you had regarding your problem in your mind. The longer this break away is, the higher the risk and it is quite easy to completely forget what it was you were working on once the application is up for testing.

2 - The time when you stop coding and wait is the best time to focus more on the problem at hand and even if you stop thinking about anything in particular (a zen state), your subconscious will carry on and try to work on the problem from different aspects. This could increase your problem solving quality and over the course of the day, highly reduce the number of times you would need to follow the code/build process for one specific problem. (Providing you with a lot more free time at the end of the day)

3 - Once you are carried away, there is no guarantee that you will come back and test the application once it is up and ready for you, you might spend a lot more time on the other task you started and who knows, maybe even get involved with the article for more than thirty minutes.

So before jumping out to do something else right after you initiated the build process next time, double check and see whether it is going to really be in your benefit and consider the negative effects it can have to your overall development quality. It is not easy but it could be well worth it.

If the problem at hand is too easy and there is absolutely no need for thinking more on it, you can always think about all the things you can do to reduce the lengthy code build time.



Lemon Fanta said...

Thanks dear Amir Hossein for this intelligent tip, it was self awaring. I really do that mistake and even worse, exploit it.

Anonymous said...

Hi, It's not about the post!
I wish to know, are you still work for a game like garshasp?
Can i come to your co sometimes for asking and getting experience?

Anonymous said...

Hi, It's not about the post!
I wish to know, are you still work for a game like garshasp?
Can i come to your co sometimes for asking and getting experience?


Ashkan Saeedi said...

nice!!! very nice!
specially the part about losing focus is really correct. we had to build the client and server at the first phase of our project and after the build was complete sometimes i just couldn't remember what should be tested :(
sometimes i even didn't open email/FB but long build times are really harmful. checking mail when building is a hell of problems. when you look at your clock again sometimes you can see that it's more than an hour that you are reading or ... out of your main schedule but the goal was to use 3 minutes of build time efficiently :)

somehow out of topic but i am interested to know if this post generated much views? i myself first saw it in someone's buzz and reshared it, another friend shared it and it's rolling!

did you used incredibuild?

Amir H. Fassihi said...

No we are not using incredibuild.