node.js| coffeescript presentation

Post on 25-Jun-2015

8.127 Views

Category:

Education

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

• 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

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

Oh wuddya look at that!

And that!

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

Totallllyyy popular

Told you!

WHO’S USING IT?

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

Just Ryan in March 09’

Nov 09’ = thanksgitin’

Nov 10’ – Ryan’s made friends!

Ry & co. on the Ryse

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)

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

Whoa, Whiplash!

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

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!

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.

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

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

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

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!

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;}

COFFEESCRIPT- Javascript in a speedo

• Speaks English • Pythonic Syntax • Complies to pure JS

• Same exact functionality as JS

• Makes hard things easier

KEY + EXAMPLES

THE EXISTENTIAL OPERATOR

ENGLISH!

===

!==

!

&&

||

TRUE

FALSE

THIS

IN

N/A

is

isnt

not

and

Or

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

Of

In

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

COFFEESCRIPT MODULES

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

• Unifies programming• Makes work even easier

Express: Pretty dope node web framework

node.JS “Hello World” server

Express “Hello World” server

Express Applications

• 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

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?

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.

top related