Property vs. new kind vs. copy-paste?

I am an experienced programmer and hobby writer, but entirely new to parser-based IF and Inform 7. I am playing around and noticed I had created two doors that were very similar – let’s say both were flimsy. My programmer self thought it was an opportunity to abstract the things they had in common.

Reading the Writing with Inform guide and reading the code of some extensions to get a sense of how this works, I discovered there is (at least) two ways to do this:

  • Create a new property flimsy and apply it to these doors in question.
  • Create a new flimsy door that is a kind of door.

I’m assuming the choice between these is obvious to someone with lots of experience writing IF, because they have been burned by the mistake of choosing the wrong one before. But to someone like me, how do I know when each is appropriate?

1 Like

Could a door’s flimsiness state ever change? Could things other than doors also be flimsy? If the answer to either of those is yes then a property will be better.

However another option is to have flimsiness be a property, and also have a kind which is “usually flimsy”. That would allow you to override it later if needed.

8 Likes

This is great and answers my question succinctly. Thank you!