The evening program<br />What is node.js?<br />Why should you care? Because it’s the best around…<br />How? (not even 10K ...
node.JS – A ready-set-code server <br />Changing the notion of server functionality <br />Built to handle tens of thousand...
Oh wuddya look at that!<br />
And that!<br />
It’s…It’s…It’s…It’s…It’s…IT’S<br />It’s non-blocking (event-driven) <br />It’s scalable <br />It’s syntactically accessibl...
Totallllyyy popular <br />
Told you! <br />
WHO’S USING IT? <br />
The Biggest Programming Party, +8 <br />It’s (1 of) the fastest-growing programming language(s) EVER<br />Vibrant communit...
Just Ryan in March 09’ <br />
Nov 09’ = thanksgitin’ <br />
Nov 10’ – Ryan’s made friends!<br />
Ry & co. on the Ryse <br />
Why JS & not something else?<br />So many people already use it <br />Anon functions. Local/global variables set very appr...
Google Chrome V8 JS engine <br />Written in C++ (+1) <br />Open-source<br />Fast property access <br />Specifically design...
Whoa, Whiplash! <br />
The Internet: A single slide history <br />91’-99: THE HTML AGE : static, hand-coded crudely designed document files serve...
Really Though, Why? <br />“it doesn’t do anything that current technology can’t do…” <br />WRONG SIR WRONG! <br />“if you ...
An event-driven request in 5 steps<br />request “/about.html” from your browser on a Node.js web server.<br />Server accep...
MODULE MADDNESS!<br />Boosts Productivity & Totally Inspires <br />“Write Less. Do More” –jQuery<br />Comes shipped with c...
Some Cool Core Modules <br />Networking: net: create TCP server | client; http: create HTTP server or client <br />Event E...
3rd Party Modules: the preview<br />face.Js : face-dectection in images w/OpenCV<br />Node-wkhtml: html to pdf or image fo...
Stylus: The node.JS CSS ENGINE- wow!  <br /> Expressive, dynamic, robust CSS framework, built for speed <br />Optional: (:...
body.profile #content section.profile section.markdown aside {<br />  width: 320px;<br />  float: left;<br />  margin-left...
COFFEESCRIPT- Javascript in a speedo <br />Speaks English <br />Pythonic Syntax <br />Complies to pure JS <br />Same exact...
KEY  + EXAMPLES <br />
ENGLISH!<br />	===<br />			!==<br />			!<br />			&&<br />			||<br />			true<br />			false<br />		this<br />			in<br />			n...
It’S JUST BEGUN-A-brewin’…!<br />
COFFEESCRIPT MODULES <br />Coffeekup: markup as CS<br />Coffeemate: framework for writing apps in CS<br />Unifies programm...
Express: Pretty dope node web framework  <br />node.JS “Hello World” server <br />Express “Hello World” server <br />
Express Applications <br />
The Final + & - minus of it all<br />Makes coding more intuitive (syntactically & technically)<br />Developers are passion...
Are We Done Yet? <br />Can you give a cocktail party version of what node.JSis? <br />Are you going to go home and check i...
BEFORE YOU GO…<br />Hey…I just wanna let you know I had a great time tonight and hope we could, ya know, maybe meetupagain...
Upcoming SlideShare
Loading in …5

Node.JS| Coffeescript Presentation


Published on

Published in: Education, Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Hi (introduce yourself ) 1. front end engineer @ a software firm in queens, I don’t work with node there. I found out about it around april and surprisingly fell in loveIm a designer, went to art school, didn’t have any interest in servers, but node has changed my outlook on what a web application is , and it’s turned my outlook all around on what I think they will be. So there’s a lot to learn, and im really excited, I have been since the day I heard “SSJS” and hope to get everyone else here gung-ho about a new way to view the webs
  • Lowdown on all the major components of this new framework Specify it’s biggest strengths Show how these strengths are effecting the job market Answer the fundamental question of why JS is better than other languages for this Why 2011 than other years Explain the parameters of nodes primary claim to fame- it’s event-driven nature Introduce you to V8 the JS engine powerhouse buttressing these behemoth language Give a little tour of the core modules(pre-packaged open-source code for complex functionality) and some of the cooler 3rd party ones in nodes API Show you what people are doing/what’s already been done with itPlay devils advocate for a hot minute and give nodes very tiny dark side the light of day Make sure this talk achieved what it was meant to Then we go home and rejoice at this newfound power just waiting to be harnessed by enterprising creatives
  • Server functionality - it’s a new way of thinking about creating dynamic web apps that puts the power of interactivity in the hands of designers as well as programmers. If you know node, in addition to the usual technologies, you can build what you design.2. The C10K problem – limitation of most current servers, there are a few others that address this problem and have a following but not like node does. 3. It works in tandem with the fastest JS engine around 4. Written in C/C++ which is good because the only thing any of us will ever need to know about that is that it’s multi-paradigm, and intermediate level (high-level and low-level)5. Since it’s JS, there doesn’t have to be that workplace divide between programmers and designers, the program and the design
  • These are graphs of two very basic performance tests to see how node.js server behaves compared to Apache when serving very simple pages.For comparison I have used node.js 0.1.103 on one side, and Apache 2.2.14 with prefork MPM and PHP 5.2.10 on the other, hitting them with ApacheBench 2.3 and total of 100,000 request with 1,000 concurrent requests during first test:
  • This is the CPU memory usage comparison As the above tests show, node is fast. Really fast. Much faster than Apache - many more requests per second, higher transfer rate with much smaller number of failed requests at the same time. Really shining.Obviously it is more hungry for system&apos;s CPU and memory, but this should not be surprising considering its performance. 
  • — Home of the Cloud9 IDE, Platform and O3 Node modulesCellkastGames – Tickade is an online redemption games platform where players can play casual games by themselves or against each other for tickets. Players can exchange tickets for real world prizes of their choice delivered to their doorsYammer — The Yammer Application Platform heavily uses node.jsWompt — A polished web-chatroom application with open authentication.Koding – Browser-based IDE and Cloud Computing Platform for PHP/Ruby/Python and others.Votizen — Social lobbying for registered voters.Dozens of other companies, not to mention all the fragmented projects that don’t stand behind corporate forces.
  • The idea of &quot;one language to rule them all&quot; is appealing to developers who have been bounced from one language to another as each new technology emerges. Most new technologies die not because of their lack of merit, but because of obscurity. A new language or framework needs a large enough pool of users and core developers in order for it to be sustainable. Large marketing campaigns and the backing of a big company can push a programming language or technology framework into the mainstream, but sometimes it happens from the ground up.Node generated excitement on its first release because programmers find it interesting and powerful. It&apos;s hard to find negative comments from those who are using it.
  • The blocks are lines added lines deleted. This graph shows anywhere from 73 – 31,554 edit
  • The past 8 months things calmed down on the graph a bit since the releases got more and more stabile and things were able to cool down a bit.
  • This is taken from github’s node page to illustrate the growth over the past 2 years
  • JavaScript was created by Brendan Eich in 1995 to be a simple scripting language for use in web pages on the Netscape browser platform. -While server-side JavaScript didn&apos;t really catch on then, that certainly wasn&apos;t true for the exploding browser market. On the Web JavaScript competed with Microsoft&apos;s VBScript to provide programming functionality in Web pages. It&apos;s hard to say why JavaScript won, perhaps Microsoft allowing JavaScript in Internet Explorer* (a varient of JS known as JScript) did it. Perhaps it was the JavaScript language itself in its syntactic accessibility, but win it did. This meant by the early 2000s JavaScript had emerged as the Web language. Not the first choice, but the only choice for programming with HTML in browsers.Why is this type of setup ideal for Node? JavaScript is a great language for event-driven programming, because it allows anonymous functions and closures, and more importantly, the syntax is familiar to nearly everyone who has ever coded. The callback functions that are called when an event occurs can be written in the same spot where you capture the event. Easy to code, easy to maintain. No complicated Object Oriented frameworks, no interfaces, no potential for over-architecting anything. Just listen for an event, write a callback function, and everything is taken care of!Having a single language makes some sense. For one thing, you can reuse code between browser and server implementations rather than try to map APIs between different languages. You can also happily use JSON as your default serialization. And you only need to learn one language.What node did was took the common practices of other platforms like Ruby, PERL and Python in JS and says “let’s use the successful event-driven programming model of the web and use it to make an easy way to build scalable servers. And let’s make it the only way people can do anything on this platform.”
  • a JavaScript engine actually interprets the code and executes it. With V8, Google created an ultra-fast interpreter written in C++, with another unique aspect: you can download the engine and embed it in any application you wish. It&apos;s not restricted to running in a browser. So, Node actually uses the V8 JavaScript engine written by Google and repurposes it for use on the server. Perfect! Why create a new language when there&apos;s a good solution already available. This is important because it is a great, very powerful foundation to base node.JS off of. V8 is many times faster than JScript (in Internet Explorer), SpiderMonkey (in Firefox), and JavaScriptCore (in Safari) in all their testing benchmarks. If your web application is bound by JavaScript execution speed, using V8 instead of your current JavaScript engine is likely to improve your application&apos;s performance.FAST PROPERTY ACCESS-JavaScript is a dynamic programming language: properties can be added to, and deleted from, objects on the fly. This means an object&apos;s properties are likely to change. Most JavaScript engines use a dictionary-like data structure as storage for object properties - each property access requires a dynamic lookup to resolve the property&apos;s location in memory. This approach makes accessing properties in JavaScript typically much slower than accessing instance variables in programming languages like Java and Smalltalk. In these languages, instance variables are located at fixed offsets determined by the compiler due to the fixed object layout defined by the object&apos;s class. Access is simply a matter of a memory load or store, often requiring only a single instruction.To reduce the time required to access JavaScript properties, V8 does not use dynamic lookup to access properties. Instead, V8 dynamically creates hidden classes behind the scenes. DYNAMIC MACHINE CODE GENERATION:V8 compiles JavaScript source code directly into machine code when it is first executed. There are no intermediate byte codes, no interpreter. Property access is handled by inline cache code that may be patched with other machine instructions as V8 executes.During initial execution of the code for accessing a property of a given object, V8 determines the object&apos;s current hidden class. V8 optimizes property access by predicting that this class will also be used for all future objects accessed in the same section of code and uses the information in the class to patch the inline cache code to use the hidden class. If V8 has predicted correctly the property&apos;s value is assigned (or fetched) in a single operation. If the prediction is incorrect, V8 patches the code to remove the optimisation.GARBAGE COLLECTION: In V8, the object heap is segmented into two parts: new space where objects are created, and old space to which objects surviving a garbage collection cycle are promoted. If an object is moved in a garbage collection cycle, V8 updates all pointers to the object.
  • This is a benchmark test for chromes JS engine performance to see how it stacks up against other browsers. It stacks up pretty high. . I think this speaks for itself….
  • LAMP stack is dead. In the two decades since its birth, there have been fundamental shifts in the web’s make-up of content, protocols, servers, and clients. Together, these mark three ages of the web:1991-1999: The HTML Age. The HTML Age was about documents, true to Tim Berners-Lee’s original vision of a “big, virtual documentation system in the sky.” The web was dominated by static, hand-coded files, which web clients crudely formatted (with defaults that offend even the mildest of typographiles). Static documents were served to static clients.2000-2009: The LAMP Age.The LAMP Age was about databases. Rather than documents, the dominant web stacks were LAMP or LAMP-like. Whether CGI, PHP, Ruby on Rails, or Django, the dominant pattern was populating an HTML template with database values. Content was dynamic server-side, but still static client-side.2010-??: The Javascript Age. The Javascript age is about event streams. Modern web pages are not pages, they are event-driven applications through which information moves. The core content vessel of the web — the document object model — still exists, but not as HTML markup. The DOM is an in-memory, efficiently-encoded data structure generated by Javascript.LAMP architectures are dead because few web applications want to ship full payloads of markup to the client in response to a small event; they want to update just a fragment of the Document Object Model, using Javascript. AJAX achieved this, but when your server-side LAMP templates are 10 percent HTML and 90 percent Javascript, it’s clear that you’re doing it wrong.To recognize this means shifting our view of the server from a document courier (HTML Age), or a template renderer (LAMP Age), to a function and data shipper. The principal role of the server is to ship an application to the client (Javascript), along with data (JSON), and let the client weave those into a DOM.The secondary role of the server is to listen in on a stream for events (a new edit, a message, or ticker change) and efficiently push responses back to clients.For both of these roles, node.js is an ideal serving architecture. Since we’re currying Javascript functions on the server-side, we ought to write in Javascript. We can shift computation from server to client with little impedance (for example, we no longer need to maintain two sets of our custom string formatting libraries).With regard to responding to event streams, node.js is ideal. Its asynchronous, non-blocking architecture means it’s incredibly fast. It uses HTTP 1.1, keeps its connections open, and a single server can handle thousands of open connections at once.Finally, it’s worth considering that events are simply packets of data, and the emerging lingua franca of data on the web is JSON. This is what client-side applications receive when a ticker moves, or a message arrives. This is, again, a native format for node.js.The Javascript age brings us closer to a web that is not a global digital library, but a global digital nervous system, whose implications we are only beginning to apprehend.
  • What&apos;s the issue with current server programs? Let&apos;s do the math. In languages like Java™ and PHP, each connection spawns a new thread that potentially has an accompanying 2 MB of memory with it. On a system that has 8 GB of RAM, that puts the theoretical maximum number of concurrent connections at about 4,000 users. As your client-base grew, if you wanted your web application to support more users, you had to add more and more servers. Of course, this adds to a business&apos;s server costs, traffic costs, labor costs, and more. Adding to those costs are the potential technical issues — a user can be using different servers for each request, so any shared resources have to be shared across all the servers. For all these reasons, the bottleneck in the entire web application architecture (including traffic throughput, processor speed, and memory speed) was the maximum number of concurrent connections a server could handle.
  • If you’re having trouble understanding what exactly that means, along with ‘blocking’ and ‘non-blocking’ I/O, it can be best explained with a favorite all-American pastime- fast-food. Traditionally, you have a thread-based system, but for any event-management, that’s going to end up being illogically slow. In a thread-based fast food joint, you get to the front of the line, (presumably waiting after a very long time) to give your order to the cashier and then wait right there until your order was cooked and given to you. The cashier would not be able to help the next person until you got your food and went on your way. Need to service more customers… just add more cashiers!Of course, we know that fast food restaurants don’t work that way. They are very much event-driven in that they try to make those cashiers as efficient as possible. As soon as you place your order, it’s sent off for someone to fulfill while the cashier is still taking your payment. When you are done paying, you have to step aside because the cashier is already looking to service the next customer. The key point is that you are not blocking the receiving of new orders.The “traditional” mode of web servers[1] has always been one of the thread-based model. You launch Apache or any other web server and it starts receiving connections. When it receives a connection, it holds that connection open until it has performed the request for the page or whatever other transaction was sent. If it make take a few microseconds to retrieve a page from disk or write results to a database, the web server is blocking on that input/output operation. (This is referred to as “blocking I/O“.) To scale this type of web server, you need to launch additional copies of the server (referred to as “thread-based” because each copy typically requires another operating system thread).In contrast, Node.js uses an event-driven model where the web server accepts the request, spins it off to be handled, and then goes on to service the next web request. When the original request is completed, it gets back in the processing queue and when it reaches the front of the queue the results are sent back (or whatever the next action is). This model is highly efficient and scalable because the web server is basically always accepting requests because it’s not waiting for any read or write operations. (This is referred to as “non-blocking I/O” or “event-driven I/O“.)
  • Yes, Node is a server program. However, the base Node product is definitely not like Apache or Tomcat. Those servers are basically ready-to-install server products and are ready to deploy apps instantly. You could be up and running with a server in a minute with these products. Node is definitely not this. Similar to how Apache can add a PHP module to allow developers to create dynamic web pages, and an SSL module for secure connections, Node has the concept of modules that can be added to the Node core as well. There are literally hundreds of modules to choose from with Node, and the community is quite active in producing, publishing, and updating dozens of modules a day. the modules you can use with Node greatly nhance the product, so much so, that it is unlikely that anyone would use Node without installing a few modules as well. That&apos;s how great the modules have become, to the point of becoming an essential part of the entire product. Additionally, Node feature the Node Package Module, which is a built-in way to install and manage the Node modules you are using. It automatically handles dependencies, so you can be assured that any module you want to install will install correctly with all its required pieces. It also serves as a way to publish your own modules to the Node community, should you choose to get involved and write your own module. Think of NPM as a way to easily expand the functionality of Node without worrying about breaking your Node installation. Again, if you choose to pursue Node further, the NPM is going to be a vital part of your Node solution.prepackaged code that performs a specific function.
  • Node.js ships with many &quot;core modules&quot; compiled into the binary such as the net module, providing an asynchronous network wrapper, and other fundamental modules including Path and File System, Buffer, Timers, and the more general Stream. Networking: The crux of the core of node.JS modules, these are what make it all link up Event Emitter: On node many objects can emit events. For example, a TCP server can emit a ‘connect’ event every time a client connects. Or a file stream request can emit a ‘data’ event. It’s a nice way of enforcing the decoupling of interfaces, a software design technique that improves the independence from specific interfaces, making your code more flexible.  Buffer: natively, JS isn’t so hot at handling binary, so node adds a native buffer implementation with a JS way of manipulating it as nodes standard data transportation measure. It’s great to have this module so you can create custom buffers that saves memory and makes your application run faster. Streams: The icing on the core module cake. = A stream is an abstract interface implemented by various objects in Node. For example a request to an HTTP server is a stream, as is stdout. Streams are readable, writable, or both. All streams are instances of EventEmitter.
  • Third-party modules can extend node.js or provide a level of abstraction, implementing various middleware for use in web-applications, such as popular frameworks connect and express. Although modules can be installed as simple files, they are usually installed using Node Package Manager (npm) which can assist in building, installing and updating modules with dependency-handling. Furthermore, modules that are not installed in Node&apos;s default module directory will require a relative path name to be found.There are some others: including database connection layers, templating engines, mail clients, and even entire frameworks connecting all of these things together. 
  • While there 4 or 5 in the module library so far, stylus has been getting the most praise and it’s authored by the most noteworthy of guys who also wrote express, connect, jade, and more . Stylus is “pythonic” aka indentation-based, as is CS. Whitespace is significant, so we substitute { and } with an indent, and an outdent  Expressive, dynamic, robust, something CSS never really was so it will go great with using all the latest with version 3! Stylus transparently supports a regular css-style syntax, meaning you do not need to use an alternative parser, or specify that a certain file is using a specific style. fantastic error reporting built in for syntax, parse, and evaluation errors, complete with stack traces, line numbers, and filenames. One of the most controversial things that people are yet to decide on in CSS3 is variables.  Some people say they are great with the rise of vendor specific prefixes, while others say that they move CSS to far into a programming language.  My personal take is that they are a necessary evil with vendor prefixes.  Stylus has made variables super simple by not requiring any @ signs or anything that will clutter up the code.  Simply write the name of the variable and it will be output into your CSS. Stylus incorporates conditionalsto provide control flow to a language which is otherwise static, providing conditional imports, mixins, functions, and more. FeaturesOptional colonsOptional semi-colonsOptional commasOptional bracesVariablesInterpolationMixinsArithmeticType coercionDynamic importingConditionalsIterationNested selectorsParent referencingVariable function callsLexical scopingBuilt-in functions (over 25)In-language functionsOptional compressionOptional image inliningStylus executableRobust error reportingSingle-line and multi-line commentsCSS literal for those tricky timesCharacter escapingTextMate bundleand more!
  • But the negative doesn’t matter because you can just write straight up JS in CS and the complier will ignore it by adding that note around itCs and Stylus are both PYTHONIC Just as node brings client and server side programming together, coffeescript makes it easier to write powerful and elegant JavaScript. Coffscript is JavaScript done rightBackground-JS flaunting flashy clothes that complies down to pure, non-fluffy JS Now we can safely say that any stigma of a gimped tool for juvenile interactions is dead and gone, and morphed into quite a powerhouse. The fact that it adheres to a pretty nifty, prototype based ideology doesn’t hurt it either. There is no doubt that JavaScript is indeed a critical language now and for the foreseeable future.JavaScript’s semi-colon infused, parentheses dependent, verbose syntax can get tedious. This is where CoffeeScript comes to the rescue CoffeeScript is essentially just a syntactic rewrite of JavaScript. The core language itself stays the same, with small semantic enhancements. The syntax is modified, modeled after Python and Ruby, just like Stylus was. Remember that the CoffeeScript compiler outputs clean JavaScript that not only follows best practices and is eminently readable but also passes JSLint. This means that you don’t have to worry about compatibility down the line. In the worst case scenario of this project dying, you can just pick up the pristine JS that CoffeeScript generates and move on with your code. You aren’t locked into this environment.We’ve already seen our fair share of this ideology. HAML is but a new way of writing HTML while SASS does the same for CSS. All of them clean up the structure and syntax of their languages making them more easier to work with and making our work get done easier.  
  • It&apos;s a little difficult to check for the existence of a variable in JavaScript. if (variable) ...comes close, but fails for zero, the empty string, and false. CoffeeScript&apos;s existential operator ?returns true unless a variable is null or undefined, which makes it analogous to Ruby&apos;s nil? It can also be used for safer conditional assignment than ||= provides, for cases where you may be handling numbers or strings.The accessor variant of the existential operator ?. can be used to soak up null references in a chain of properties. Use it instead of the dot accessor . in cases where the base value may benull or undefined. If all of the properties exist then you&apos;ll get the expected result, if the chain is broken, undefined is returned instead of the TypeError that would be raised otherwise.
  • JavaScript&apos;s prototypal inheritance has always been a bit of a brain-bender, with a whole family tree of libraries that provide a cleaner syntax for classical inheritance on top of JavaScript&apos;s prototypes: Base2, Prototype.js, JS.Class, etc. The libraries provide syntactic sugar, but the built-in inheritance would be completely usable if it weren&apos;t for a couple of small exceptions: it&apos;s awkward to call super (the prototype object&apos;s implementation of the current function), and it&apos;s awkward to correctly set the prototype chain.Instead of repetitively attaching functions to a prototype, CoffeeScript provides a basic classstructure that allows you to name your class, set the superclass, assign prototypal properties, and define the constructor, in a single assignable expression.Constructor functions are named, to better support helpful stack traces.
  • coffeemate is a web framework built on top of connect and specialized for writing web apps comfortably in coffeescript. It uses eco template engine by default for fullfillcoffeescript experience. But also using coffeekup or any other template engine is only a matter of few seconds.coffeemate&apos;s magic is hidden inside that, it is perfectly a singleton instance of connect framework&apos;s HTTPServer implementation. So hacking coffeemate is pretty easy and funny :)
  • Learn boost:LearnBoost’s free all-in-one solution allows teachers to manage their classroom by offering an amazing gradebook, software for managing and creating lesson plans, tracking attendance, maintaining schedules, integrating Google Apps including calendars, tagging of Common Core Standards, and so much more. Pakistan Survey by Development Seed, provides in-depth agency-specific analysis from regional experts with data from 1,000 interviews across 120 villages in all seven tribal agencies and mapping of 142 reported drone strikes in FATA through July 2010.Top Twitter Trends utilizes MongoDB, Socket.IO, jQuery and many other exciting libraries to bring you trending tweets in realtime.Markup.IO allows you to draw directly on any website, then share with others to share your thoughts.ClickDummy is a rapid mockup prototyping application for designers and is a massively multiplayer scrabble game initially created for the Node Knockout competition. 
  • -talk about the high speed train analogy
  • The question I hoped to answer tonight was “Just what is Node.js?” You should be able to explain in a few clear and concise sentences what Node.js is. If you are able to do that, you have a leg up on almost every other programmer out there. Many people I&apos;ve talked to about Node have been confused by what it does exactly. They are, understandably, in the Apache mindset — a server is an application that you drop your HTML files into and everything works. Since most programmers are used to Apache and what it does, the easiest way to describe Node is to compare it to Apache. Node is a program that can do anything Apache can do (with some modules), but is also able to do much more, by being an extend-able JavaScript platform that you can build from.You&apos;ve seen in this article how Node accomplishes its goals of providing highly-scalable servers. It uses an extremely fast JavaScript engine from Google, the V8 engine. It uses an Event-Driven design to keep code minimal and easy-to-read. All of these factors lead to Node&apos;s desired goal — it&apos;s relatively easy to write a massively-scalable solution.Just as important as understanding what Node is, it&apos;s also important to understand what it is not. Node is not simply a replacement for Apache that will instantly make your PHP web application more scalable. That couldn&apos;t be further from the truth. It&apos;s still early in Node&apos;s life, but it&apos;s growing extremely quickly, the community is very actively involved, there are a lot of good modules being created, and this growing product could be your best friend and main confidant, if you let it be.
  • Node.JS| Coffeescript Presentation

    1. 1.
    2. 2. The evening program<br />What is node.js?<br />Why should you care? Because it’s the best around…<br />How? (not even 10K can bring it down!) <br />Corporate America has already caught on, so should you! <br />Why JS ? Why now?<br />Blocking|non-blocking I/O AKA event-driven programming. What? <br />Google V8 JS Engine. VROOOOM VROOOM <br />Modules Modules Modules MODULES <br />Stylus = CSS like whoaaaa <br />Coffeescript = JS like whoaaa<br />Express<br />Examples<br />Pros|Cons <br />Check in b4 u check out <br />o/<br />
    3. 3. node.JS – A ready-set-code server <br />Changing the notion of server functionality <br />Built to handle tens of thousands (& counting) connections<br />SSJS atop Google’s open-source JS engine <br />Written in C/C++ <br />A PROBLEM SOLVER<br />
    4. 4. Oh wuddya look at that!<br />
    5. 5. And that!<br />
    6. 6. It’s…It’s…It’s…It’s…It’s…IT’S<br />It’s non-blocking (event-driven) <br />It’s scalable <br />It’s syntactically accessible <br />It’s rich with resources <br />It’s built upon a castle of code and machines (C++ and V8)<br />It’s totalllyyyyy popular <br />It’s about time <br />
    7. 7. Totallllyyy popular <br />
    8. 8. Told you! <br />
    9. 9. WHO’S USING IT? <br />
    10. 10. The Biggest Programming Party, +8 <br />It’s (1 of) the fastest-growing programming language(s) EVER<br />Vibrant communities promote faster development and adoption <br />More developers = more developments <br />More developers working on an open-source project = more synergystic developments <br />
    11. 11. Just Ryan in March 09’ <br />
    12. 12. Nov 09’ = thanksgitin’ <br />
    13. 13. Nov 10’ – Ryan’s made friends!<br />
    14. 14. Ry & co. on the Ryse <br />
    15. 15. Why JS & not something else?<br />So many people already use it <br />Anon functions. Local/global variables set very appropriate stage for event-driven programming <br /> It’s already in all of our applications <br />Reuse code between your browser & server implementations <br />The JS interpreters race (V8 WINNING) <br />
    16. 16. Google Chrome V8 JS engine <br />Written in C++ (+1) <br />Open-source<br />Fast property access <br />Specifically designed for fast execution of large JS apps <br /> No intermediate byte codes, no interpreter (Dynamic Machine Code Generation) JIT compliing<br />Efficient Garbage collection <br />
    17. 17. Whoa, Whiplash! <br />
    18. 18.
    19. 19. The Internet: A single slide history <br />91’-99: THE HTML AGE : static, hand-coded crudely designed document files served to static clients. <br />00’-09’: THE LAMP AGE: databases replaced documents, solution stacks saturated the market. <br />10’-x’: THE JS AGE: dynamic web-apps, interactive information garnishing media-rich foundations <br />
    20. 20. Really Though, Why? <br />“it doesn’t do anything that current technology can’t do…” <br />WRONG SIR WRONG! <br />“if you wanna node, you gotta write all your own code…”<br />WRONG SIR WRONG! <br />“it’s just another one of those darn kids doing something crazy. It’ll die out soon…” <br />WRONG SIR WRONG! <br />“it makes no sense to use for large businesses since it’s non-standardized, nor is it tried and true…” <br />RIGHT SIR NOW, WRONG SIR LATER!<br />“everything works just fine now, and changing things will just complicate everything for no reason…” <br />WRONG SIR WRONG!<br />
    21. 21. An event-driven request in 5 steps<br />request “/about.html” from your browser on a Node.js web server.<br />Server accepts request &calls a function to retrieve that file from disk.<br />While the server is waiting for the file to be retrieved, it services the next web request.<br />When the file is retrieved, there is a callback function that is inserted in the Node servers queue.<br />Node server executes that function (renders the “/about.html”) & sends it to your web browser.<br />
    22. 22. MODULE MADDNESS!<br />Boosts Productivity & Totally Inspires <br />“Write Less. Do More” –jQuery<br />Comes shipped with core modules <br />An endless library of 3rd party mechanisms of all kinds<br />NPM (node package managers) to ensure a smooth ride <br />
    23. 23. Some Cool Core Modules <br />Networking: net: create TCP server | client; http: create HTTP server or client <br />Event Emitter: gives objects the ability to emit events (duh) <br />Buffer: create buffers to transport binary data<br />Streams: abstract interface implemented by various objects <br />
    24. 24. 3rd Party Modules: the preview<br />face.Js : face-dectection in images w/OpenCV<br />Node-wkhtml: html to pdf or image format using the webkit rendering engine, and qt.<br />Node-boilerplate: takes html-boilerplate, express, connect and Socket.IO and organizes them into a ready to use website project.<br />Coffeekup = make EVERYTHING coffeescript<br />static file servers = Lightnode, nitrode, trailer (everyone’s favorite backend), node-paperboy<br />
    25. 25.
    26. 26. Stylus: The node.JS CSS ENGINE- wow! <br /> Expressive, dynamic, robust CSS framework, built for speed <br />Optional: (: , ; , { }, , ,) = totally clean <br />Expressive variables & built-in functions <br />Error-reporting <br />Arithmetic! <br />
    27. 27. body.profile #content section.profile section.markdown aside {<br /> width: 320px;<br /> float: left;<br /> margin-left: -320px;<br />}<br />body.profile #content section.profile section.markdown aside h2 {<br /> font: bold 13px DIN, "Helvetica Neue", Arial, Helvetica, sans-serif;<br /> line-height: 24px;<br /> text-transform: uppercase;<br /> -webkit-font-smoothing: antialiased;<br /> color: #555;<br /> letter-spacing: 1px;<br /> color: #ff006a;<br /> margin: 0 0 16px;<br />}<br />body.profile #content section.profile section.markdown aside ul {<br /> list-style: none;<br />body.profile #content section.profile section.markdown ul.process {<br /> margin-left: -320px;<br />}<br />body.profile #content section.profile section.markdown ul.process:after {<br /> display: block;<br /> clear: both;<br /> content: "";<br />}<br />body.profile #content section.profile section.markdown ul.process li {<br /> float: left;<br /> margin: 0 0 1px 1px;<br /> list-style: none;<br />}<br />body.profile #content section.profile section.markdown ul.process li p {<br /> padding: 16px;<br /> margin: 0;<br /> width: 127px;<br /> height: 127px;<br /> font: bold 13px DIN, "Helvetica Neue", Arial, Helvetica, sans-serif;<br /> line-height: 24px;<br /> text-transform: uppercase;<br /> -webkit-font-smoothing: antialiased;<br /> color: #555;<br /> letter-spacing: 1px;<br /> color: #ccc;<br /> transition: all 0.15s ease;<br /> -webkit-transition: all 0.15s ease;<br /> -moz-transition: all 0.15s ease;<br /> -o-transition: all 0.15s ease;<br />}<br />
    28. 28. COFFEESCRIPT- Javascript in a speedo <br />Speaks English <br />Pythonic Syntax <br />Complies to pure JS <br />Same exact functionality as JS<br />Makes hard things easier<br />
    29. 29. KEY + EXAMPLES <br />
    31. 31. ENGLISH!<br /> ===<br /> !==<br /> !<br /> &&<br /> ||<br /> true<br /> false<br /> this<br /> in<br /> n/a<br />is <br />isnt<br />not <br />and <br />Or <br />True, yes, on<br />False, no, off<br />@, this <br />Of <br />In<br />
    32. 32.
    33. 33. It’S JUST BEGUN-A-brewin’…!<br />
    34. 34. COFFEESCRIPT MODULES <br />Coffeekup: markup as CS<br />Coffeemate: framework for writing apps in CS<br />Unifies programming<br />Makes work even easier <br />
    35. 35.
    36. 36. Express: Pretty dope node web framework <br />node.JS “Hello World” server <br />Express “Hello World” server <br />
    37. 37. Express Applications <br />
    38. 38. The Final + & - minus of it all<br />Makes coding more intuitive (syntactically & technically)<br />Developers are passionately clinkering away on improvements all day, every day <br />Takes progressive strides in what many believe is the right direction <br />Haters gonna hate <br />Learning Curves <br />Doesn’t try to be compatible with pre-existing software<br />Updates make current projects liable to be incompatible with new releases <br />
    39. 39. Are We Done Yet? <br />Can you give a cocktail party version of what node.JSis? <br />Are you going to go home and check it out? <br />Are you convinced? <br />Are you envisioning a grand design with node as a backbone yet? <br />
    40. 40. BEFORE YOU GO…<br />Hey…I just wanna let you know I had a great time tonight and hope we could, ya know, maybe meetupagain maybe and build a scalable server or something, or we could just build a static web page, whatever, totally up to you. <br />