Your code should be written in such a way that, it should be easier to change. Easy to Change can be defined as
- Changes have no unexpected side effects
- Small change in the requirements, require correspondingly small change in the code
- Existing code is easy to reuse
- The easiest way to make a change is to add code that in itself is easy to change.
For achieving the above you should write TRUE code.
- Transparent – The consequence of change should be obvious in the code ie changing and in distant code that relies on it.
- Reasonable – The cost of any change should be proportional to the benefits the change achieves.
- Usable – Existing code should be usable in new and unexpected contexts.
- Exemplary – The code itself should encourage those who change it to perpetuate these qualities.
Code that is Transparent, Reasonable, Usable, & Exemplary (TRUE) not only meets today’s needs but can also be changed to meet the needs of the future. The first step in creating code that is TRUE is to ensure that each class has a single, well–defined responsibility.
Excerpt from POODR.
We insist when you write an application it should be easy to change, the craft of programming lies there.