We don’t always choose the interfaces we work with. For example, I’d rather have my car drive me to my destination by itself, without me having to give 100% of my attention to the road and the dangerous lunatics driving next to me. And it’s the same with software: sometimes you don’t really want a piece of functionality, but it’s built into the interface. So what do you do? You make a Null Object.
Suppose you inherited a library that uses the following interface :
1 struct Logger
3 virtual ~Logger() = default;
4 virtual void info(const string& s) = 0;