Re: Mixing OO and DB
Date: Sat, 8 Mar 2008 08:51:07 -0800 (PST)
On Mar 8, 3:04 am, rp..._at_pcwin518.campus.tue.nl (rpost) wrote:
> Marshall wrote:
> >I'm going to argue that I have seen no evidence that writing
> >methods any smaller than 150 lines produces any measurable
> >benefits. I'm further going to argue that you haven't either.
> Neither have I, but there is an obvious argument: more modular
> code becomes easier to explain and easier to test. In my experience,
> 150 line method bodies can usually be chopped up into meaningful
> subroutines, i.e. with few dependencies. All kinds of subtle
> dependencies can hide in 150 lines that become explicit when you
> try to subdivide these lines. Provided, of course, that you make
> these dependencies explicit as arguments; if they are going to be
> hidden away in global variables and the like, there's no benefit
> in subdividing the method bodies.
Sure, sure, all fair points. But please also don't forget that I *have* seen published evidence that was unable to find any measurable benefit to keeping functions below 150 lines.
For myself, I like shorter methods better than longer ones, and generally will try to keep methods no larger than a screenful. I don't consider this much if any more than an aesthetic preference, though.
Marshall Received on Sat Mar 08 2008 - 17:51:07 CET