6 ms·
Introduction to Node.js with Ryan Dahl
- discordance 16y agowow, JS and children's literature. Truly a master.
- jordanmessina 16y agoIs it just me or does it seem like Node.js is taking off like wildfire? I can't seem to wrap my head around it because there are alternatives that have been around longer and are more mature. Is it the excitement of building on top of Google's v8 engine, or the incredible ease of use (I've seen about 15 show HN: Node.js chat server in ____ lines of code), or what? I'm not bashing node at all, I actually just started getting into it myself and I'm _really_ enjoying it. But within the past 6 months I feel like I can't go a day without hearing about it somewhere.
- asolove 16y agoI think there is an interesting discrepancy between Node's sweet spot and the people who use it shallowly. If you read Ryan's short history of where it came from, Node came from writing systems code in C where he had to deal with network or async events and finding that he was writing the same code repetitively. So you can think of Node.js as essentially the interpreter pattern for systems programming: use a higher-level language to specify what you want done, where the real heavy lifting is going on in a faster, lower level language. Now the people who get excited about Node on HN seem to see it as a faster, future replacement for Rails (a web development framework), which it might become, but really isn't. It just doesn't have the abstractions you would want to build a well-connected stack with router, controllers, ORM, etc. You end up typing all the glue yourself, and so much of it ends up being confusing if you write it all async. A more appropriate use of node is to break down monolithic Rails-style apps into very small, distributed services, where the data model itself is possibly not even written in Node, but where Node is doing routing to them. So think of Node as a tool for writing network system programs in proper Unix style as small, orthoganal, cooperative tools.
- grep 16y agoCan you give a real-world example of when one should use Node with a web framework such as Rails?
- asolove 16y agoA lot of large scale web apps use something like Node or message queueing along with Rails in an event-oriented architecture. An API request comes in, routes through a queue somewhere to get committed to a data store and also put in a cache. Then a web request comes in, Rails grabs data from the cache and then renders it with all of the Rails goodness for html generation, restful routing, etc.
- jordanmessina 16y agoI think you're right. Many people are treating Node.js like Tornado (http://www.tornadoweb.org/ http://www.tornadoweb.org/) and that's not really its intended purpose. It's hard to make requests in a webapp completely async anyway. As soon as you get database transactions involved you're screwed. I fear that too many people hear "it scales" and just jump on board without really understanding the context in which someone makes the claim.
- sausagefeet 16y ago> As soon as you get database transactions involved you're screwed This isn't true. If your DB has an async API, just wrap that up, otherwise you're limited to pushing queries to a query-thread-pool to keep the rest of your app async or implement your DB's protocol in whatever framework you're using. Twisted has native DB drivers + the ability to push to a thread pool if you're dealing with a legacy API.
- jordanmessina 16y agoI had second thoughts about saying that as soon as I hit reply. You're completely right. I should have said things get harder, and if you don't understand what you're doing to start then you're screwed and you don't even know it.
- jrockway 16y agoIt's new. People are tired of Ruby, Python, and Perl, which have all had async IO forever, but are old. A lot of people have spent a lot of time writing shitty software in those languages, because they were new to programming when they started. The mental image of the failures stick around for a while. Switching to a new language means you have never written any bad software in that language, and that's exciting. Javascript has the additional allure of running the same code on the client as on the server, which can be nice. And, node is pretty fast.
- th0ma5 16y agoTo me the Node.JS articles are becoming like Erlang as been, something that gets submitted to the site over and over again. Let me know when there's an extensive of a library like Java or Python :D I do like the concept of JavaScript everywhere. For instance, the porting of Toxiclibs to Processing.js is simply astounding.
- dualogy 16y agoThis extensive library exists... as millions of separate JS pieces and snippets scattered around the web, and hundreds of (often fairly buggy) node-xyz modules on GitHub. Sure, it may be slightly less convenient than a standardized, readily packaged out-of-box library and it doesn't have 10 years of testing and refining under its belt yet. But it's there. Some like it raw and rough!
- DTrejo 16y agoComplete searchable list of modules: http://search.npmjs.org/ http://search.npmjs.org/ Partial list: https://github.com/joyent/node/wiki/modules https://github.com/joyent/node/wiki/modules All easily installable via npm install express and in yourscript.js: require('express') Edit: Isaac Schlueter is currently working on getting tests of the modules to show up in search.npmjs.org (to see which modules are good).
- pjscott 16y agoIt's surprisingly liberating to work with a software ecosystem like that. I thought it would just be frustrating, but it's actually fun. The easy forking of small, simple-to-hack, almost-adequate libraries on GitHub really, really helps.
- kmccarth 16y agoDahl is the man. He is super direct, honest and funny in this interview I did with him a few months back: http://bostinnovation.com/2011/01/31/node-js-interview-4-questions-with-creator-ryan-dahl/ http://bostinnovation.com/2011/01/31/node-js-interview-4-que...
- joshbaptiste 16y agoNode.js is especially interesting because it can be suited to a person like me (with a system administration background) to learn and use Javascript. Most system admins I know don't usually have a need or care to learn JS under the DOM, now that we can create network system utilities using JS with ease it is an attractive alternative to Python/Twisted for some of my projects.