Representative Line: Not What ... Note

Representative Line: Not What They Meant By Watching "AndOr"

The text discusses a problematic function from a three-decade-old C++ research tool. This tool, primarily worked on by computer science PhD candidates, exhibits poor programming practices. The specific example highlighted is a function named isFooOrBar that actually performs an AND operation between isFoo() and isBar(). This mismatch between the function's name and its behavior is a significant issue. Furthermore, the author argues that even if the name were correct, the explicit isFoo() && isBar() expression is clearer than a dedicated function. The function in question was committed as new code in 2010, suggesting a deliberate choice rather than a simple mistake. The original author likely changed the logic from an OR to an AND without updating the name. This decision was made to avoid updating all call sites, despite the function being used in only one location. The author suggests that the true intent was to encapsulate behavior, which was not achieved here.