From: Mike Stok Date: 2006-05-10T04:14:31+09:00 Subject: Re: Method Size - Best Practices On 9-May-06, at 3:04 PM, Simen wrote: > Eric Hodel wrote: >> On May 9, 2006, at 7:04 AM, Pistos Christou wrote: >> >>> Poll (for everyone, not just Eric): What is good or acceptable >>> method >>> size in your opinion? On what factors does your range depend? >> >> 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. > Exactly. Break everything down into comfertable units, but not any > smaller. If a method does one thing and does it well, and there are no > patterns inside it that are common in your code, there is no use in > dividing it further into more methods. > > That being said, if you have methods that are 50+ lines of code, those > should be the first to look for potential refactoring in. Heh. Recently a 4,500 line method caught my eye at work. I ignored the advice to wait until it was >5,000 lines before refactoring :-) ---------------------------- revision 36.3 date: 2006/04/14 21:57:08; author: mstok; state: Exp; lines: +2119 -3887 first cut at refactoring xxxxxx ---------------------------- Mike -- Mike Stok http://www.stok.ca/~mike/ The "`Stok' disclaimers" apply.