Subscriben cases of adding new features, you have to refactor. Whether your boss has faith in your assessment or not goes a long way in determining whether this is an environment in which you should be working. All application development is ultimately iterative and explaining how this additional feature request tips the balance to refactoring is usually a pretty easy sell. B.state C.state E.state R.state enableThis is the same kind of regularization as logic designers do when moving a random-logic design into a PAL.
on off green any A
any any green true B
any any red true B
a b c d e f g h enableThe table is very explicit and easy to walk through when testing cases, but may be a better or worse description of exactly what the intentional behaviour is, depending how the reader's mind works.
true any any any any any any any ???
any true true any false any any any ???
any true any true false any any any ???
any true true any any true true true ???
any true any true any true true true ???
You are not logged in, either login or create an account to post comments
Consider, say, three bools. Since a bool can have only two states, I can treat it as a bit. A binary number is just a vector of bits too.
So:
enum mybittype { option1 = 1, option2 = 2, option3 = 4 };
enum mybittyype mybits = option1 | option2 ; // bitwise |, not ||
if( mybits & option1) // bitwise &
Alternately, make a class type that wraps an enum (or bitmap or bitvector) that encapsulates frequent and complex operations as named methods.
posted by orthogonality at 7:40 PM on September 25, 2007