instead of
if (use_alternate_frob_strategy) {
bloo_counter += 1;
}
do
if (use_alternate_frob_strategy) {
convert_bloos_to_frobs = true;
dispose_bloos = true;
count_bloos = true;
}
[...]
if (count_bloos) {
bloo_counter += 1;
}
advantages:
- each part of the code is individually a lot more obvious
- the whole meaning of
use_alternate_frob_strategy
is a lot clearer
disadvantage:
- larger disconnect between cause and effect; more code reading required to understand why
bloo_counter
is being modified