Class Explosion

noun

say it: “klas ek-SPLOH-zhun” /klæs ɪkˈsploʊʒən/

A design problem where every combination of options becomes its own subclass, so the number of classes doubles with each new option.

What is a class explosion?

A class explosion happens when every combination of options becomes a subclass of its own: BurritoExtraCheese, BurritoNoOnion, BurritoExtraCheeseNoOnion. Two options make four classes per item, and each new option doubles them, until someone writes GrilledVeggieWrapWithExtraCheeseNoOnion. The cure is composition: build the item from parts it holds, so each option is one small part that works with every item.

In a sentence

  • “Adding guacamole as a subclass would have doubled our burrito classes: a class explosion.”

Level: Journeyman · More Software Development terms at this level

Updated