Niclas Hedhman wrote:
On Thursday 05 February 2004 06:26, Leo Simons wrote:

What is *not good* is /other/ classes (other than subclasses) calling
these methods. If its not a lifecycle method or a work interface method,
 you'll probably want to make the method private, or protected.

I commonly find myself in a situation where a cluster of classes in the same package together fulfill the Service Interface, in which case some of the "unexposed" methods are package protected, the rest private.
IOW, typically only the Service Interface and Life Cycle methods are public.

Hmm. I usually make each and every class in the cluster implement a small work interface and then make a 'facade' implementing the big work interface. I don't trust package accessibility much. Security management can be turned of rather easily, and then clients can use the same package name to gain access.


This often leads to things like "container hierarchies".

And in my case, I hardly ever have 'protected' in COP scenarios, SoC quickly falls apart with inheritence.

yep. I tend to overuse 'protected', then hunt for usages (esp. overriding methods) every once in a while. Its a coding strategy that helps me write code before I figure out the best (or even acceptable) decomposition quickly. Why? Because refactoring tools can automate much of the process of replacing inheritance with delegation, and I often think of using inheritance :D


Once I'm happy with the way I've decomposed a system,

s/ protected / private /

helps make it safe.

--
cheers,

- Leo Simons

-----------------------------------------------------------------------
Weblog              -- http://leosimons.com/
IoC Component Glue  -- http://jicarilla.org/
Articles & Opinions -- http://articles.leosimons.com/
-----------------------------------------------------------------------
"We started off trying to set up a small anarchist community, but
 people wouldn't obey the rules."
                                                        -- Alan Bennett



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to