Re:Don't Use Booleans
by asddubs on Monday July 08, 2024 @07:23PM
(#40910853)
It usually starts with "is_car", a simple, clear, yes or no. and then at some point someone needs to also check if it's a sedan and instead of turning it into an enum called vehicle_type an "is_sedan" is added, etc.
[ Parent
| on HN ]
Re:Don't Use Booleans
by PhilipRoman on Tuesday July 09, 2024 @06:55AM
(#40914596)
The other side of the coin is making an enum and eventually realizing that some of the types can overlap. I prefer the "set of tags" approach due to its flexibility.
Re:Don't Use Booleans
by griftrejection on Tuesday July 09, 2024 @03:39PM
(#40920137)
Can't developers just... not do that? You can write bad code in any language. What is our responsibility as experts to avoid doing things like this, then?
if they know better and have the foresight, they do. But stuff like this might not occur to people who've never been bitten by it. Every step of the way you just make things a little bit messier than before.