Some people say "Bug free code is a good code". Sometimes this seems to be valid.But bugs are born from infinite space and we always try to put them in a finite world.These temporal travellers can visit us any time if they come beyond from this finite space. A poorly tested code will produce problems in a later time.
Some people say "Flexible code is a good code". I hope everyone knows flexibility is an prime feature of a good code. Flexibility means that "we can change the code easily and use it in different contexts which are not originally intended". But overused flexibilty will lead to death.The more anticipated flexiblity will be a charming chaos with in the system.But flexibilty is great if it lies in variation points and evolution points of the system.
- It should pass all the tests.
- It should not contain duplicated code.
- It should reveal intentions.
- It should have smaller code base.
Still i strive for simplicity and flexibilty in my code. But i have a question in my mind.Have we ever tried building things using atoms?. Too much simplicity is just like hell.You cannot manage complexity by using too much simplicity.But Simplicity is great when it lies in the appropriate abstractions.
So what is a good code?. From my perspective a good code is highly cohesive code.If it is highly cohesive means it must support some appropriate abstraction and lightweight. If it is lightweight means it is less coupled.If it is less coupled means it has less dependencies.If it has less dependencies you can change it easily.So we can sum up a highly cohesive code comprising simpilcity and flexibilty is a good code so that you manage complexity and change.
Happy coding...

No comments:
Post a Comment