Thursday, August 9, 2012

D.R.Y principle and the Broken clock




This will be a short post, it is more like taking note of a thought that crossed my mind.







         VS






 
Dry: Don't repeat yourself principle, a well known and preached principle.
We should pay attention how to apply "Dryness".
Depending on the context, for example the source code for create and update may be identical in many scenarios but at sometime the logic may change and they can be different, if you try to apply dry by trying to use the same code base for the two operations this can catch you later. they are the same by accident, but will likely vary by design later and should therefore not share code in common.


Remember: even a broken clock is right twice per day. (but it is still broken)

:)

0 comments :

Post a Comment