Rob Cook


Home | Donate

Zero, one, or many


2020-06-13

Cardinality is an issue that comes up frequently in software design. How many of each thing should there be in your system? Over time I have found the maxim zero, one, or many to be a great guide in this area. It boils the problem down to two questions:

  1. Do we need the thing at all?
  2. Is there going to be more than one of them?

In my experience if a design limits something to three instances, as soon as you ship your product there will be a need for it to allow four. If you find yourself specifying specific cardinalities, tread carefully. Consider if such limits are really necessary. There may be more value in being flexible.

end