skyboyer
17 Sep 2012, 10:26 PM
i would like to implement strategy patter but i have no idea how to do this.
Let there is one class(controller for example) and there are dozes of conditional flow "if(some field of model) <do this> else if <do this>" and so on. So i have extracted all such flows in separated methods and now i am stuck. what i need it is to make some conditional mixing — so i could be able to move all methods in different mixins and apply them in init. But mixins are applied unconditionally(almost statically — at the moment of class' definition). So as for now i have only variant with Ext.Object.apply(this, new <more suitable mixin>) but as for me it looks ugly.
Is there some other approach?
Let there is one class(controller for example) and there are dozes of conditional flow "if(some field of model) <do this> else if <do this>" and so on. So i have extracted all such flows in separated methods and now i am stuck. what i need it is to make some conditional mixing — so i could be able to move all methods in different mixins and apply them in init. But mixins are applied unconditionally(almost statically — at the moment of class' definition). So as for now i have only variant with Ext.Object.apply(this, new <more suitable mixin>) but as for me it looks ugly.
Is there some other approach?