What's arguably a bit confusing about Steve McConnell's example is
that he doesn't actually arrive at a conclusion and deliver it to the
reader.

In the particular example, most would probably simply extract and
publish an interface called Seniority containing a hiring date and job
classification. Then let Employee implement Seniority and use
Seniority in the signature of LookupVacationBenefit rather than
Employee. Others might claim that it would be better to use
polymorphism and different strategies for determining this,
encapsulated by employee.getVacationBenefit().

In any case, I think McConnell's intention is to show how it's your
job to identify the areas likely to change. In general, as Vince
suggests too, we should watch out for "dependency magnets" and treat
method signatures with care, for once published they are effectively
immutable.

/Casper

On Dec 12, 1:27 pm, etzel <[email protected]> wrote:
> On 12 Dez., 12:50, Casper Bang <[email protected]> wrote:
>
> > If you've studied OO or design patterns, you will undoubtedly have
> > heard about the open closed principle (OTC). This is what I believe
> > Steve McConnel is referring 
> > to:http://en.wikipedia.org/wiki/Open/closed_principle
>
> Thanks Caspar.
>
> So this would mean int holidays(Employee emp) could be "extended" by
> introducing another implementation of the containing class which could
> take into account different parameters than another implementation. I
> wouldn't have to "modifiy" the interface, which I would have to if the
> method took each single parameter as arguments. On the other hand this
> couples clients to the Employee class.
>
> Is the answer once again "it depends."?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to