Saturday, October 26, 2013
braindump of Node.JS as hosted by Mike O'Brien (spelling?) at Pablo's Fiesta in room 107
Gabe: what is the most compelling reason to run Node at server? Guy in black hat: you can use JavaScript at both frontend and backend. Mike: package manager has just about anything you can imagine. Gabe: how is it if you have 100,ooo+ lines of JavaScript. Worries about bug hunting in a dynamic language. Guy in black hat feels that Ruby has already been proven as a good front end language and doesn't feel dynamic must be a deal breaker. Mike agrees there are a lot of benefits to using a strongly typed language. guy in black: compiler can be a wonderful thing but no matter what you will write JavaScript in our business and then you might as well extend into writing JavaScript that isn't bad. Mike: play around with in a small case to see how it works. Node is a single thread but you have libraries written in C or C++ which do different things it can reach out to. There is an event loop that goes around and around. You don't want anything to stop the event loop do you need to use good judgement as to what you should use node for. Something synchronous is not a good example. Anything that is blocking will be done asynchronously. One code hitting an event loop firing off threads is node. Node can catch an input and hand it off to another library on a different thread, but largely there are not threads. Gage: You would expect the modules to do everything one thread? Guy in black hat: you'd call a module asynchronously and eventually call back into another loop. He suspects the breakaway and back here happens on different thread, but the main looping thread is the consistent one thread. Mike: you can run node on almost any operating system. Guy in black hat: it uses the V8 engine. Guy in purple sweater: the asynchronous happenings are not long lived. The do their thing and then reconcile with main thread. var http = require("http"), url = require("url"); http.createServer(function(req, res) { res.writeHead(200, { .... is an example of spinning up a server. Mike feels setting up a server is easier if you use a library like Express. Mike: everything you do has to quick. If you are going to do something that takes a while you are going to kill the server and a different technology where one may have threads at the server will likely be superior. Mike: make a connection, make a map reduce call, send event back to client, close the connection. Express cuts down on the amount of boilerplate code one has to write. Express handle a lot of URL stuff. Black hat: the first thing I'd do is write MVC-data binders for requests. The blink tag doesn't work anymore. Guy in glasses: Express can also handle rendering views. You can set up Express and tell it where to look for templates. Black hat: payoff in Node is promising. Wants to know how all the parts word. Purple sweater: RESTful API requests would happen at the client outside of Node code. Guy in black hat is explaining model binding in MVC. Guy in purple sweater: If you are using Mongo you could pass in JSON object directly to be a Mongo object. Gabe: don't use a hammer for screws. JavaScript is not ASP.NET MVC. Guy in black hat asks about frameworks on top of express. Guy in green shirt mentions Sails which is like "Rails" guy in black shirt: if you do SQL you may use some kind of dynamic SQL. npm is the node package manager. Gabe: all the cool guys are on NodeJS, what happened to Ruby? How many of us still develop in Ruby? No one put their hand up. Tessel is a board that will allow you to run JavaScript at it. Black hat: you have so much rope to hang yourself by in JavaScript. Second guy in glasses: Node.JS is very big in streams. Guy in black hat: is the code you write in node akin to the clientside stuff? Second guy in glasses mentions AMD/require is used in Node. You can do jQuery on the server which is pretty cool. You can use it for screen scraping. Make a request, get it back, crawl it with JavaScript. Podcast called NodeUp is good. There are good walk through for stream (stream of events) stuff which emits and accepts events. you can make five or six different string objects and "pipe to them" ... He has seen request.body handed to a JSON parser stream where it is read in chunks. Hand chunks into multiplier or persister to do processing on it. Black hat: in a fluent interface in C# you may dot (.) to different things but it's not timed based. Wonders if there is a security story around Node authentication. Second guy in glasses: There can be middleware which "turtles down" objects passed through it for security validation to Node. Jade and Passport are middleware examples. All of his Jade templates may be requested directly. Guy in black hat: Seems like a wide open environment. Is there any documentation on how to get started? Second guy in glasses: Groupon has moved to Node. Groupon showed off a EngineX app with Plural plugins at a talk he saw. Guy in black hat thinks LinkedIn is on node. Nolan Egly says: Thank you ...and we are done.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment