Slashdot Mirror


Node.js and MongoDB Turning JavaScript Into a Full-Stack Language

Nerval's Lobster writes "For all its warts and headaches, JavaScript has emerged as the lingua franca of the modern Web, arguably second in adoption only to HTML itself, which obviously is just a markup standard rather than a full-fledged programming language. It's effectively impossible to launch a sophisticated Web project without making extensive use of JavaScript and AJAX dynamic loading. That's precisely why recent projects that move JavaScript beyond its usual boring domain of defining in-browser interactivity are so interesting — because it's already dominant, and growing even more so. Writer and software developer Vijith Assar argues that Node.js and MongoDB are turning JavaScript into a full-stack language. 'In the grand scheme, Node and Mongo are still quite new; for the most part, ace JavaScript developers who can write brilliant code on both sides of the request transaction have yet to emerge,' he suggests. 'But if and when they do, the things they build could be jaw-dropping.'"

15 of 354 comments (clear)

  1. Citation Needed by casings · · Score: 5, Insightful

    In the grand scheme, Node and Mongo are still quite new; for the most part, ace JavaScript developers who can write brilliant code on both sides of the request transaction have yet to emerge, but if and when they do, the things they build could be jaw-dropping.

    Can any real developer explain why having a javascript backend would be any different to any other backend in such a way where something jaw-dropping could only be the result of the javascript backend?

    1. Re: Citation Needed by Lunix+Nutcase · · Score: 5, Insightful

      And that is "jaw dropping" how? You can already do that with several languages and nothing is remotely "jaw dropping" about it.

    2. Re: Citation Needed by sribe · · Score: 5, Informative

      Can any real developer explain why having a javascript backend would be any different to any other backend in such a way where something jaw-dropping could only be the result of the javascript backend?

      The quote that you referenced is pure hyperbole--in fact, it is bordering on bullshit. There's nothing a javascript backend can do that a Ruby, Python, Perl or whatever backend cannot. However, it sure would reduce cognitive load to not switch languages between browser and server ends. Personally, I've always liked Ruby (and Python before it) very much, and I like Ruby on Rails. But I'm watching node.js for this very reason--no matter how elegant RoR wraps up the process of sending dynamic javascript over to the browser for execution, it's still butt-ugly and an all-around pain to be switching between two languages, especially on such a small scale. It's not like when I switch from web dev one day (or preferably, week) to native client--sometimes it's Ruby for a minute then javascript for a minute then back to Ruby. Anybody who thinks that is not affecting their productivity is just not paying attention ;-)

    3. Re: Citation Needed by Spy+Handler · · Score: 4, Funny

      Having a javascript backend would allow you to create jaw-dropping UI such as cool sliding divs and flashing banners... on the server console! No more boring command line text.

    4. Re: Citation Needed by marsu_k · · Score: 4, Interesting

      Anecdotally (having worked with node.js for the past year or so), whenever I've needed to do something not available in the core libraries, there has been an npm for it, usually several. But - and this is a rather big but - their maturity can vary quite a bit. The biggest issue really is documentation, that can be incorrect or completely out of date. Yes, there always is the source, but that's hardly ideal.

      Having said that, in general I do like node.js. It takes some time getting used to and you have grasp Javascript well in order to use it efficiently, but if you're working with JSON data (we use CouchDB) it's quite a natural fit.

    5. Re: Citation Needed by kwerle · · Score: 4, Interesting

      I was speaking to a friend of mine the other day, who said "Don't you find it bizarre that Javascript has become the assembly language of the web?"

      And that's just it: I think javascript sucks, and I avoid it whenever possible. Instead I use CoffeeScript, which I find unobjectionable. Sure, it "compiles" into javascript - and I don't much care.

      I pointed out that I never really learned assembly when I was cutting my teeth (decades ago), and so I really didn't care what was down there. It's kind of nice that I know enough Javascript to debug tricky issues when the need arrises.

      I thought that coding in assembly sucked, too - still do. The higher the language, the more I tend to like it. Besides CoffeeScript, I'm keeping an eye on Dart.

      So, yeah, it's bizarre that javascript has become the assembly of the web world. But it runs all over the place because it runs all over the place. Whatever. As long as there's something better to write code in than javascript, it doesn't bother me...

    6. Re: Citation Needed by LordThyGod · · Score: 5, Insightful

      But if you're going to pick a single language to be used by everyone for all purposes, then why pick something kludgy like JavaScript?

      Because there isn't one? How many languages run in all web browsers, have a native database implementation that scales, and a server side language.

    7. Re: Citation Needed by hackula · · Score: 5, Insightful

      Totally BS. I use node.js in every production product, so do not get me wrong, I love it. However, node happening to have the same language as the front end is an outrageously bad argument for it. Also, "ace JavaScript developers who can write brilliant code on both sides of the request transaction have yet to emerge" is dead wrong. There are plenty of people using node.js as a production environment, and many of them are amazingly talented at front end development as well... just like RoR, PHP, .Net, Java, or any other server side platform. The strength of node, or any other language, is in the community that forms around it. .Net and Java would be terrible if they did not have a community of people building RAD controls, PDF manipulation libraries, and M$ integration libraries (common needs for the business community). RoR would suck if it was not for the huge community of people building start up web apps with similar infrastructure and design requirements (heroku sprang up out of this culture, I would argue). Node's community is still forming, but I would say it has a strong commitment to performance, high concurrency, and an embrace of a unix-y module system (see npm) that is clearly a reaction to giant frameworks like Rails and ASP.Net. It is not for everyone, and I recommend people all the time to check out Rails instead if it fits their needs better. For me though, node has been awesome over the past few years, and works for me and my company.

  2. Javascript is now web scale by Lunix+Nutcase · · Score: 4, Insightful

    No, it's fanboy hyperbole.

  3. "ace JavaScript developers who can write" by tk77 · · Score: 5, Funny

    ace JavaScript developers who can write brilliant code

    There are so many things wrong with that statement, my brain hurts trying to figure out where to begin

  4. Re:Javascript anywhere but the browser? No by godrik · · Score: 4, Funny

    What are you talking about? We are talking about Javascript!! The new messiah of programming languages! Everything will be implemented in javascript. Even the linux kernel is being reimplemented in this highly productive language! Javascript saves baby dolphin and prevent dictators to take over. How can you not love it?

  5. 2-factor, Suggest, Instant, Gmail, Docs, YouTube by tepples · · Score: 4, Informative

    I couldn't even log into my credit union or broker without it!

    Financial web applications probably use JavaScript to store a cookie that verifies that this browser has previously been used to access this account. This makes the browser the second factor in a two-factor authentication system.

    And all it does is make pages more cluttered

    Not always. JavaScript lets a web page hide a particular element until the user expresses interest in viewing it by clicking it.

    harder to use

    With JavaScript, a user can (for instance) click to expand help for a particular field of a form without having to navigate away from the form.

    longer to load

    Without JavaScript, the only way to expand or collapse an element in a document, such as an element in a tree or an aside that has been hidden, is to follow a link or submit a form that results in sending the whole page back. This whole page takes long to load.

    takes up bandwidth

    Updating only what has changed on a page takes up less bandwidth than having to send the whole page all over again.

    Google. No scripts there but immensely valuable.

    If Google Search doesn't use JavaScript, how do the Suggest (drop-down completion box below text input) and Instant (replacement when the user pauses typing) features of Google Search work? Besides, Google also produces Gmail, Google Docs, and YouTube, which use plenty of JavaScript.

  6. Re:No, node.js and mongodb are cancer by uncle+brad · · Score: 5, Interesting

    He was trying to say that its only twice as slow.

  7. Re:Stop bashing JavaScript - and stop evangelising by sfcat · · Score: 4, Informative

    JavaScript is a shit language: Fuck off.

    Wow, good argument. BTW, my office mate was at Netscape when Javascript was created. The author of Javascript has since apologized for creating Javascript. In his defense, it was only ever intended to run one line bits of logic inside of a web page. Ideas like functions actually had to be added later as the idea of using Javascript for a general purpose language came after the language was designed, not before. See how this leads to problems?

    Javascript isn't and shouldn't be used as a general purpose language, EVER! It has uses but very few in general and they probably all have to do with browsers and DOMs.

    JavaScript is not strongly-typed: Since when did strongly-typed languages become "better"?

    Um, since math has existed? Compilers double as automated code error checkers. Or maybe you like checking your code's syntax by hand?

    JavaScript is insecure: You're doing it wrong.

    Javascript forces clients to execute general logic. This is a security issue no matter what. I'm sure you have some solution to this issue, but I assure you that there are ways around your solution (and anyone else's solution).

    Node.js is single-threaded: OK, were you planning on serving clients with a single server instance/process?

    Javascript is single threaded, this is OK for writing web apps, sometimes. But not always and its a huge hole in a general purpose language.

    A single language client- and server-side offers little to no benefits: Yeah, you're right. Why would I want to a single test suite for my client- and server-side code? Why would I want to (securely) share model definitions between the client- and server-side? Why would I want to optimise one code-base instead of two? Why would I want to debug one language instead of two?

    You finally make a good point. +1 for you.

    MongoDB is for people who can't/won't learn SQL/the relational model: I'll admit that SQL is not my area of expertise, but my naive understanding is this: in SQL databases, you normalise your data by default until you hit performance issues. In NoSQL databases, you denormalise it by default. The decision on which one to use should depend entirely on the data you want to store.

    Take it from me, you know NOTHING about data persistence no matter how much you think you do. Relational Algebra is the basic math governing manipulating, querying and storing data as tuples. It governs MongoDB (and other NoSQL tools) too, just that the authors of those systems basically lopped off all the hard parts of the relational algebra and implemented just the easy bits. And they did those parts quite poorly when compared to traditional RDBMSes.

    NoSQL was an attempt to re-invent a very complex wheel that 1) already worked, and 2) the often didn't let you do things that were bad ideas (even if you didn't realize they were bad ideas at the time). SQL isn't perfect, but more people know it than HTML and Javascript combined. And the systems that implement SQL have reputations (and a history) of not losing data (well, as long as the hardware works) and allowing very large datasets to be queried. And before someone says something dumb like "Web Scale", Sharded DBs store and query some very large datasets. Only when you have datasets the size of google's do you have to implement your own. And they made BigTable so fast by not implementing things that DBs need but they didn't (like data consistency and joins). It might be nice for a RDBMS to allow you to choose to not use table locks or do other things to make these trade-offs. But RDBMSes evolved in a world where throwing hardware at problems was always a valid strategy and it probably still is and will be into the foreseeabl

    --
    "Those that start by burning books, will end by burning men."
  8. Re:Please top hijacking Javascript _ by spage · · Score: 4, Insightful

    No, let's keep advancing JavaScript.

    Let's compare
    * find web site promoting some application
    * go to download link
    * find it's not available for Mac/Linux/your phone/Windows XP
    * or it is, but you need to download a different Qt/GTK/SDL/DotNet/JDK runtime
    * but that's not available for your machine, or it's 32-bit not 64-bit
    * now download, save, run installer, wait for virus checker
    * now finally run the bloody thing
    * (Windows-only) wonder why there's another task running, it's the %^$#! Check for updates service
    * A week later. Yay, there's an update. Repeat all these steps.

    vs.
    * find web site promoting some application
    * click link
    * you're running today's build. It just works.

    You have to be a clueless, blind, future-fearing Luddite, yet simultaneously have the skills to master the download-find-install-run-maintain loop to find the former preferable. The 0.1% of the world population who fit that niche all hang out on Slashdot and vote up "bloated browser" comments.

    --
    =S