[MERGE REVIEW] create_checkout_convenience

Aaron Bentley aaron.bentley at utoronto.ca
Mon Aug 7 17:59:27 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> On  7 Aug 2006, Aaron Bentley <aaron.bentley at utoronto.ca> wrote:

>> It seems strange to make things instance methods when they don't
>> require access to instance variables.

> Well, I certainly didn't mean to just turn them into instance methods
> with no other changes.  But there are other things that can be done:
> 
> 1- Think of what instance they really should belong to, and put them there (as
> we did in this thread).
> 
> 2- Make a new class, and make them methods of instances of that class.  For
> example I think the register_format, set_default_format, etc should perhaps be
> methods of an instance of FormatRegistry, rather than stuck into the class
> whose subclasses they register.

Sure, those are fine by me.  But I don't like when that leads to really
bloated class interfaces.  And on the other hand, I get a bit queasy
when I see a class that exists only to provide one method.

> 3- Perhaps just make them regular functions, not part of any class.  I know
> Robert has concerns about the testability and maintainability of code that
> does this.  It's definitely the last choice but sometimes I think it makes
> sense in Python.  I can't really see any cases where it would be needed in
> our current code so let's defer the abstract discussion. :-)


One example is Merge3Merger.scalar_three_way.  This performs the
standard three_way merge algorithm on scalar values.  I would have made
it a function, except that functions are frowned on here.

Another example is Merge3Merger.name, which is used as input to
scalar_three_way.

> OK, so let's leave that for now and just make it an instance method?

Sure, happy to.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE13Fv0F+nu1YWqI0RAjXOAJ4gx2mwRyEsTb5mkWT14ZEmHpm1mQCfTDIa
MyT9JL4R7fQNDl0pmrEMdd0=
=wXgG
-----END PGP SIGNATURE-----




More information about the bazaar mailing list