Tuesday 16 October 2012

The Laws of Software Design

The technical publishers O'Reilly had a special offer on digital books this week, so I indulged and bought one of the cheaper ones, Code Simplicity by Max Kanat-Alexander.


It's actually a book on the importance of software design and in it he defines the Laws of Software Design as follows:
  1. The Law of Purpose: The purpose of software is to help people.
  2. The Law of Change: The longer your program exists, the more probable it is that any piece of it will have to change.
  3. The Law of Defect Probability: The chance of introducing a defect into your program is proportional to the size of the changes you make to it.
  4. The Law of Simplicity: The ease of maintenance of any piece of software is proportional to the simplicity of its individual pieces.
  5. The Law of Testing: The degree to which you know how your software behaves is the degree to which you have accurately tested it.
There's also a nice little formula which he calls The Equation of Software Design. This is:

D = (Vn + Vf)
———————
(Ei + Em)

Where:
DThe desirability of the change;
VnThe current value of the change to be implemented;
Vf The value of the change in the future;
Ei The cost (effort) to implement the change;
Em The maintenance cost of the change (future effort).
(The formula has changed on his web site).

Now I admit that this is all a bit pseudo-scientific. The idea that there are actual laws in software development, what you can and cannot do, has always been a bit ludicrous. There are known good practises and I think this is what he really means by Laws, but an important factor that seems to be missing is the human one (software, like Soylent Green, is people) but the book seems to have it's heart in the right place and is worth a read if only to see how much you disagree with him.

No comments:

Post a Comment