A lot of code I see from new coders shows a thought process like this:
— I’ve got a bunch of matches the player can burn
— after a match is burned, it is moved to a container for used matches; that way I can count how many matches have been burned by writing “the number of matches in the used matched depository”.
— after writing that enough times, I get tired of the verbosity and want to be able just to write “the number of burned matches”. Okay, I’ll also give the matches a “burned” property when I use them up!
Now the burning code looks something like this:
Instead of burning something with a match:
[other stuff];
move the second noun to the used match depository;
now the second noun is burned.
and other places in the code uses both “number of matches in the used matches depository” and “number of burned matches” to refer to (what the author hopes is) the same information.
This is asking for trouble. Sooner or later you’ll move the object but not set the flag, or change the way the multi-process destruction procedure happens in one place and not in the other. As soon as you do, there will be bugs.
So here’s the advice:
Do not put the same information into your world model twice.
