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

What's hot (20)

PPT
Introduction To Website Development
zaidfarooqui974
 
PPT
ASP.NET 05 - Exception Handling And Validation Controls
Randy Connolly
 
PPTX
Session 36 - JSP - Part 1
PawanMM
 
ODP
frame works
Senthil Murugan
 
PPTX
Javascript
Mayank Bhatt
 
PPTX
Angular introduction basic
jagriti srivastava
 
PDF
Dot net interview questions and asnwers
kavinilavuG
 
PDF
Introduction To CodeIgniter
Muhammad Hafiz Hasan
 
PPT
Performance anti patterns in ajax applications
SergeyChernyshev
 
PPT
TSSJS2010 Presenatation on: Performance Anti Patterns In Ajax Applications
guestc75cdc
 
PPTX
Session 28 - Servlets - Part 4
PawanMM
 
PPTX
Building RESTfull Data Services with WebAPI
Gert Drapers
 
KEY
Server Side Programming
Zac Gordon
 
PPTX
Rest api with node js and express
GirlsInTechnology Nepal
 
PPT
Whats New In Asp.Net Web Forms 4
Rishu Mehra
 
PPTX
Resthub
Sébastien Deleuze
 
ODP
Introduction to Swagger
Knoldus Inc.
 
PPTX
Frisby Api automation
Dineesha Suraweera
 
PPTX
Web apps architecture
Tanmoy Barman
 
Introduction To Website Development
zaidfarooqui974
 
ASP.NET 05 - Exception Handling And Validation Controls
Randy Connolly
 
Session 36 - JSP - Part 1
PawanMM
 
frame works
Senthil Murugan
 
Javascript
Mayank Bhatt
 
Angular introduction basic
jagriti srivastava
 
Dot net interview questions and asnwers
kavinilavuG
 
Introduction To CodeIgniter
Muhammad Hafiz Hasan
 
Performance anti patterns in ajax applications
SergeyChernyshev
 
TSSJS2010 Presenatation on: Performance Anti Patterns In Ajax Applications
guestc75cdc
 
Session 28 - Servlets - Part 4
PawanMM
 
Building RESTfull Data Services with WebAPI
Gert Drapers
 
Server Side Programming
Zac Gordon
 
Rest api with node js and express
GirlsInTechnology Nepal
 
Whats New In Asp.Net Web Forms 4
Rishu Mehra
 
Introduction to Swagger
Knoldus Inc.
 
Frisby Api automation
Dineesha Suraweera
 
Web apps architecture
Tanmoy Barman
 

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

PPTX
Javascriptinobject orientedway-090512225827-phpapp02
Sopheak Sem
 
PPTX
Awesomeness of JavaScript…almost
Quinton Sheppard
 
PDF
Javascript for Intermediates
Ankit Agrawal
 
PDF
Javascript
Aditya Gaur
 
PPTX
Javascript Best Practices and Intro to Titanium
Techday7
 
PDF
Clojurescript slides
elliando dias
 
PPTX
All of javascript
Togakangaroo
 
KEY
Exciting JavaScript - Part I
Eugene Lazutkin
 
PPT
Introduction to Javascript
Amit Tyagi
 
PDF
[2015/2016] JavaScript
Ivano Malavolta
 
PPTX
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
PPT
Advanced JavaScript
Fu Cheng
 
PPTX
ES6 - JavaCro 2016
Nenad Pecanac
 
PPTX
JavaScript in Object-Oriented Way
Chamnap Chhorn
 
PPTX
Google closure compiler
Prasad Kancharla
 
PDF
Scalable JavaScript
Ynon Perek
 
PDF
JavaScript Core
François Sarradin
 
PDF
JavaScript Good Practices
Jussi Pohjolainen
 
PDF
Solid JavaScript Coding
Diwa Del Mundo
 
Javascriptinobject orientedway-090512225827-phpapp02
Sopheak Sem
 
Awesomeness of JavaScript…almost
Quinton Sheppard
 
Javascript for Intermediates
Ankit Agrawal
 
Javascript
Aditya Gaur
 
Javascript Best Practices and Intro to Titanium
Techday7
 
Clojurescript slides
elliando dias
 
All of javascript
Togakangaroo
 
Exciting JavaScript - Part I
Eugene Lazutkin
 
Introduction to Javascript
Amit Tyagi
 
[2015/2016] JavaScript
Ivano Malavolta
 
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Advanced JavaScript
Fu Cheng
 
ES6 - JavaCro 2016
Nenad Pecanac
 
JavaScript in Object-Oriented Way
Chamnap Chhorn
 
Google closure compiler
Prasad Kancharla
 
Scalable JavaScript
Ynon Perek
 
JavaScript Core
François Sarradin
 
JavaScript Good Practices
Jussi Pohjolainen
 
Solid JavaScript Coding
Diwa Del Mundo
 
Ad

Recently uploaded (20)

PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Ad

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