▲ | OskarS 5 days ago | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
You're correct in principle, but I'm saying that "in practice", boolean arguments are usually feature flag that changes the behavior of the function in some way instead of being some pure value. And that can be really problematic, not least for testing where you now aren't testing a single function, you're testing a combinatorial explosions worth of functions with different feature flags. Basically, if you have a function takes a boolean in your API, just have two functions instead with descriptive names. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | hamburglar 5 days ago | parent [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> Basically, if you have a function takes a boolean in your API, just have two functions instead with descriptive names. Yeah right like I’m going to expand this function that takes 10 booleans into 1024 functions. I’m sticking with it. /s | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|