[rfc] MethodObject or CommandObject pattern and reconfigure.py

Jonathan Lange jml at mumak.net
Fri Jul 31 09:21:28 BST 2009


On Fri, Jul 24, 2009 at 3:37 PM, Martin Pool<mbp at canonical.com> wrote:
> Some proposals:
>
>  * If the only interface you want to present is "do this action" and
> there's no obvious object identity that callers would be interested
> in, make it a function not an object.  The function can always become
> a factory for objects later, whether or not that's disclosed.
>
>  * Constructing objects should normally just construct them and not
> have other side effects.
>
>  * If there are multiple ways to construct an object (eg initializing
> a new one vs opening an existing one), but the caller always expects
> instances of a particular class hierarchy, static factory methods on
> that class make sense.
>
>  * If parameters only apply to one action or method and there's no
> reason to want them to be pre-loaded into the object, just pass them
> as parameters to that object.
>

These all sound good to me. Should they go in the hacking guide or something?

jml



More information about the bazaar mailing list