ciplogic.com
Live with grace. Write superb software.

Do you know why you would name a configuration object „o”?

Because then you can write this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
    /**
    Applies a new configuration object to the config of this YUI instance. This
    will merge new group/module definitions, and will also update the loader
    cache if necessary. Updating `Y.config` directly will not update the cache.
 
    @method applyConfig
    @param {Object} o the configuration object.
    @since 3.2.0
    **/
    applyConfig: function(o) {
 
        o = o || NOOP;
 
        var attr,
            name,
            // detail,
            config = this.config,

Personally I would have preferred:

1
    o= !o ?NOOP :o ; // note how many emotions are bundled in this code.

But it looks amazing anyway, that o=o is looking straight into my developer soul.

From here: https://github.com/yui/yui3/blob/master/src/yui/js/yui.js 

PS: Why else would someone name an object variable "o"?

Disqus Comments

comments powered by Disqus

Germanium

The one to rule them all. The browsers that is.

SharpKnight

SharpKnight is an Android chess game.

MagicGroup

MagicGroup is an eclipse plugin.