2 ms·
Quite. 6 booleans can just be a way to represent 6 flags - it might be modeled as a state-machine - but depending on the language and code base passing in 6 bo
by e12e 8y ago
Quite.
6 booleans can just be a way to represent 6 flags - it might be modeled as a state-machine - but depending on the language and code base passing in 6 booleans to a function (or procedure) might be a fine way to isolate the entry point.
Now given that you have such a function, you need to be able to concentrate in order to refractor it.
I've recently untangled some hairy old front-end js code that takes in parameters from an "advanced" search form in order to validate the input, and construct a proper search.
Basically the same thing, but with much more than six inputs.
After squinting at it for an hour and trying a few things, it boiled down to a few simple checks and a map() over the remaining parameters.