Factory Function File Pattern

This is an archived post from the ExtJS era — the code may be obsolete, but the principles often still apply.

Code in this post can be obsolete, however, principles and theory may still apply.

You know, I'm not very big fan of factory functions, nevertheless, I'm aware of the fact that they may be necessary in some situations. Here is the file pattern that works (briefly tested). Keep each factory function in a separate file name of which should be Namespace.Factory.functionName.js

3 comments

  1. ckrJuly 27, 2009archive
    Saki - a question here. Ext.apply({}, config, defaults); Does that apply in order? Meaning, if I wanted to override some of my defaults, would I not want to reverse config and defaults? Ext.apply({}, defaults, config); Thanks for putting this together!!
  2. SakiAugust 2, 2009archive
    You can think about it like this: - defaults are applied first - then config So, if property1="John" in defaults and property1="Mary" in config the target will result in having property1="Mary".
  3. omarFebruary 23, 2011archive
    is there any particular reason you dont like factory functions?? what you prefer instead ? excellent blog

Comments are closed on archived posts.