Taming JavaScript with Cloud9 IDE: a Tale of Tree Hugging
Zef Hemel (@zef)
Taming JavaScript with Cloud9 IDE: a Tale of Tree Hugging Zef Hemel - - PowerPoint PPT Presentation
Taming JavaScript with Cloud9 IDE: a Tale of Tree Hugging Zef Hemel (@zef) .js browser.js db.js server.js *.js ~140,000 Tooling matters JavaScript Developer HTML CSS JavaScript HTML5 Client CSS3 JavaScript HTML5 Client CSS3
Taming JavaScript with Cloud9 IDE: a Tale of Tree Hugging
Zef Hemel (@zef)
Tooling matters
JavaScript Developer
HTML
CSS
HTML5 CSS3 JavaScript
Client
HTML5 CSS3 JavaScript
Client
Node.js Redis
Server
HTML5 CSS3 JavaScript
Client
Node.js Redis
Server
XMLHttpRequest HTML5 WebSocketsMozilla Bespin
Mozilla Bespin Canvas
Browser Wars 2.0
DOM
Sidebar
Sidebar
Sidebar
Sidebar
Sidebar
Sidebar
Sidebar
Sidebar
JavaScript C/C++ Closure CoffeeScript Coldfusion C# CSS Groovy HTML Java JSON LaTeX Lua Markdown OCaml Perl PHP Ruby Scad Scala SCSS SQL SVG Textile XML
Component Systems
Message Queues
Decoupling
Tooling matters especially for JavaScript
awesome power of...
program analysis
Iterating using undeclared variable
Warning: you are in an anonymous inner function with its
Did you mean “length”?
“The most important thing I have done as a programmer in recent years is to aggressively pursue static code analysis.”
John Carmack
Parse
Analyze
Parser
Code AST
Abstract Syntax Tree
a * 10
Parser
Op Var Num“*” “a” “10”
Zeon UglifyJS Narcissus Esprima language.js
performance (speed/memory) AST datastructure traversal tools
performance (speed/memory) AST datastructure traversal tools
JavaScript specific
“The JQuery of AST analysis.”
treehugger.js
treehugger.js
Generic AST Data structuretreehugger.js
Generic AST Data structure Generic Traversalstreehugger.js
Generic AST Data structure Generic Traversals DSL with Pattern Matchingtreehugger.js
Generic AST Data structure Generic Traversals DSL with Pattern Matching Language- Specific Parserstreehugger.js
Generic AST Data structure Generic Traversals DSL with Pattern Matching Language- Specific ParsersJavaScript
(UglifyJS-based)treehugger.js
Generic AST Data structure Generic TraversalsDSL with Pattern Matching
Language- Specific ParsersJavaScript
(UglifyJS-based)a * 10
Op Var Num“*” “a” “10”
Op("*", Var("a"), Num("10"))
Op Var Num“*” “a” “10”
Op("*", Var("a"), Num("10")) ATerm
Op Var Num“*” “a” “10”
Constructors Lists Strings Var(_) [_, _] "hello" Placeholders x
let’s play
can you do with it?
Low-level tooling
Intelligent code completion
Complex refactoring
What if...
Your (dev) environment matters
use static analysis tools
http://c9.io
@zef
http://github.com/ajaxorg/treehugger