Booleans are free. Use them.
Last week a co-worker asked me how I implemented a certain feature in our product. I couldn’t really remember all the fine details of the implementation so I loaded the file into the editor and we sat to read it together.
The code was actually good and I didn’t feel I had to “protect” it by saying it was done under pressure and other excuses I use often. He read the code and said “Oh, I see what you’re doing here. Thanks!”.
The one thing that made the code super readable can be summarized by this programming tip:
Booleans are free. Use them.
Here’s an example: