Don't Repeat Yourself (DRY). Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
This is a really powerful idea to grasp and sometimes very hard to adhere to. Working on systems where you have to remember to change 4 different files just to make a single logical change is painful and error prone. If you know you want to stay DRY, and who doesn't, then you start to see your solutions in a different light. Sometimes you have to write a custom tool that churns through an XML file to generate the multiple pieces the system needs to support a new feature but at least you have a canonical definition of that feature. One tool that might help to stay DRY is MPS. You can create a custom language to describe the solution to a problem, such as generating Hibernate and JAXB aware Java classes from a single definition file. Having to look multiple places to make sure a change gets through is going to cause a failure in the system at some point.
No comments:
Post a Comment