Null Object Pattern for Optional Behavior
Optional behavior often begins with one harmless-looking condition. A component may send notifications only when a notifier is configured, record metrics only when metrics are enabled, or write audit events only in some deployments. As the code grows, the same absence check can spread across many call sites: if notifier != null: notifier.send(message) The condition is simple, but repetition creates a maintenance problem. Every caller must remember that the collaborator may be absent and must know what absence means.