开发者

Why do programming texts always use an "Employee" entity? [closed]

开发者 https://www.devze.com 2022-12-20 01:41 出处:网络
开发者_如何学运维 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current for
开发者_如何学运维 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消