Follow-up Thought to Bug Tale #1

One reason this bug was hard to see was the delayed trigger — something happens in one part of the code (potion use restores health), but the immediate effect actually doesn’t take place until way later in the code (remove potion from inventory).

Ideally, don’t do this! Have everything resolve together if possible. Why isn’t it possible? Does the code need to be refactored?

In this particular situation, I think it’s a matter of avoiding circular dependencies in C++ files. But there’s probably a solution that gets around that and performs all the necessary steps together.

2011/07/21

Leave a Reply

Your email address will not be published. Required fields are marked *