in reply to How to name a subclass of an object class?

From subsequent discussion, it turns out that you do want to treat "List" as a number. In this case, "List" is the wrong name. You actually want to call it "Roll". Then, a "Roll" has-a "Dieroll". The "Dieroll" is the physical rolling of the die. A Roll would have a list of Dierolls that would demonstrate what physically happened with the dice*. Then, you would use overload to allow you to treat Roll as a number.

As for the perlboot stuff, you misunderstood. You need to name it so that the casual reader of your code understands exactly what an object of this class will be used for, within the context of your program. If your code is about AD&D, I expect to see a "Roll" class. If it's called "List", I don't know what it's a list of.

*: For those confused, there are certain situations where you actually need to know which dice rolled which values. For example, certain immunities state "Reduce the value of each die rolled by 1 with a minimum of 1." This means that a 1 is still a 1, but a 2 is also a 1. But, this is only for that character. So, in the case of one person in a group having an immunity to fire and the group being subjected to a fireball, each person's damage is applied separately once the damage for the fireball is calculated. (In some rulesets, the damage for the fireball is calculated separately for each person, complicating matters further.)


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
  • Comment on Re: How to name a subclass of an object class?