DEV Community


Discussion on: Practical Coding Patterns For Boss Developers #1: Special Case

jamesmh profile image
James Hickey Author

Seems very similar, except the special case is usually used for replacing null values as a starting point.

When used to expose polymophic behaviors, the state pattern uses a "container" class to hold the state using composition, but the special case classes use sub-typing (thus the need for a factory of some kind).