> -----Original Message-----
> From: Magesh Umasankar [mailto:[EMAIL PROTECTED]

> From: <[EMAIL PROTECTED]>
> 
> >        /**
> >   +     * the index of the selected value in the array.
> >   +     */
> >   +    protected int index;
> 
> IMHO, wouldn't it be tighter if you mark this private 
> and provide a "protected final int getIndex()" method?
> This way it is ensured that EnumeratedAttribute has
> control over the value of the index variable.

Probably.
If we decide to go this way then we have to state explicitely in the coding
guidelines.

I'm not a huge fan of protected attributes because I feel like they are
getting out of nowhere when using it in a method and it is more explicit to
me to user getters. The counterpart is that it force us to create accessors
everywhere and this is quickly becoming code bloat when not needed. I feel
like accessors instead of protected are more necessary when there is a
potential of having a large number of subclasses or a very deep hierarchy.

All in all this is a little bit like overdesigning, you have some optional
tasks that have getter/setter for all private attributes and the code is
more than twice the size of what it could be.

-- 
 St�phane Bailliez 
 Software Engineer, Paris - France 
 iMediation - http://www.imediation.com 
 Disclaimer: All the opinions expressed above are mine and not those from my
company. 



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

Reply via email to