Monday, October 02, 2006

Healthy Organic Code

Healthy: ... health is the ability to efficiently respond to challenges
  • Physical exercise is the performance of some activity in order to develop or maintain physical fitness and overall health.
    For our code to stay healthy we need to exercise it through tests.

  • Hygiene is the maintenance of healthy practices. In modern terminology, this is usually regarded as a particular reference to cleanliness.
    For our code to stay healthy we need to avoid bad things (e.g. -- anti-patterns) and embrace good things (e.g. -- best practices).

  • Mental health is a concept that refers to a human individual's emotional and psychological well-being. ... Feeling capable and competent; being able to handle normal levels of stress, maintain satisfying relationships, and lead an independent life; and being able to "bounce back," or recover from difficult situations, are all signs of mental health.
    Healthy code is capable of performing its function well; can handle anticipated load; works well with other code and can be tested independently; recovers gracefully from (or reports appropriately) the unexpected.
Organic: ...the ability to adapt, learn, and evolve...

  • organic models include the ability to adapt, learn, and evolve
    Our code must not become stagnant. It must be possible to refactor our code to adapt to new situations. We must learn from our successes and mistakes. Our skills must evolve along with technology.

  • organic models include emergent behaviour or emergent properties
    Write the code you need to write to solve the problem. Let the reusability bubble up to the surface as it will. In other words, don't write a generic, reusable, pluggable component based framework unless that's what you really need.

  • organic models [are] composed of heterogeneous (diverse) parts
    Find the right tool for the job. Put them all into your toolbox. Choose the right language, framework and methodology for the problem at hand.

Note: The definitions are from Wikipedia. The correlations are my own.