ui factory - what should it do?

Martin Pool mbp at sourcefrog.net
Thu Feb 23 23:53:09 GMT 2006


On Wed, 2006-02-22 at 11:43 -0500, Aaron Bentley wrote:

> Martin Pool wrote:
> > In that particular case it's clearly working for only the duration of
> > __init__.  (Which is perhaps not an ideal idiom; other job-type classes
> > have an explicit "do it" method, and perhaps we should standardize
> > that.)
> 
> While it's a bit weird the first time you see it, it seems quite a handy
> way of doing it, and it's the way I did the TreeTransform mergers (e.g.
> Merge3Merger).
> 
> Because if I were to convert fetcher to have a do-it method, I'd put the
> entire body of the __init__ method there.  And then I'd have to restore
> the members to safe values afterward, so no unsafe member functions
> could be called.
> 
> There is definitely a need for an idiom represent a procedure with
> multiple phases and shared data, where that shared data becomes obsolete
> at the end of the procedure, and this way didn't seem so bad, on reflection.

I don't really mind it, and agree with your point about the member
fields.  I think I've created at least one such class myself.

My main thing was that we should perhaps make classes like this
consistent with each other.  If no one dislikes doing it in __init__ we
can use that.

-- 
Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060224/4c19d11a/attachment.pgp 


More information about the bazaar mailing list