Why do programming texts always use an "Employee" entity? [closed]
Is there something special about an Employee entity that makes it desirable to use it so frequently in programming texts?
Are there any other entities that would serve just as well?
Obviously; anything specifying a hierarchy will be helpful; Employee is used because it's most common and trivially understood conceptually (i.e. it's easy to visualise). It's harder to visualise B : A
.
In case it's not obvious; it's used because it's useful for learning about OO in terms of the hierarchy/polymorphism functions, and allows it to direct relate to something almost everyone has experience with.
It is the same thing that happens with Introductions to programming where they use Animal as the base of an objects hierarchy. Maybe because everyone in this world knows what Employee and Animal mean!
It's all about hierarchy. Student / Teacher / Classes / School works too.
精彩评论