geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Dirk.Wei...@ferguson.com>
Subject RE: Suggested coding convention: sort methods
Date Wed, 13 Aug 2003 12:48:09 GMT
One convention I've grown fond of is placing declaring an instance variable immediately preceeding
its' getter and setter.  I find it speeds the refactoring of beans.

> -----Original Message-----
> From: Adrian Jackson [mailto:adrian@dynamicweb.co.uk]
> Sent: Wednesday, August 13, 2003 8:44 AM
> To: geronimo-dev@incubator.apache.org
> Subject: RE: Suggested coding convention: sort methods
> 
> 
> Eclipse users shouldn't care that much, since the outline view can be
> sorted alphabetically anyway. :) I think it would be nice if 
> there were
> *some* logic at least to the code, but I don't know that I 
> agree this is
> the right approach to take - I quite like my accessor methods 
> to be next
> to each other, for example...
> 
> Adrian
> 
> -----Original Message-----
> From: Alex Blewitt [mailto:Alex.Blewitt@ioshq.com] 
> Sent: 13 August 2003 13:41
> To: geronimo-dev@incubator.apache.org
> Subject: Suggested coding convention: sort methods
> 
> 
> One coding convention I've used in the past is sorting the 
> contents of 
> a file into alphabetical order. Some may argue that it makes 
> it easier 
> to find things; some may not care. A few of you will probably say it 
> makes it worse :-)
> 
> One good thing about such a standard is that it is a standard 
> that can 
> be followed (and/or applied automatically to existing code). In much 
> the same way that everyone working on a common coding convention will 
> find things easier if everyone does it, the same can also apply to 
> sorting the members.
> 
> Eclipse provides a way of configuring the sort orders as follows:
> 
> static fields (*)
> static initialisers
> static methods
> instance fields
> instance initialiser
> constructors
> instance methods
> 
> A nice property of a sorted file when using a source code control 
> system that diffs is that diffs between two sorted files are 
> likely to 
> be the smallest possible (and perhaps, easier to merge when conflicts 
> occur).
> 
> Of course, I suspect that many people will not be using 
> Eclipse (or one 
> that doesn't offer such sorting functionality) so perhaps this should 
> be a recommendation rather than a standard, but if people 
> think that it 
> will make sense then we can work towards it. And it means if 
> you add a 
> few methods, trying to put them in the right 'sorted' place will then 
> help.
> 
> What do people think?
> 
> flameSuit.setEnabled(true)
> 
> 

Mime
View raw message