It starts with a quote:
“Nothing is more dangerous than an idea if it's the only one you have.”
Change, it may be required at any point of time. Nothing is forever. Relying only on one solution leads to greater problems.
If we go with the assumption that this is the only way to do something, unpleasant surprises may arise. There is always more than a single way to implement anything. Look for alternate solutions, be prepared for change at any moment.
But changes don’t have to be that strict or that immediate. But as the time goes on, you may get stuck at one point of time, due to lack of reversibility. Sometimes, small small problems will pile up into a bigger problem that is difficult to solve.
Our aim is to produce flexible, adaptable and maintainable code. By sticking to practices like DRY (Don’t Repeat Yourself), decoupling and the use of metadata, we don’t have to make critical irreversible decisions.
“The mistake lies in assuming that any decision is cast in stone—and in not preparing for the contingencies that might arise. Instead of carving decisions in stone, think of them more as being written in the sand at the beach. A big wave can come along and wipe them out at any time.”
Flexible Architecture
Along with code flexibility, we also need flexibility in the areas of architecture, deployment, and vendor integration. Technologies like CORBA etc, helps to isolate the parts of the project from being dependant on platforms. Our code shouldn’t depend on third party products, for which the changes are always unpredictable. Abstract out everything, from everything else.
“Whatever mechanism you use, make it reversible. If something is added automatically, it can be taken out automatically as well.”
- summary of Reversibility, from The Pragmatic Programmer: From Journeyman to Master
No comments:
Post a Comment