ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Tilly <JTi...@hoteltools.com>
Subject RE: Ant q? about core Java task: why are members private?
Date Thu, 29 Mar 2001 14:50:05 GMT
As a convention, my team adheres to scoping prefixes.  ivVariableName is an
instance variable.  svVariableName is a private class variable for use by
class methods.  VARIABLENAME is a public class variable depending.
pVariableName are parameter variables.  Everything else (no prefix) is a
"working variable".


Jesse

-----Original Message-----
From: Stephane Bailliez [mailto:sbailliez@imediation.com]
Sent: Thursday, March 29, 2001 5:53 AM
To: ant-dev@jakarta.apache.org
Subject: RE: Ant q? about core Java task: why are members private?


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