Exceptional Value

Excerpted from http://c2.com/ppr/checks.html#2 ...


A business model will normally be composed of a basic case or abstraction that is specialized and/or refined to capture the diversity present in the business. However, there will often be circumstances where the inclusion of all business possibilities in the class hierarchy would be confusing, difficult or otherwise inappropriate.

Therefore: Use one or more distinguished values to represent the exceptional circumstances. Exceptional values should either accept all messages, answering most with another exceptional value, or reject all messages (via does-not-understand) with the possible exception of identifying protocol like isNil or printOn:.


See also NullObject and BottomPropagation. This conflicts with the SamuraiPrinciple.


EditText of this page (last edited June 15, 1999) or FindPage with title or text search