SlideShare a Scribd company logo
1 of 23
Download to read offline
JS Library and Tangram
      Introduction
          liyubei@baidu.com
                  2011-08-25
Outline

● Why we need JavaScript Library
● Comparison of JavaScript libraries
● Tangram history
● Tangram architecture
● Tangram development
   ○ demo
● Advance usage
   ○ demo
Why we need JavaScript Library

What's the issue it want to resolve?
Why we need JavaScript Library

What's the issue it want to resolve?

 1. language enhancement
      ○ klass/function
      ○ array
      ○ string
      ○ object
      ○ ...
Why we need JavaScript Library

What's the issue it want to resolve?

 1. language enhancement
 2. fix browser compatibility
      ○ DOM
      ○ Event
      ○ CSS
      ○ Network
      ○ Storage
      ○ ...
Comparison of JavaScript libraries

Why there are some many libraries (20+)?
http://en.wikipedia.
org/wiki/Comparison_of_JavaScript_frameworks
Comparison of JavaScript libraries

jQuery
jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling,
animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that
you write JavaScript.

YUI
The YUI Library is a set of utilities and controls, written with JavaScript and CSS, for building richly
interactive web applications using techniques such as DOM scripting, DHTML and AJAX.

Prototype
Prototype is a JavaScript Framework that aims to ease development of dynamic web applications.

Ext
Ext JS is a JavaScript library for building interactive web applications using techniques such as Ajax,
DHTML and DOM scripting.

Dojo
Dojo saves you time, delivers powerful performance, and scales with your development process. It’s the
toolkit experienced developers turn to for building superior desktop and mobile web experiences.
Comparison of JavaScript libraries

Why there are some many libraries?
http://en.wikipedia.
org/wiki/Comparison_of_JavaScript_frameworks

What is the difference between them, what the similarities?
Comparison of JavaScript libraries (cont)

Why we need our javascript library?
Comparison of JavaScript libraries (cont)

Why we need our javascript library?

The official statement
 1. 不方便修改,扩展核心
 2. 体积庞大
 3. 执行效率
 4. 不够协作开发
Comparison of JavaScript libraries (cont)

Why we need our javascript library?

The official statement
 1. 不方便修改,扩展核心
 2. 体积庞大
 3. 执行效率
 4. 不够协作开发

My point
 1. 可维护性(代码和团队)
 2. 稳定的API(不能因为升级导致一大批产品不可用)
 3. 精炼,没有过多冗余的代码
Comparison of JavaScript libraries (cont)

So, how about Google?

Micbael Bolin said in "Closure The Definitive Guide"

    1. JavaScript + HTML/CSS/DOM
    2. Collaborative development
    3. Managing complexity
    4. Modularization and conventions
    5. Testing and stability
Tangram history

