<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Segment7: Ruby Method Size</title>
    <link>http://blog.segment7.net/articles/2006/05/10/ruby-method-size</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>The Blog</description>
    <item>
      <title>Ruby Method Size</title>
      <description>&lt;p&gt;On ruby-talk Pistos started a thread on &lt;a href="http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/192056?191940-192253+split-mode-vertical"&gt;Method Size &amp;#8211; Best Practices&lt;/a&gt; based on a &lt;a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/191967"&gt;previous post by me&lt;/a&gt; where he asks what a good method size is.&lt;/p&gt;


	&lt;p&gt;Ara &lt;a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/192058"&gt;responded&lt;/a&gt; with:&lt;/p&gt;


&lt;blockquote cite="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/192058"&gt;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 &amp;#8216;10 lines&amp;#8217; or &amp;#8216;20&amp;#8217; i think it&amp;#8217;s best to always strive to write less code and the make is clear first and fast second&lt;/blockquote&gt;

	&lt;p&gt;Which &lt;a href="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/192094"&gt;I agree with&lt;/a&gt;:&lt;/p&gt;


&lt;blockquote cite="http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/192094"&gt;&lt;p&gt;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).

&lt;p&gt;My coding style (with &lt;span class="caps"&gt;TDD&lt;/span&gt;) leads to 10 to 25 line methods because  
those are most comfortable.&lt;/blockquote&gt;

	&lt;p&gt;I want to enjoy what I do as much as possible, so my &amp;#8220;proper coding practices&amp;#8221; 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&amp;#8217;m not having fun, so I listen and adjust so I don&amp;#8217;t write code the wrong way in the future.&lt;/p&gt;
</description>
      <pubDate>Wed, 10 May 2006 11:15:58 -0700</pubDate>
      <guid isPermaLink="false">urn:uuid:659ad0a0-f2c7-4a3a-909c-ee6a89dd638b</guid>
      <author>drbrain@segment7.net (Eric Hodel)</author>
      <link>http://blog.segment7.net/articles/2006/05/10/ruby-method-size</link>
      <category>Misc</category>
    </item>
  </channel>
</rss>
