Re: Is this too much OOP?
- From: Bruno Desthuilliers <bdesth.quelquechose@xxxxxxxxxxxxxxxxxxx>
- Date: Sat, 23 Sep 2006 23:49:09 +0200
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.
.
- References:
- Is this too much OOP?
- From: needin4mation
- Is this too much OOP?
- Prev by Date: Re: what's the future of Object Oriented Programming
- Next by Date: Re: Is this too much OOP?
- Previous by thread: Re: Is this too much OOP?
- Next by thread: Re: Is this too much OOP?
- Index(es):
Relevant Pages
|