×
Copy
Open
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
a large JavaScript codebase Conquering
Slide 2
Slide 2 text
@sergimansilla
Slide 3
Slide 3 text
No content
Slide 4
Slide 4 text
No content
Slide 5
Slide 5 text
No content
Slide 6
Slide 6 text
Create Share Test Deploy Run/Debug
Slide 7
Slide 7 text
The$easiest$way$to$create$Node.js$apps
Slide 8
Slide 8 text
Ftp WebDAV Heroku Git Language Analysis Vim mode Run/Debug Cloud storage Revisions Search Collaboration Cloudfoundry Azure Testing CLI Bitbucket Plugins
Slide 9
Slide 9 text
Pretty big app
Slide 10
Slide 10 text
More than 1M lines (with semicolons)
Slide 11
Slide 11 text
Of JavaScript
Slide 12
Slide 12 text
Pure madness
Slide 13
Slide 13 text
Why sparta madness?
Slide 14
Slide 14 text
Javascript/Node.js make you more productive
Slide 15
Slide 15 text
But they won’t help you through your growing pains
Slide 16
Slide 16 text
What about some examples
Slide 17
Slide 17 text
No content
Slide 18
Slide 18 text
Why Node.JS?
Slide 19
Slide 19 text
No content
Slide 20
Slide 20 text
V8 JavaScript engine
Slide 21
Slide 21 text
Bindings to libuv
Slide 22
Slide 22 text
Best cross-platform I/O library
Slide 23
Slide 23 text
API accessible from JavaScript
Slide 24
Slide 24 text
Async I/O
Slide 25
Slide 25 text
Async I/O is a big deal
Slide 26
Slide 26 text
You can do things like this without blocking
Slide 27
Slide 27 text
You can do things like this without blocking Loop$monkey,$loop! Write$a$‘.’$for$each$read$file Read$this$very$file
Slide 28
Slide 28 text
No content
Slide 29
Slide 29 text
You probably want something like this Read$this$very$file Write$a$‘.’$for$each$read$file Loop$monkey,$loop! Only$100$items$at$a$ Dme,$thanks
Slide 30
Slide 30 text
Never, ever, ever, EVER block
Slide 31
Slide 31 text
No content
Slide 32
Slide 32 text
In node, all APIs are asynchronous
Slide 33
Slide 33 text
In node, all APIs are asynchronous?
Slide 34
Slide 34 text
Getting a hash
Slide 35
Slide 35 text
Getting a hash
Slide 36
Slide 36 text
Getting a hash
Slide 37
Slide 37 text
Getting a hash
Slide 38
Slide 38 text
Profile before going live
Slide 39
Slide 39 text
DTrace + node-stackvis http://blog.nodejs.org/2012/04/25/profiling-node-js/
Slide 40
Slide 40 text
Embrace the paradigm
Slide 41
Slide 41 text
Push processing to the client
Slide 42
Slide 42 text
Use workers
Slide 43
Slide 43 text
Use workers serialization < computation BUT only if
Slide 44
Slide 44 text
Use workers worker.postMessage(...) Small objects only!
Slide 45
Slide 45 text
Modularize your code
Slide 46
Slide 46 text
Your application will fail
Slide 47
Slide 47 text
Be prepared
Slide 48
Slide 48 text
Architect github.com/c9/architect
Slide 49
Slide 49 text
“A simple yet powerful plugin system for large-scale node applications”
Slide 50
Slide 50 text
Isolation
Slide 51
Slide 51 text
Security
Slide 52
Slide 52 text
Providers / Consumers
Slide 53
Slide 53 text
Advanced IPC between processes
Slide 54
Slide 54 text
Sourcemint github.com/sourcemint/sm-npm
Slide 55
Slide 55 text
Package manager that wraps package managers
Slide 56
Slide 56 text
Understands any kind of dependency (npm, pip, git, zip...)
Slide 57
Slide 57 text
Easy edit/publish
Slide 58
Slide 58 text
Tooling matters
Slide 59
Slide 59 text
Normal developers
Slide 60
Slide 60 text
JavaScript Developer
Slide 61
Slide 61 text
No content
Slide 62
Slide 62 text
Tooling matters
Slide 63
Slide 63 text
Tooling matters especially for JavaScript
Slide 64
Slide 64 text
No content
Slide 65
Slide 65 text
Use the power of...
Slide 66
Slide 66 text
tatic
Slide 67
Slide 67 text
program analysis
Slide 68
Slide 68 text
No content
Slide 69
Slide 69 text
Iterating using undeclared variable
Slide 70
Slide 70 text
Warning: you are in an anonymous inner function with its own “this” pointer
Slide 71
Slide 71 text
Did you mean length?
Slide 72
Slide 72 text
“The most important thing I have done as a programmer in recent years is to aggressively pursue static code analysis.” John Carmack
Slide 73
Slide 73 text
treehugger.js github.com/ajaxorg/treehugger
Slide 74
Slide 74 text
“The jQuery of AST analysis.”
Slide 75
Slide 75 text
What can you do with it?
Slide 76
Slide 76 text
Low-level tooling
Slide 77
Slide 77 text
Intelligent code completion
Slide 78
Slide 78 text
Complex refactoring
Slide 79
Slide 79 text
Automate everything
Slide 80
Slide 80 text
Human error happens
Slide 81
Slide 81 text
Human error happens ALL THE TIME
Slide 82
Slide 82 text
Spend time on automation scripts
Slide 83
Slide 83 text
Spend time on automation scripts It really pays off
Slide 84
Slide 84 text
Happy coding!
Slide 85
Slide 85 text
Questions?
Slide 86
Slide 86 text
http://github.com/sergi @sergimansilla http://c9.io