1. jslib (prototype) (http://cang.baidu.com)
2. jsframework (http://frd.baidu.com)
3. Fl (http://tieba.baidu.com/test/rili)
4. Al (http://fe.baidu.com/doc)
5. Fe.JS (tieba, map)
6. Tangram (most of the product)
Tangram architecture
Tangram base

 1. ajax/                     1. fn/
 2. dom                       2. lang/
 3. element/                  3. object/
 4. cookie/                   4. platform/
 5. event/                    5. string/
 6. page/                     6. url/
 7. swf/                      7. async/
 8. array/                    8. json/
 9. browser/                  9. number/
10. date/                    10. sio/

Q:Why use 'x241' instead of '$1'?
Tangram base (cont)

T.e('#header').
  children().
  on('click', function(){
     alert('clicked');
  });
Tangram component

var CustomControl =
  baidu.ui.createUI(function(options){
     this.text = options.text || 'default text';
  }).extend({
     getContent : function() {
        return this.text;
     }
  })

var CustomControl = Class.create({
   initialize : function() {
   }
});
Tangram component (cont)

I need a simple dialog.
You need a simple dialog with mask.

how to meet this two requirement?
Tangram component (cont)

I need a simple dialog.
You need a simple dialog with mask.

how to meet this two requirement?

            behavior and addons.
Tangram component (cont)

behavior and addons.

I
///import baidu.ui.Dialog;

You
///import baidu.ui.Dialog;
///import baidu.ui.Dialog.Dialog$coverable;
Tangram component (cont)

baidu.ui.Base is an object, not an constructor.
Tangram development

1. checkout the code from github.com
2. hacking and testing
3. fix code style
4. launch code-review
5. commit to github.com
6. launch pull request
7. DEMO
Advance usage

1. code-search
2. Ftangram
    ○ best practice

More Related Content

What's hot

WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
Hyun-woo Park
 

What's hot (20)

Future of NodeJS
Future of NodeJSFuture of NodeJS
Future of NodeJS
 
Groovy & Grails
Groovy & GrailsGroovy & Grails
Groovy & Grails
 
Typescript - MentorMate Academy
Typescript - MentorMate AcademyTypescript - MentorMate Academy
Typescript - MentorMate Academy
 
Introduction to webGL
Introduction to webGLIntroduction to webGL
Introduction to webGL
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
 
Daniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého SchizmaDaniel Steigerwald - Este.js - konec velkého Schizma
Daniel Steigerwald - Este.js - konec velkého Schizma
 
Brig:Node.js + QML 華麗大冒險
Brig:Node.js + QML 華麗大冒險Brig:Node.js + QML 華麗大冒險
Brig:Node.js + QML 華麗大冒險
 
(C)NodeJS
(C)NodeJS(C)NodeJS
(C)NodeJS
 
Dot Net Training in Chennai
Dot Net Training in ChennaiDot Net Training in Chennai
Dot Net Training in Chennai
 
Let s Enjoy Node.js
Let s Enjoy Node.jsLet s Enjoy Node.js
Let s Enjoy Node.js
 
Getting Started with MongoDB and Node.js
Getting Started with MongoDB and Node.jsGetting Started with MongoDB and Node.js
Getting Started with MongoDB and Node.js
 
JavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web frameworkJavascriptMVC: Another choice of web framework
JavascriptMVC: Another choice of web framework
 
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
WHAT / WHY / HOW WE’RE ENGINEERING AT SMARTSTUDY (English)
 
GTUG JS will save us all
GTUG JS will save us allGTUG JS will save us all
GTUG JS will save us all
 
Mean Stack for Beginners
Mean Stack for BeginnersMean Stack for Beginners
Mean Stack for Beginners
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Mocha, chai and sinon
Mocha, chai and sinonMocha, chai and sinon
Mocha, chai and sinon
 
Fundamental of Node.JS - Internship Presentation - Week7
Fundamental of Node.JS - Internship Presentation - Week7Fundamental of Node.JS - Internship Presentation - Week7
Fundamental of Node.JS - Internship Presentation - Week7
 
HOW TO EXTEND WEBPACK WITH YOUR OWN PLUGINS
HOW TO EXTEND WEBPACK WITH YOUR OWN PLUGINSHOW TO EXTEND WEBPACK WITH YOUR OWN PLUGINS
HOW TO EXTEND WEBPACK WITH YOUR OWN PLUGINS
 
The Rust Programming Language
The Rust Programming LanguageThe Rust Programming Language
The Rust Programming Language
 

Similar to Tangram

Ajax with DWR
Ajax with DWRAjax with DWR
Ajax with DWR
gouthamrv
 
Technology Stack Discussion
Technology Stack DiscussionTechnology Stack Discussion
Technology Stack Discussion
Zaiyang Li
 
High Performance Ajax Applications 1197671494632682 2
High Performance Ajax Applications 1197671494632682 2High Performance Ajax Applications 1197671494632682 2
High Performance Ajax Applications 1197671494632682 2
Niti Chotkaew
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax Applications
Julien Lecomte
 
Google Dev Day2007
Google Dev Day2007Google Dev Day2007
Google Dev Day2007
lucclaes
 
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar TechnologiesRob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
george.james
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
Fred Sauer
 
Front-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsFront-end optimisation & jQuery Internals
Front-end optimisation & jQuery Internals
Artur Cistov
 
Java Script - A New Look
Java Script - A New LookJava Script - A New Look
Java Script - A New Look
rumsan
 

Similar to Tangram (20)

Ajax with DWR
Ajax with DWRAjax with DWR
Ajax with DWR
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoon
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
dJango
dJangodJango
dJango
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
 
Technology Stack Discussion
Technology Stack DiscussionTechnology Stack Discussion
Technology Stack Discussion
 
High Performance Ajax Applications 1197671494632682 2
High Performance Ajax Applications 1197671494632682 2High Performance Ajax Applications 1197671494632682 2
High Performance Ajax Applications 1197671494632682 2
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax Applications
 
Google Dev Day2007
Google Dev Day2007Google Dev Day2007
Google Dev Day2007
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
 
jQuery Tips Tricks Trivia
jQuery Tips Tricks TriviajQuery Tips Tricks Trivia
jQuery Tips Tricks Trivia
 
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar TechnologiesRob Tweed :: Ajax and the Impact on Caché and Similar Technologies
Rob Tweed :: Ajax and the Impact on Caché and Similar Technologies
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Rails Girls - Introduction to HTML & CSS
Rails Girls - Introduction to HTML & CSSRails Girls - Introduction to HTML & CSS
Rails Girls - Introduction to HTML & CSS
 
Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016
 
Challenges of angular in production (Tasos Bekos) - GreeceJS #17
Challenges of angular in production (Tasos Bekos) - GreeceJS #17Challenges of angular in production (Tasos Bekos) - GreeceJS #17
Challenges of angular in production (Tasos Bekos) - GreeceJS #17
 
Front-end optimisation & jQuery Internals
Front-end optimisation & jQuery InternalsFront-end optimisation & jQuery Internals
Front-end optimisation & jQuery Internals
 
Java Script - A New Look
Java Script - A New LookJava Script - A New Look
Java Script - A New Look
 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Tangram

  • 1. JS Library and Tangram Introduction liyubei@baidu.com 2011-08-25
  • 2. Outline ● Why we need JavaScript Library ● Comparison of JavaScript libraries ● Tangram history ● Tangram architecture ● Tangram development ○ demo ● Advance usage ○ demo
  • 3. Why we need JavaScript Library What's the issue it want to resolve?
  • 4. Why we need JavaScript Library What's the issue it want to resolve? 1. language enhancement ○ klass/function ○ array ○ string ○ object ○ ...
  • 5. Why we need JavaScript Library What's the issue it want to resolve? 1. language enhancement 2. fix browser compatibility ○ DOM ○ Event ○ CSS ○ Network ○ Storage ○ ...
  • 6. Comparison of JavaScript libraries Why there are some many libraries (20+)? http://en.wikipedia. org/wiki/Comparison_of_JavaScript_frameworks
  • 7. Comparison of JavaScript libraries jQuery jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. YUI The YUI Library is a set of utilities and controls, written with JavaScript and CSS, for building richly interactive web applications using techniques such as DOM scripting, DHTML and AJAX. Prototype Prototype is a JavaScript Framework that aims to ease development of dynamic web applications. Ext Ext JS is a JavaScript library for building interactive web applications using techniques such as Ajax, DHTML and DOM scripting. Dojo Dojo saves you time, delivers powerful performance, and scales with your development process. It’s the toolkit experienced developers turn to for building superior desktop and mobile web experiences.
  • 8. Comparison of JavaScript libraries Why there are some many libraries? http://en.wikipedia. org/wiki/Comparison_of_JavaScript_frameworks What is the difference between them, what the similarities?
  • 9. Comparison of JavaScript libraries (cont) Why we need our javascript library?
  • 10. Comparison of JavaScript libraries (cont) Why we need our javascript library? The official statement 1. 不方便修改,扩展核心 2. 体积庞大 3. 执行效率 4. 不够协作开发
  • 11. Comparison of JavaScript libraries (cont) Why we need our javascript library? The official statement 1. 不方便修改,扩展核心 2. 体积庞大 3. 执行效率 4. 不够协作开发 My point 1. 可维护性(代码和团队) 2. 稳定的API(不能因为升级导致一大批产品不可用) 3. 精炼,没有过多冗余的代码
  • 12. Comparison of JavaScript libraries (cont) So, how about Google? Micbael Bolin said in "Closure The Definitive Guide" 1. JavaScript + HTML/CSS/DOM 2. Collaborative development 3. Managing complexity 4. Modularization and conventions 5. Testing and stability
  • 13. Tangram history 1. jslib (prototype) (http://cang.baidu.com) 2. jsframework (http://frd.baidu.com) 3. Fl (http://tieba.baidu.com/test/rili) 4. Al (http://fe.baidu.com/doc) 5. Fe.JS (tieba, map) 6. Tangram (most of the product)
  • 15. Tangram base 1. ajax/ 1. fn/ 2. dom 2. lang/ 3. element/ 3. object/ 4. cookie/ 4. platform/ 5. event/ 5. string/ 6. page/ 6. url/ 7. swf/ 7. async/ 8. array/ 8. json/ 9. browser/ 9. number/ 10. date/ 10. sio/ Q:Why use 'x241' instead of '$1'?
  • 16. Tangram base (cont) T.e('#header'). children(). on('click', function(){ alert('clicked'); });
  • 17. Tangram component var CustomControl = baidu.ui.createUI(function(options){ this.text = options.text || 'default text'; }).extend({ getContent : function() { return this.text; } }) var CustomControl = Class.create({ initialize : function() { } });
  • 18. Tangram component (cont) I need a simple dialog. You need a simple dialog with mask. how to meet this two requirement?
  • 19. Tangram component (cont) I need a simple dialog. You need a simple dialog with mask. how to meet this two requirement? behavior and addons.
  • 20. Tangram component (cont) behavior and addons. I ///import baidu.ui.Dialog; You ///import baidu.ui.Dialog; ///import baidu.ui.Dialog.Dialog$coverable;
  • 21. Tangram component (cont) baidu.ui.Base is an object, not an constructor.
  • 22. Tangram development 1. checkout the code from github.com 2. hacking and testing 3. fix code style 4. launch code-review 5. commit to github.com 6. launch pull request 7. DEMO
  • 23. Advance usage 1. code-search 2. Ftangram ○ best practice