SlideShare a Scribd company logo
Closure Library: Build Complex
JavaScript Applications
Learn How Use Closure Library and Compiler
to build web applications that are
high-performance and cross-browser compatible
JavaScript Challenges
 Cross-Browser Compatibility
 No Dependency Mechanism
 No Namespace Mechanism
 No Visibility Controls
 No Type System
 No Static Checking
 Code Optimization and Minification
 Coding Style
Cross-Browser Compatibility
 Issues when working with the HTML DOM
 Different browsers’ JavaScript engines interpret and run the code differently
 Developers have to deal with browser quirks
No Dependency Mechanism
 Can't include or require other depent files from a javascript file
 Files used in a web page have to be specified in the html document using a
script tag
 <script src="path/to/file.js"></script>
 If a javascript file needs other files to be loaded before it can run, the files
have to be specified manually in the correct order
No Namespace Mechanism
 Most functions are part of the global namespace
 Variables may be defined in the global namespace by mistake
 function foo() { x= 10; }
 Garbage collection
 Only when variables/functions lose scope
 When including multiple files, variables or functions with same name are
overwritten
No Visibility Controls, No Type System
and No Static Checking
 JavaScript does not provide visibility controls for the properties and methods
of a class, like public, protected or private.
 This allows other code to access properties or methods that are not supposed to be
public.
 JavaScript does not provide a type system, meaning to that you can pass
parameters of any type to a function
 If the function is designed to accept a numeric parameter, and you pass a string,
this issue cannot be caught until runtime, when an error occurs.
 JavaScript does not provide static checking.
 This is related to the lack of a type system, and errors like wrong parameter type
passed to function could be checked by the compiler.
Code Optimization and Minification
 JavaScript does not provide a way, built into the language itself, to optimize
and minify the code.
 Closure Compiler
Closure Library
 Google Closure Library is the base JavaScript library for many Google products
 Search, Gmail, Maps, Calendar, Google+ and more.
 Open-source
 Library, not Framework
 A library is a set of components that you can use without any restrictions on how or
where to write your code.
 Suitable for more complex applications, with a larger codebase, usually
developed by a team
Closure Library
 Reusable Components
 Dependency and Namespaces
 Object-Oriented
 Server-Agnostic, Cross-Browser Compatibility
 JSDoc Annotations
 Closure Compiler
Reusable Components
 Large set of reusable components
 DOM manipulation
 User Interface Components
 Event Handling
 Server Communication
 Daata Structures
 and more
Dependency and Namespaces
 Closure library provides an interesting namespace mechanism, similar to the
import statements in java or use statements in php.
 goog.provide("my.company.app");
 goog.require("my.company.data.model");
Object-Oriented
 Closure library allows you to write object-oriented JavaScript and take
advantage of the concepts of abstraction, encapsulation, inheritance and
polymorphism.
 The code you will write is more maintainable, reusable and scalable.
Server-Agnostic, Cross-Browser
Compatibility
 Closure library is server agnostic and cross browser compatible; it is also well
tested and documented.
JSDoc Annotations
 By using the JS doc annotations you can document your code, specify the
input type for the parameters of functions, the types of properties or the
types of values returned by functions.
 These annotations will be used by the closure compiler to check and catch
possible runtime errors at compile time.
Closure Compiler
 Closure compiler is used optimize and minify JavaScript code
 It removes dead code (code that is not being called)
 It checks the syntax, variable references, parameter types
 It also rewrites and minimizes into compact and high performance code
Closure Library: Build Complex
JavaScript Applications
Learn How Use Closure Library and Compiler
to build web applications that are
high-performance and cross-browser compatible

More Related Content

ODP
Web 2 0 Technologies
PPT
ASP.NET 3.5 SP1 (VSLive San Francisco 2009)
PPT
Silverlight 2
PPTX
MVC - Introduction
PPT
Ajax toolkit-framework
PPT
Pentest Application With GraphQL | Null Bangalore Meetup
PPTX
AngularJS = Browser applications on steroids
PDF
Api presentation
Web 2 0 Technologies
ASP.NET 3.5 SP1 (VSLive San Francisco 2009)
Silverlight 2
MVC - Introduction
Ajax toolkit-framework
Pentest Application With GraphQL | Null Bangalore Meetup
AngularJS = Browser applications on steroids
Api presentation

