Closure Library
             
        
        
            Closure Library
            Built for use with the compiler
            
                - Namespaced & Functional
- Classical inheritance
- Type annotations
- Dependency management
- goog.ui.Component
Namespaced & Functional
            
                - Namespaced to separate code
- Namespacing makes it easier to find functionality (not all on the $ object)
- Functional makes it easier to override functionality
Classical inheritance
goog.provide('Class');
goog.require('Super');
/**
 * @constructor
 * @extends {Super}
 */
Class = function() {
    goog.base(this);
};
goog.inherits(Class, Super);
/**
 * @inheritDoc
 */
Class.prototype.method = function(arg) {
    return goog.base(this, 'method', arg);
};
        
        
            Classical inheritance
            Looks long, but autocomplete!
                
                    - Code organization
- Easy override functions
- Well understood
- Performance!
Type annotations
            
                - Annotating
- Optional... mostly
- Don't need to be explicit
/**
 * don't have to do this:
 * @param {{a: string, b: number}} param1
 * this will do to begin with:
 * @param {Object} param2
 */
        
        
            Dependency management
goog.provide('my.name.space');
goog.require('other.name.space');
            uncompiled
            run calcdeps.py to let the application know where to download dependencies from
            compiled
            compiler will include all dependencies in a single file in the correct order
            Want Dependency Injection? try 
LoaderWant to try it on your non-closure project? 
Mantri