Categories
Clean Code

A checkbox must be read only once!

Boolean flags are bad. I would agree that a sheer ration between booleans and other data types can be quite a valid measurement of code quality. To support these statement I’d like you to read just two quotes: Flag arguments are ugly. Passing a boolean into a function is a truly terrible practice. It immediately […]

Categories
Clean Code

Never expose boolean

Imagine a startup creating a management system for a company that operates in a single country. Sooner or later, there comes a feature to distinguish contractors between home country and foreign ones. You may imagine a developer introducing a small private class with a boolean property IsForeign, so the class that represents a contractor looks […]