ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane Bailliez <sbaill...@imediation.com>
Subject RE: Ant q? about core Java task: why are members private?
Date Thu, 29 Mar 2001 10:53:17 GMT
> -----Original Message-----
> From: Conor MacNeill [mailto:conor@cortexebusiness.com.au]

[...]
> A couple of points.
> 
> I am generally against having data members as protected. It 
> means weaker
> encapsulation, which allows subclasses to violate the super 
> class' call
> invariant. It also increases the size of the contract between 
> the class and
> any subclasses. That contract should be restricted to methods, IMHO.

I agree. protected members are ok if the inheritance hierarchy does not
exceed two levels and that subclasses are not too numerous. Otherwise we put
ourselves in trouble for maintenance/evolution.

As a note I'm also against the coding style which does not clearly identify
the data members from the local variables. Having just possibly an uppercase
letter between 2 words is not enough, most of the time variables are one
word. This is maintenance nightmare: 'where is this variable coming from
?...mm not its not local, not it's not method variable, not it's not an
instance variable...mmm..parent class maybe ?'. Whatever the coding style
is: _something, m_something, ... is much better than nothing.

Apache projects are supposed to adhere to the Sun coding conventions, but I
feel these conventions are OK for small projects in homegeneous environment,
not for moderate one in heterogeneous environment.

Any opinion on this touchy subject ? :)

-- 
 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. 



Mime
View raw message