40

Node.JS| Coffeescript Presentation

Embed Size (px)

Citation preview

Page 1: Node.JS| Coffeescript Presentation
Page 2: Node.JS| Coffeescript Presentation

• What is node.js?• Why should you care? Because it’s the best around…• How? (not even 10K can bring it down!) • Corporate America has already caught on, so should you! • Why JS ? Why now?• Blocking|non-blocking I/O AKA event-driven programming.

What? • Google V8 JS Engine. VROOOOM VROOOM • Modules Modules Modules MODULES • Stylus = CSS like whoaaaa • Coffeescript = JS like whoaaa• Express• Examples• Pros|Cons • Check in b4 u check out • o/

The evening program

Page 3: Node.JS| Coffeescript Presentation

node.JS – A ready-set-code server

• Changing the notion of server functionality

• Built to handle tens of thousands (& counting) connections

• SSJS atop Google’s open-source JS engine

• Written in C/C++ • A PROBLEM SOLVER

Page 4: Node.JS| Coffeescript Presentation

Oh wuddya look at that!

Page 5: Node.JS| Coffeescript Presentation

And that!

Page 6: Node.JS| Coffeescript Presentation

It’s…It’s…It’s…It’s…It’s…IT’S

• It’s non-blocking (event-driven)

• It’s scalable • It’s syntactically accessible • It’s rich with resources • It’s built upon a castle of code and machines (C++ and V8)

• It’s totalllyyyyy popular • It’s about time

Page 7: Node.JS| Coffeescript Presentation

Totallllyyy popular

Page 8: Node.JS| Coffeescript Presentation

Told you!

Page 9: Node.JS| Coffeescript Presentation

WHO’S USING IT?

Page 10: Node.JS| Coffeescript Presentation

The Biggest Programming Party, +8

• It’s (1 of) the fastest-growing programming language(s) EVER

• Vibrant communities promote faster development and adoption

• More developers = more developments

• More developers working on an open-source project = more synergystic developments

Page 11: Node.JS| Coffeescript Presentation

Just Ryan in March 09’

Page 12: Node.JS| Coffeescript Presentation

Nov 09’ = thanksgitin’

Page 13: Node.JS| Coffeescript Presentation

Nov 10’ – Ryan’s made friends!

Page 14: Node.JS| Coffeescript Presentation

Ry & co. on the Ryse

Page 15: Node.JS| Coffeescript Presentation

Why JS & not something else?

• So many people already use it • Anon functions. Local/global variables set very appropriate stage for event-driven programming

• It’s already in all of our applications

• Reuse code between your browser & server implementations

• The JS interpreters race (V8 WINNING)

Page 16: Node.JS| Coffeescript Presentation

Google Chrome V8 JS engine

• Written in C++ (+1) • Open-source• Fast property access • Specifically designed for fast execution of large JS apps

• No intermediate byte codes, no interpreter (Dynamic Machine Code Generation) JIT compliing

• Efficient Garbage collection

Page 17: Node.JS| Coffeescript Presentation

Whoa, Whiplash!

Page 18: Node.JS| Coffeescript Presentation
Page 19: Node.JS| Coffeescript Presentation

The Internet: A single slide history

• 91’-99: THE HTML AGE : static, hand-coded crudely designed document files served to static clients.

• 00’-09’: THE LAMP AGE: databases replaced documents, solution stacks saturated the market.

• 10’-x’: THE JS AGE: dynamic web-apps, interactive information garnishing media-rich foundations

Page 20: Node.JS| Coffeescript Presentation

Really Though, Why?

“it doesn’t do anything that current technology can’t do…” WRONG SIR WRONG! “if you wanna node, you gotta write all your own code…”WRONG SIR WRONG! “it’s just another one of those darn kids doing something crazy. It’ll die out soon…” WRONG SIR WRONG! “it makes no sense to use for large businesses since it’s non-standardized, nor is it tried and true…” RIGHT SIR NOW, WRONG SIR LATER!“everything works just fine now, and changing things will just complicate everything for no reason…” WRONG SIR WRONG!

Page 21: Node.JS| Coffeescript Presentation

An event-driven request in 5 steps• request “/about.html” from your browser on a Node.js web server.

• Server accepts request & calls a function to retrieve that file from disk.

• While the server is waiting for the file to be retrieved, it services the next web request.

• When the file is retrieved, there is a callback function that is inserted in the Node servers queue.

• Node server executes that function (renders the “/about.html”) & sends it to your web browser.

Page 22: Node.JS| Coffeescript Presentation

MODULE MADDNESS!

• Boosts Productivity & Totally Inspires

• “Write Less. Do More” –jQuery • Comes shipped with core modules • An endless library of 3rd party mechanisms of all kinds