What's hot (20)

PPT
Introduction To Website Development
PPT
ASP.NET 05 - Exception Handling And Validation Controls
PPTX
Session 36 - JSP - Part 1
ODP
frame works
PPTX
Javascript
PPTX
Angular introduction basic
PDF
Dot net interview questions and asnwers
PDF
Introduction To CodeIgniter
PPT
Performance anti patterns in ajax applications
PPT
TSSJS2010 Presenatation on: Performance Anti Patterns In Ajax Applications
PPTX
Session 28 - Servlets - Part 4
PPTX
Building RESTfull Data Services with WebAPI
KEY
Server Side Programming
PPTX
Rest api with node js and express
PPT
Whats New In Asp.Net Web Forms 4
PPTX
ODP
Introduction to Swagger
PPTX
Frisby Api automation
PPTX
Web apps architecture
Introduction To Website Development
ASP.NET 05 - Exception Handling And Validation Controls
Session 36 - JSP - Part 1
frame works
Javascript
Angular introduction basic
Dot net interview questions and asnwers
Introduction To CodeIgniter
Performance anti patterns in ajax applications
TSSJS2010 Presenatation on: Performance Anti Patterns In Ajax Applications
Session 28 - Servlets - Part 4
Building RESTfull Data Services with WebAPI
Server Side Programming
Rest api with node js and express
Whats New In Asp.Net Web Forms 4
Introduction to Swagger
Frisby Api automation
Web apps architecture
Ad

Similar to Closure Library: Build Complex JavaScript Applications (20)

PPTX
Javascriptinobject orientedway-090512225827-phpapp02
PPTX
Awesomeness of JavaScript…almost
PDF
Javascript for Intermediates
PDF
Javascript
PPTX
Javascript Best Practices and Intro to Titanium
PDF
Clojurescript slides
PPTX
All of javascript
KEY
Exciting JavaScript - Part I
PPT
Introduction to Javascript
PDF
[2015/2016] JavaScript
PPTX
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
PPT
Advanced JavaScript
PPTX
ES6 - JavaCro 2016
PPTX
JavaScript in Object-Oriented Way
PPTX
Google closure compiler
PDF
Scalable JavaScript
PDF
JavaScript Core
PDF
JavaScript Good Practices
PDF
Solid JavaScript Coding
Javascriptinobject orientedway-090512225827-phpapp02
Awesomeness of JavaScript…almost
Javascript for Intermediates
Javascript
Javascript Best Practices and Intro to Titanium
Clojurescript slides
All of javascript
Exciting JavaScript - Part I
Introduction to Javascript
[2015/2016] JavaScript
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
Advanced JavaScript
ES6 - JavaCro 2016
JavaScript in Object-Oriented Way
Google closure compiler
Scalable JavaScript
JavaScript Core
JavaScript Good Practices
Solid JavaScript Coding
Ad

Recently uploaded (20)

PDF
KodekX | Application Modernization Development
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Advanced IT Governance
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
PDF
Modernizing your data center with Dell and AMD
PDF
Sensors and Actuators in IoT Systems using pdf
PPTX
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Transforming Manufacturing operations through Intelligent Integrations
PDF
SAP855240_ALP - Defining the Global Template PUBLIC.pdf
PDF
Smarter Business Operations Powered by IoT Remote Monitoring
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
REPORT: Heating appliances market in Poland 2024
PDF
Chapter 2 Digital Image Fundamentals.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Reimagining Insurance: Connected Data for Confident Decisions.pdf
PDF
Advanced Soft Computing BINUS July 2025.pdf
KodekX | Application Modernization Development
GamePlan Trading System Review: Professional Trader's Honest Take
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Advanced IT Governance
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Modernizing your data center with Dell and AMD
Sensors and Actuators in IoT Systems using pdf
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
Review of recent advances in non-invasive hemoglobin estimation
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Transforming Manufacturing operations through Intelligent Integrations
SAP855240_ALP - Defining the Global Template PUBLIC.pdf
Smarter Business Operations Powered by IoT Remote Monitoring
“AI and Expert System Decision Support & Business Intelligence Systems”
REPORT: Heating appliances market in Poland 2024
Chapter 2 Digital Image Fundamentals.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Reimagining Insurance: Connected Data for Confident Decisions.pdf
Advanced Soft Computing BINUS July 2025.pdf

