The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Ruby Method Size

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Eric Hodel

Posts: 660
Nickname: drbrain
Registered: Mar, 2006

Eric Hodel is a long-time Rubyist and co-founder of Seattle.rb.
Ruby Method Size Posted: May 10, 2006 12:15 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Eric Hodel.
Original Post: Ruby Method Size
Feed Title: Segment7
Feed URL: http://blog.segment7.net/articles.rss
Feed Description: Posts about and around Ruby, MetaRuby, ruby2c, ZenTest and work at The Robot Co-op.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Eric Hodel
Latest Posts From Segment7

Advertisement

On ruby-talk Pistos started a thread on Method Size – Best Practices based on a previous post by me where he asks what a good method size is.

Ara responded with:

i think this is a bit silly really, i have several image processing programs that are 5000 lines of code. the longest method is around 100 lines and alreadys calls 20 other methods. breaking it down further would simply obfusicate the code. the size of methods it going to be related to the complexity of the task at hand. rather that thinking in arbitrarily limited terms like ‘10 lines’ or ‘20’ i think it’s best to always strive to write less code and the make is clear first and fast second

Which I agree with:

A good and acceptable method size should be almost entirely based on comfort. Trying to artificially constrain yourself is only going to lead to bad code (and stress).

My coding style (with TDD) leads to 10 to 25 line methods because those are most comfortable.

I want to enjoy what I do as much as possible, so my “proper coding practices” come from listening to my code. My code tells me when it is too complex, too long, poorly factored or just plain ugly. If my code is telling me these things I’m not having fun, so I listen and adjust so I don’t write code the wrong way in the future.

Read: Ruby Method Size

Topic: Ruby blocks performance Previous Topic   Next Topic Topic: Freelancing Rails? Send in your application!

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use