>I'm a big fan of the "One True Way" principle, so that rubs me the
>wrong way.  Why not simply have order_by/distinct/etc. be kwargs to
>the manager functions?  If there's a good reason to do the "chained
>methods" that's fine, but let's not be too clever for our own sakes, eh?

One nice thing about chained methods is, you can pass around the query
object and modify it after the fact. Think "curried queries" - you
build a partial query and pass it to a function, which itself can add
more query specifications or ordering or stuff like that, without
needing to know about what the actual query is. This opens up a really
nice way to build generic code: you only need to put those query
specifications into your code that _your_ code needs, any filtering for
example can be done outside.

And I think all/filter is quite nice, too - that way you can see
directly whether a query starts with the full set or wether you work on
a subset. Sure, this can be done with one single method with
parameters, but I rather like the distinguished method names - it's
more readable to me.

bye, Georg

Reply via email to