• NPM (node package managers) to ensure a smooth ride

Page 23: Node.JS| Coffeescript Presentation

Some Cool Core Modules

• Networking: net: create TCP server | client; http: create HTTP server or client

• Event Emitter: gives objects the ability to emit events (duh)

• Buffer: create buffers to transport binary data

• Streams: abstract interface implemented by various objects

Page 24: Node.JS| Coffeescript Presentation

3rd Party Modules: the preview

• face.Js : face-dectection in images w/OpenCV

• Node-wkhtml: html to pdf or image format using the webkit rendering engine, and qt.

• Node-boilerplate: takes html-boilerplate, express, connect and Socket.IO and organizes them into a ready to use website project.

• Coffeekup = make EVERYTHING coffeescript • static file servers = Lightnode, nitrode, trailer (everyone’s favorite backend), node-paperboy

Page 25: Node.JS| Coffeescript Presentation
Page 26: Node.JS| Coffeescript Presentation

Stylus: The node.JS CSS ENGINE- wow!

•  Expressive, dynamic, robust CSS framework, built for speed

• Optional: (: , ; , { }, , ,) = totally clean

• Expressive variables & built-in functions

• Error-reporting • Arithmetic!

Page 27: Node.JS| Coffeescript Presentation

body.profile #content section.profile section.markdown aside { width: 320px; float: left; margin-left: -320px;}body.profile #content section.profile section.markdown aside h2 { font: bold 13px DIN, "Helvetica Neue", Arial, Helvetica, sans-serif; line-height: 24px; text-transform: uppercase; -webkit-font-smoothing: antialiased; color: #555; letter-spacing: 1px; color: #ff006a; margin: 0 0 16px;}body.profile #content section.profile section.markdown aside ul { list-style: none;

body.profile #content section.profile section.markdown ul.process { margin-left: -320px;}body.profile #content section.profile section.markdown ul.process:after { display: block; clear: both; content: "";}body.profile #content section.profile section.markdown ul.process li { float: left; margin: 0 0 1px 1px; list-style: none;}body.profile #content section.profile section.markdown ul.process li p { padding: 16px; margin: 0; width: 127px; height: 127px; font: bold 13px DIN, "Helvetica Neue", Arial, Helvetica, sans-serif; line-height: 24px; text-transform: uppercase; -webkit-font-smoothing: antialiased; color: #555; letter-spacing: 1px; color: #ccc; transition: all 0.15s ease; -webkit-transition: all 0.15s ease; -moz-transition: all 0.15s ease; -o-transition: all 0.15s ease;}

Page 28: Node.JS| Coffeescript Presentation

COFFEESCRIPT- Javascript in a speedo

• Speaks English • Pythonic Syntax • Complies to pure JS

• Same exact functionality as JS

• Makes hard things easier

Page 29: Node.JS| Coffeescript Presentation

KEY + EXAMPLES

Page 30: Node.JS| Coffeescript Presentation

THE EXISTENTIAL OPERATOR

Page 31: Node.JS| Coffeescript Presentation

ENGLISH!

===

!==

!

&&

||

TRUE

FALSE

THIS

IN

N/A

is

isnt

not

and

Or

True, yes, onFalse, no, off@, this

Of

In

Page 32: Node.JS| Coffeescript Presentation
Page 33: Node.JS| Coffeescript Presentation

It’S JUST BEGUN-A-brewin’…!

Page 34: Node.JS| Coffeescript Presentation

COFFEESCRIPT MODULES

• Coffeekup: markup as CS• Coffeemate: framework for writing apps in CS

• Unifies programming• Makes work even easier

Page 35: Node.JS| Coffeescript Presentation
Page 36: Node.JS| Coffeescript Presentation

Express: Pretty dope node web framework

node.JS “Hello World” server

Express “Hello World” server

Page 37: Node.JS| Coffeescript Presentation

Express Applications

Page 38: Node.JS| Coffeescript Presentation

• Haters gonna hate • Learning Curves • Doesn’t try to be compatible with pre-existing software

• Updates make current projects liable to be incompatible with new releases

• Makes coding more intuitive (syntactically & technically)

• Developers are passionately clinkering away on improvements all day, every day

• Takes progressive strides in what many believe is the right direction

The Final + & - minus of it all

Page 39: Node.JS| Coffeescript Presentation

Are We Done Yet?

• Can you give a cocktail party version of what node.JS is?

• Are you going to go home and check it out?

• Are you convinced? • Are you envisioning a grand design with node as a backbone yet?

Page 40: Node.JS| Coffeescript Presentation

BEFORE YOU GO…

• Hey…I just wanna let you know I had a great time tonight and hope we could, ya know, maybe meetup again maybe and build a scalable server or something, or we could just build a static web page, whatever, totally up to you.