When we look at the same thing from DIFFERENT "perscpective", we are looking at exactly the SAME thing, there is NO doubt about this, but we focus on DIFFERENT attributes, as we need.
To be frank, my first feeling is that, Perl or @ISA is not quite relevant to what we want to talk about here, actually this is more a question about OO ITSELF.
Let's look at your example. An employee could be a father, a mother, a musician (although might be a lousy one ;-).
- What do you want to abstract from the real world?
Each application always has its PARTICULAR PURPOSE. For example, if this is a HR (Human resource) application, we want to abstract employee as a class, but most likely not musician or father. If this is a system for a special group of musicians in my city, then I would abstract musician as a class.
Then where would the other information go? You can argure that you obviously care whether a employee is a musician, so you may use him for your company's Xmas party.
Very good, but those should really be treated as attributes rather than a separate class. Again, this is about what the PURPOSE is, and what the FOCUS is.
- Is this a subclass or an attribute?
This question may sound stupid (or way too obvious) to some people, but actually not. Say there is one employee, and he has two attributes:
You can treat both as attributes, but you may also think that, the attribute whether a person is a manager is important enough, that a new class should be abstracted as a subclass of employee.
- He is a father;
- He is a manager;
Again this is about PURPOSE. When it is extreamly reasonable to abstract manager as a subclass in a HR system, it is definitely uneccessary to abstract a manager class in a "house hold management system", just because the father of that family happens to be a manager in his work place, because it is irrelevant to the PURPOSE of your "house hold management system".
- Last but not least, the POWER of human thinking is that, we gather all relevant information, and then FILTER and SIMPLIFY what we see, and UNDERSTAND it from a particular PERSPECTIVE, base on our purpose and focus. We try to UNDERSTAND the world around us, within the capbility and capicity of our brain, but not try to be CONFUSED by it.
Ctrl-Z, you are not sinned. No body is sinned because he thinks, anyone thinks is blessed.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] |