Even this code shall pass

Do you remember the last time your code really owned you? Like you really didn't want to own it, but it never left you? That bad piece of shame when crept into the source, and stayed there forever mocking at you. Have you also lost sleep over it? Did you? Oh oh oh, well..!

Turns out, it happens a lot and you are not alone. Probably even the best coders out there might have some novice guilty code still running under the hood. The truth is, code is always beautiful and pretty. But its the circumstances you see...bad code, yes we will fix it, thank you!

Its the learning thats very important. Do not remain fixated with that bad piece of code you wrote long ago. Do not ever lose sleep over it. When you see it the next time, or fiddle with the source around the same code next time, make sure you clean up the mess. And always understand why the code was written the way it was written back then. Probably you had reasons you fail to understand now. There are times when the authors of the code tend to forget the importance of the code they have written few days ago (true story!) . I have seen people scanning the code they have written and wondering how it works, if it works? That definitely shouldn't be working. The data structures can be messed up, the performance may be down and the objects may be misplaced. Find it, and fix it. There is no other way out. Who better to own up your messy code than you? 

By the way, there is more to coding than coding itself. Coding is an art, its an emotion. When you plug in your ears to the favourite music pod, and decimate a problem in layers of logic and build a structure of algorithms for the castle of an application, you really know it is an emotion. You have to go with the flow of the emotion and build the spices of your code. Sometimes the spices are right, sometimes not. You can always blend the code together, but its the flavour of the code thats important. Make sure the flavour is right, and the person eating (ahem, reading) your code gets the right taste. And remember, that in the end of the day, this code too shall pass.

"if you like the post, please do share it"

No comments: