Re: Is this too much OOP?



Frans Bouma a écrit :
(snip)

About inheritance: in general, inheritance shouldn't be overdone. You
can do without if you like, but it has drawbacks to not have
inheritance in your framework, like with the Employee class.

Some in this thread think that the example you gave is pretty lame,
but it's not. The thing is that inheritance is often used when you want
to add new elements to a type which are only meant for a subset of the
instances of the type. Like Employee. All people working in a firm are
employees, but a manager manages a department, and perhaps only a
boardmember may have a company car.

If you then place the associations with department (for managing) and
companycar in the Employee class, also the employee instance from John
Doe III from the postoffice below in the dungeon has a property
'ManagesDepartment' and 'CompanyCar'. They might be null, but the
properties are still there.

Some might say "so what", but others might want to have types which
aren't polluted with fields which don't belong there and are members of
subtypes, like the reference to companycar or department.

The problem here is that a manager is not a special type of employee, it's an employee that has a special role - possibly at a given moment.

.



Relevant Pages

  • Re: O/R Mapper
    ... Manager (subtype of employee) ... BoardMember (subtype of manager) ... FamilyCar (subtype of CompanyCar) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Is this too much OOP?
    ... and companycar in the Employee class, ... property 'ManagesDepartment' and 'CompanyCar'. ... The problem here is that a manager is not a special type of employee, ... a biz app. ...
    (comp.object)
  • Re: Is this too much OOP?
    ... is a base employee class. ... when a Manager or line staff employee derives from the employee class. ... About inheritance: in general, inheritance shouldn't be overdone. ... 'ManagesDepartment' and 'CompanyCar'. ...
    (comp.object)
  • Re: Is this too much OOP?
    ... and companycar in the Employee class, ... property 'ManagesDepartment' and 'CompanyCar'. ... members of subtypes, like the reference to companycar or department. ... Still place the 'managesdepartment' association in Employee? ...
    (comp.object)
  • Re: Merge Document and Fill in Form (Word 2000)
    ... Whereas all the Manager needs to do is fill out the ... However, when it comes to appending the signature, you're probably ... going to need some VBA. ... This way the Employee Name can be plced on ...
    (microsoft.public.word.mailmerge.fields)