|
|
|
|
|
by skybrian
3625 days ago
|
|
General principle: for every possible refactoring, the opposite refactoring is sometimes a good idea. So, yes, replacing booleans with a callback is sometimes a good idea. But in other situations, replacing a callback with a simple booleans might also be a good idea. Also, advice like this is often language-specific. In languages whose functions support named parameters, boolean flags are easy to use and easy to read. If you only have positional parameters, it's more error-prone, so you might want to pass arguments using enums or inside a struct instead. |
|