Cornelius was working with some code where the objects might be "active" or "inactive". His code needed to do something different, depending on whether the objects were "active" or not, but fortunately, there was a handy-dandy IsActive
method. Weirdly, that method required a bool
parameter, but also returned a bool
. Since there wasn't any useful documentation, Cornelius checked the C++ code.
bool SomeActivatedClass::IsActive(bool& active)
{
active = true;
return false;
}
This method leaves the choice of whether or not the object IsActive
up to the caller. If you check the value in the pass-by-reference parameter, it will always be true
. If you check the return value, it will always be false
.
This method is, truly, a work of art. It doesn't tell you, the audience, what to think about the nature of being active. It instead poses a question, and lets the caller decide. It forces us to confront our own preconceptions about an IsActive
method, the nature of return values, and why we sometimes prefer reference parameters. Like films by the the great auteur, Neil Breen, it asks big questions even as it provides no answers of its own.