From: theadventmaster Date: 2012-08-11T01:45:45+09:00 Subject: Re: How do you order your class methods? --f46d042f9eec2fd4ca04c6ec133a Content-Type: text/plain; charset=ISO-8859-1 I generally use a top-down approach, where new methods are added immediately beneath the method that first requires it. This is most convenient and can be thought of as a type of logical ordering. If I was trying to be productive, I definitely would not order methods alphabetically, especially if the class was large. I'm trying write code, not rearrange my filing cabinet... On Fri, Aug 10, 2012 at 12:36 PM, Robert Klemme wrote: > On Fri, Aug 10, 2012 at 5:03 PM, masta Blasta > wrote: > > > If you have a class with many methods, how do you try to organize them? > > First, I try to avoid having classes with many methods. I can't > remember having a Ruby class with so many methods that I started to > seriously think about the layout of them. > > > Do you go alphabetical? By related function? Order in which they were > > added? > > I usually try to group them according to related functionality. When > I add code later I often only append it at the bottom because that > makes comparing easier. > > Cheers > > robert > > -- > remember.guy do |as, often| as.you_can - without end > http://blog.rubybestpractices.com/ > > --f46d042f9eec2fd4ca04c6ec133a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I generally use a top-down approach, where new methods are added immediatel= y beneath the method that first requires it. =A0This is most convenient and= can be thought of as a type of logical ordering.

If I w= as trying to be productive, I definitely would not order methods alphabetic= ally, especially if the class was large. =A0I'm trying write code, not = rearrange my filing cabinet...

On Fri, Aug 10, 2012 at 12:36 PM, Robert Kle= mme <shortcutter@googlemail.com> wrote:
On Fri, Aug 10, 2012 at 5:03 PM, masta Blasta <lists@ruby-forum.com> wrote:

> If you have a class with many methods, how do you try to organize them= ?

First, I try to avoid having classes with many methods. =A0I can'= t
remember having a Ruby class with so many methods that I started to
seriously think about the layout of them.

> Do you go alphabetical? By related function? Order in which they were<= br> > added?

I usually try to group them according to related functionality. =A0Wh= en
I add code later I often only append it at the bottom because that
makes comparing easier.

Cheers

robert

--
remember.guy do |as, often| as.you_can - without end
http://blo= g.rubybestpractices.com/


--f46d042f9eec2fd4ca04c6ec133a--