DEV Community

Rob
Rob

Posted on

Zero, one, or many?

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. This boils the problem down to two questions:

  • Do we need the thing at all?
  • 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.

Top comments (0)