4 ms·
The JavaScript language isn't what's nice. What's nice is using one programming language to write an HTTP server, your server application, server templates, cl
by dstein 16y ago
The JavaScript language isn't what's nice. What's nice is using one programming language to write an HTTP server, your server application, server templates, client-side application, client-side templates, communication code, database code, and be able to share your libraries and models between all contexts simultaneously. You fix one bug in one place, and you've fixed the bug in 7 or 8 different contexts immediately. In other words, your productivity skyrockets.
- lwat 16y agoMaybe I just need to see it to understand it. Is there a non-trivial app on github or somewhere I can look at? One that shows the strong side of Node.js?
- catch23 16y agoThere are great non-blocking IO examples out there which are pretty easy to find (look at any database, file system, or networking library), but I think jsdom is a rather unique library that is hard to find in other languages: https://github.com/tmpvar/jsdom https://github.com/tmpvar/jsdom jsdom implements DOM level 2 so you could actually mimic the javascript run in webpages (ie it would actually properly evaluate document.write() embedded in script tags). Web page scraping libraries in other languages won't have this feature easily because other languages will need to include a javascript interpreter along with their DOM emulator. I believe there's a java library out there that makes use of rhino to do this (htmlunit) but it took them quite some time to get there (several years). Most of the hard work in jsdom was implemented in a few months.
- deleted 16y ago[deleted]
- r00fus 16y agoNot to mention, JavaScript unlike many other server-side languages, supports closures. It's quite an advanced language, once you get used to it's (many) peccadilloes.
- Klonoar 16y agoYou know, I'll just throw this out there: as someone who's written a lot of code with Node backing it, I've run into maybe one scenario where I've brought client and server side logic together. They are two separate models, and will most likely remain as such for the foreseeable future. While I can only speak for myself, I'd advocate using it because the language is indeed nice, and much more flexible overall than some of the alternatives. On top of that, it's got several large companies with a vested interest in its development, which is far more than can be said for some of its competition. Really, the point I'd like to counter here is this: your productivity does not skyrocket, and it's not necessarily the reason to want to use JS server side. For example, the JS syntax works incredibly well for event based programming, and is largely tried and true with its use client side. That's a reason to want JS on the server, and I really wish people would quit throwing around the reusability claim like they do.
- travisglines 16y agoI really just enjoy not having to change languages. Whenever I want to do some basic syntactic stuff like substring for example, its the same everywhere. That alone makes it enough for me without its other benefits.