commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Benedict <pbened...@apache.org>
Subject Re: svn commit: r1560382 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
Date Thu, 23 Jan 2014 17:23:38 GMT
FWIW, there's no solution that can make someone happy. Personally, I always
alphabetize my methods because it's the most straightforward ordering -- no
one has to guess why things are grouped together and sometimes groupings
can get complex. I simply let people follow the javadocs/comments to make
their own conclusions. However, this is all a personal preference. Each
individual has a mental way of sorting data. One isn't right universally.
All a team needs is a guideline.


On Thu, Jan 23, 2014 at 11:18 AM, Gary Gregory <garydgregory@gmail.com>wrote:

> Adopting a guideline like this is still a subjective arrangement. It's
> also takes time to maintain, not something I'm found of doing. To reach his
> own I suppose.
>
> G
>
> -------- Original message --------
> From: sebb <sebbaz@gmail.com>
> Date:01/23/2014  09:15  (GMT-05:00)
> To: Commons Developers List <dev@commons.apache.org>
> Subject: Re: svn commit: r1560382 -
> /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
>
> On 23 January 2014 07:34, Emmanuel Bourg <ebourg@apache.org> wrote:
> > Le 23/01/2014 08:03, Benedikt Ritter a écrit :
> >> I personally don't like alphabetically sorted classes. For example if a
> >> public method calls a private method, I like to have the private method
> >> beneath the public method that uses it. This way I can read through a
> claa
> >> top to bottom without out to much jumping back and forth. But that's
> just a
> >> matter of taste, I guess.
> >>
> >> What do others think?
> >
> > +1
>
> As far as methods are concerned, usually I find it helpful to group
> them into the following general sections:
>
> group + protected
> package
> private
>
> Within a group, alphaorder is not always the most appropriate - for
> example getter/setter pairs more naturally belong together.
> Also getter/setters are not generally the most interesting methods, so
> can be relegated further down the file.
> I prefer to see related methods together (which may involve mixing
> private/public in the same section)
>
> I don't see the point of sorting the methods just for the sake of it.
> If the methods are logically grouped it can make the code much easier to
> follow.
>
> As far as data items are concerned, I do find it easier if they are
> organised in sections.
> Even here, there may be private fields that relate directly to a
> public field, in which case they should be together.
> Within a data section, generally the fields should be sorted, but only
> within functional groups.
>
> I favour logical ordering rather than strict lexicographical ordering.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
Cheers,
Paul

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message