Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Lines of code per method

Name: Anonymous 2006-04-29 12:01

What is your average loc/m?

For my current Ruby project, that number is now 10. The number is slowly decreasing as I refactor. One of my goals is to get it down to about 4-5 (with most methods being 1-2 lines) which I hear is the Ruby way.

I use <http://dev.rubyonrails.org/svn/rails/trunk/railties/lib/code_statistics.rb>; for counting. Rakefile task:
task :stats do
        require "util/code_statistics.rb"
        CodeStatistics.new(
                ["Code", "src"],
                ["Units", "test"],
                ["Utils", "util"]
        ).to_s
end

Name: Anonymous 2006-04-29 14:09

"Ruby way"? Sounds like what Pythonic is for Python.

Anyways, are you sane? 1-2 lines of method may sound like a good idea to somebody writing a book on OO and wanking to it, but in practice, methods this short do nothing, so you need hundreds of them to do shit, which means you create a huge, blOOated interface anybody trying to work with your shit has to read through to get going. I disagree with the trend to make so many tiny methods because it leads to interface complication and bloat. This doesn't mean I agree with huge ones either. Just use common sense.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List