Closure Library: Build Complex JavaScript Applications

  • 1. Closure Library: Build Complex JavaScript Applications Learn How Use Closure Library and Compiler to build web applications that are high-performance and cross-browser compatible
  • 2. JavaScript Challenges  Cross-Browser Compatibility  No Dependency Mechanism  No Namespace Mechanism  No Visibility Controls  No Type System  No Static Checking  Code Optimization and Minification  Coding Style
  • 3. Cross-Browser Compatibility  Issues when working with the HTML DOM  Different browsers’ JavaScript engines interpret and run the code differently  Developers have to deal with browser quirks
  • 4. No Dependency Mechanism  Can't include or require other depent files from a javascript file  Files used in a web page have to be specified in the html document using a script tag  <script src="path/to/file.js"></script>  If a javascript file needs other files to be loaded before it can run, the files have to be specified manually in the correct order
  • 5. No Namespace Mechanism  Most functions are part of the global namespace  Variables may be defined in the global namespace by mistake  function foo() { x= 10; }  Garbage collection  Only when variables/functions lose scope  When including multiple files, variables or functions with same name are overwritten
  • 6. No Visibility Controls, No Type System and No Static Checking  JavaScript does not provide visibility controls for the properties and methods of a class, like public, protected or private.  This allows other code to access properties or methods that are not supposed to be public.  JavaScript does not provide a type system, meaning to that you can pass parameters of any type to a function  If the function is designed to accept a numeric parameter, and you pass a string, this issue cannot be caught until runtime, when an error occurs.  JavaScript does not provide static checking.  This is related to the lack of a type system, and errors like wrong parameter type passed to function could be checked by the compiler.
  • 7. Code Optimization and Minification  JavaScript does not provide a way, built into the language itself, to optimize and minify the code.  Closure Compiler
  • 8. Closure Library  Google Closure Library is the base JavaScript library for many Google products  Search, Gmail, Maps, Calendar, Google+ and more.  Open-source  Library, not Framework  A library is a set of components that you can use without any restrictions on how or where to write your code.  Suitable for more complex applications, with a larger codebase, usually developed by a team
  • 9. Closure Library  Reusable Components  Dependency and Namespaces  Object-Oriented  Server-Agnostic, Cross-Browser Compatibility  JSDoc Annotations  Closure Compiler
  • 10. Reusable Components  Large set of reusable components  DOM manipulation  User Interface Components  Event Handling  Server Communication  Daata Structures  and more
  • 11. Dependency and Namespaces  Closure library provides an interesting namespace mechanism, similar to the import statements in java or use statements in php.  goog.provide("my.company.app");  goog.require("my.company.data.model");
  • 12. Object-Oriented  Closure library allows you to write object-oriented JavaScript and take advantage of the concepts of abstraction, encapsulation, inheritance and polymorphism.  The code you will write is more maintainable, reusable and scalable.
  • 13. Server-Agnostic, Cross-Browser Compatibility  Closure library is server agnostic and cross browser compatible; it is also well tested and documented.
  • 14. JSDoc Annotations  By using the JS doc annotations you can document your code, specify the input type for the parameters of functions, the types of properties or the types of values returned by functions.  These annotations will be used by the closure compiler to check and catch possible runtime errors at compile time.
  • 15. Closure Compiler  Closure compiler is used optimize and minify JavaScript code  It removes dead code (code that is not being called)  It checks the syntax, variable references, parameter types  It also rewrites and minimizes into compact and high performance code
  • 16. Closure Library: Build Complex JavaScript Applications Learn How Use Closure Library and Compiler to build web applications that are high-performance and cross-browser compatible