Wednesday, May 18, 2011

A Baker's Dozen More Rules, and Not Just for Beginning Programmers

I just saw on a blog called Panopticon Central, I saw an entry called Seven Rules for Beginning Programmers. I had to continue the list with some rules (caveat emptor #12 below) of my own.
  1. Write automatable unit & integration tests and run them on every build. Do not declare yourself to have a successful build until not only everything compiles but also all tests run successfully.
  2. Make judicious but appropriate use of interfaces.
  3. Don't overuse inheritance; it leads to brittle hierarchies. Always prefer composition.
  4. Layer software appropriately. Recognize that even when using an object-oriented language, some artifacts, like service layers & strategies, are procedural in nature.
  5. Understand the difference between persistent domain objects and data transfer objects, and combine the two only when you understand the tradeoffs.
  6. Avoid anemic domain models.
  7. Understand source control, branching & merging.
  8. Understand aspect-oriented programming, and how it complements object-oriented programming via modularization of cross-cutting concerns.
  9. Always pay attention to advances in new or existing programming languages, techniques, and ideas.
  10. Understand dependency injection, inversion of control and how it makes your code less coupled.
  11. Always keep your business logic independent of the environment in which it will run.

    These last two apply to life, not just programming:

  12. Know the difference between a rule and a guideline.
  13. When faced with a choice, the one that it is more emotionally difficult for you to choose is often the right one.