Re: Is this too much OOP?



Frans Bouma a écrit :
Bruno Desthuilliers wrote:


Frans Bouma a écrit :
(snip)

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.


Ok, but only in the limited context of the given example sentence
(thus 'manager is subtype of employee'). If you add the essential
information that a manager manages a department, how would you do it
then? Still place the 'managesdepartment' association in Employee?

Obviously not. Please use your brain.
.



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?
    ... 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'. ... 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?
    ... inheritance in your framework, like with the Employee class. ... 'ManagesDepartment' and 'CompanyCar'. ... 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. ...
    (comp.object)
  • Re: Modelling Disjoint Subtypes
    ... This time it is about modelling disjoint entity subtypes. ... The example given in the book is of an "employee" entity with a subtype commissioned employee. ... How do you prevent nonsense data appearing, for example, in the 'commissiones' table for an employee whos type discriminator is is 'salaries'. ... The second approach is to have only one sub-type, but have two columns "Type", "Amount" whereby type gives a clue as to how to interpret the ammount (i.e. is it salary or commission). ...
    (comp.databases.theory)