[openbiblio-dev] [ckan-dev] coding style

William Waites ww at styx.org
Wed Jan 26 19:11:46 UTC 2011

* [2011-01-26 17:50:10 +0000] James Gardner <james at 3aims.com> écrit:

] I've never had to resort to @classmethod in my own code - helper
] functions are fine.

It's used in much OKF code in what I consider an anti-pattern,
putting factory methods like create(), get(), save etc. on
classes meant to represent instances. This is typically model.Foo.

Notice that sqlalchemy does this with utility functions and 
classes, e.g. the session. Django gives the objects a factory
class called Manager.

I think that in general @classmethod should only be used if
there is a very good reason.

As far as changing and fixing these various things I agree they
are best done incrementally as we find them in the course of 
doing other things, it is way too big a job to change everywhere
(especially considering that this covers ckan, wdmmg, bibliographica
in my direct experience and probably all the different openshakespeare
opencorrespondence, etc. things)

William Waites                <mailto:ww at styx.org>
http://eris.okfn.org/ww/         <sip:ww at styx.org>
F4B3 39BF E775 CF42 0BAB  3DF0 BE40 A6DF B06F FD45

More information about the openbiblio-dev mailing list