Equation of software design

The Desirability of Implementation is directly proportional to the Probability of Value and the Potential Value of Implementation, and inversely proportional to the total effort, consisting of the Effort of Implementation plus the Effort of Maintenance.

— Max Kanat-Alexander, Code simplicity

In mathematical terms:

D = (Vi * Vf) / (Ei + Em)

Where:

Vi = Value of Implementation, having that change now.
Vf = Value in the Future, or the lifetime value for the user.
Ei = Effort of Implementation.
Em = Effort of Maintenance.

When considering how time affects the equation:

  • if the time your software is supposed to be used is long, the effort of maintenance (Em) and the lifetime value for the user (Vf) will likely outweigh the effort and value of implementation.
  • if the time your software is supposed to be used is short (a demo, etc), the cost of implementation will likely outweigh the maintenance effort, so you should optimize for speed of implementation.

Note that the user that would receive the value can be the end user of your software (change as a new feature, performance, etc) of another developer (change as a refactoring, new pattern, etc).