A Dimecres, 25 d'abril de 2012 13:46:18, Cédric Krier va escriure: > On 25/04/12 11:37 +0000, [email protected] wrote: > > Please review this at http://codereview.tryton.org/346003/ > > This is a first draft for our next step to the Active Record pattern. > Let's talk here about the design. > Here are the main changes: > > * Add RPC > * Repace BrowseRecord by Model instance > * Replace Cache decorator by a simple LRU Cache > * Remove Cacheable > * Remove _description > * Rename _name by __name__ > * Use class in Pool
I like the new design: Removing _description for __doc__ looks nice. The same for using the class in Pool or replacing _name by __name__. Just several comments: It has its technical reasons, but it is a bit complicated to figure out how each kind of function should be defined. For example, default_* use @staticmethod, get/set and on_change use standard functions (but may use @classmethod), while check_*, read, write, etc must use @classmethod. When you think of it, you can find out why each one uses each kind of definition, but It makes coding a little bit harder, specially for newcommers... Not that I have a better solution, but wanted to point this out. Also the fact that some get functions of fields.Function use @classmethod and others use "standard" functions makes it a bit more complex. Could we standarize and always use the same mechanism? Is there a change to keep the Cache decorator? I think it makes code cleaner. I know we prefer explicit vs implicit but it be nice if we didn't have to register all classes :) -- Albert Cervera i Areny http://www.NaN-tic.com Tel: +34 93 553 18 03 http://twitter.com/albertnan http://www.nan-tic.com/blog -- [email protected] mailing list
