On Tue, 2003-12-30 at 08:34, Ken Foskey wrote:
> I have always been taught to code smaller and smaller modules in my
> coding.  Now it appears that I have been wrong.
> 
> http://catb.org/~esr/writings/taoup/html/ch04s01.html
> 
> The sweet spot for module size is about 200 lines.  I guess this is
> because you get into a "maze of twisty subroutines all different"
> (Anyone remember adventure?)
> 
> What module size do you set for yourself?

I don't set an arbitrary size. If I find that I have a bunch of small
modules that are related in some way, I will try to organise them - for
example by creating a facade (and then using that), or by making all
their interfaces identical (and thus having less to remember ;)).

I think he's right though, that if you can't remember (say) whether a
Range.size() method for a range created [0,1) returns 1 or 0, you'll be
in trouble.

Where I think it's too simplified is that using facades or identical
interfaces, you can dramatically reduce the number of API's one is
actually exposed too, whilst still decomposing the code to it's maximal
appropriate point of reuse. (I have a rule of thumb - I don't code a
module as such until I know it needs to be a module - the second time a
set of code is used. I'll make the code easy to extract when I first
write it though (cause I'm lazy ;)).

Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to