Design: method in class or general function?
Michael Torrie
torriem at gmail.com
Sun Sep 10 22:49:12 EDT 2017
On 09/10/2017 06:16 PM, Leam Hall wrote:
> The Career seems to be a "Decorator" pattern given my limited
> understanding of design patterns. Concur? If so I'll go study that some
> more.
A career seems to be something one "has." So a classic "has a"
characteristic, which means it should be an attribute of an instance,
rather than involved in inheritance of the class itself.
> Do you feel this path should still make a Career a class?
Career certainly could be a class, instances of which can be stored in a
character's instance as attributes? Not having read the whole thread,
it seems like yes, making Career a class would allow you flexibility to
implement the multiple careers per character easily.
A particular career is definite the "is a" relationship (a professional
programming career is a career), which means inheritance can work for it.
I could be wrong, though!
More information about the Python-list
mailing list