1. #1
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,311
    Vote Rating
    109
    LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light

      0  

    Default Ext.util.Observable usage

    Ext.util.Observable usage


    I did a search of the entire Ext JS code base to see how the Ext.util.Observable class is used...

    The mixin pattern is used the most frequently, but a small number of Ext JS classes extend Observable.

    Is there a reason for this inconsistency? I think the mixin pattern should be preferred because it makes the prototype chain shorter.

    Code:
    Ext.define('Ext.state.Provider', {
        mixins: {
            observable: 'Ext.util.Observable'
        },
        ...
    Code:
    Ext.define('Ext.selection.Model', {
        extend: 'Ext.util.Observable',
        alternateClassName: 'Ext.AbstractSelectionModel',
        requires: ['Ext.data.StoreManager'],
        mixins: {
            bindable: 'Ext.util.Bindable'    
        },
        ....

  2. #2
    Ext JS Premium Member burnnat's Avatar
    Join Date
    Jun 2011
    Posts
    416
    Vote Rating
    61
    burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough burnnat is a jewel in the rough

      0  

    Default


    I can't speak authoritatively (of course), but if I were to offer a guess, my first impression is that it could be because Ext.util.Observable provides a constructor that is automatically inherited by subclasses, but has to be explicitly called when used as a mixin. As a result, strict subclasses have somewhat cleaner code:
    Code:
    Ext.define('MixinObservable', {
        mixins: {
            observable: 'Ext.util.Observable'
        },
        
        constructor: function() {
            var me = this;
            me.mixins.observable.constructor.call(me);
        }
    })
    
    // ... versus ...
    
    Ext.define('SubclassObservable', {
        extend: 'Ext.util.Observable'
    });
    Whether the shorter prototype chain is worth the tradeoff with more verbose code is a separate question, I think. And this is just a guess anyway.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi