You Might Want To Start Taking JavaScript Seriously

19 commentsWritten on June 2nd, 2011 by
Categories: JavaScript, Opinions

A very large group of developers still thinks of JavaScript as a joke. I used to be one of them, as you might have been, or perhaps still are. They have such negative views on JavaScript: about how horrible it is in general, that it is slow, that it's just a toy language, that it's not even object oriented (which shows you how little they know of it). But the reality of the matter is that JavaScript is increasingly being used for more and more serious things. You can do wonderful and truly powerful stuff with it to enrich your users' client-side experience of your web applications. It's also becoming increasingly popular on the server-side with frameworks like node.js, known for its high performance and throughput, not exactly attributes you'd expect to be linked to a framework written in a supposedly slow language. And even Microsoft appears to be promoting JavaScript ever increasingly with their renewed focus on IE and now even as one of the preferred ways of developing applications for Windows 8's new UI.

To those of you who dislike JavaScript: it's not going to go anywhere and in fact, it seems like it's only going to get bigger and bigger over the next couple of years since it appears to be one of the few languages that practically every major player in the industry can benefit from in a variety of ways. All browser vendors are continuously improving the performance of their JavaScript engines. Plenty of projects/startups/companies have shown that JavaScript can indeed be the right tool for many different jobs. Simply put: there's a lot of innovation going around in the JavaScript community and there's no reason to believe it'll slow down anytime soon.

My advice: start taking it seriously. Try to actually learn the language and experiment with it. I can definitely recommend reading JavaScript: The Good Parts and JavaScript Patterns. There are indeed plenty of bad parts in JavaScript, but if you stick to the good parts and learn and understand the patterns that enable you to use it very effectively, you might end up pretty surprised at how nice it can be. Even if you don't appreciate how nice it is, you'll at least have learned a language that is becoming increasingly relevant which means you have one more skill that will be usable in many different situations, and probably for a long time to come.

  • http://lucisferre.net Chris Nicola

    The bright side of javascript becoming such a ubiquitous language is that it is extremely powerful and flexible.  However the downside is that it isn’t nearly as clear, concise or expressive as some other languages, which is unfortunate if everyone is going to be using it so frequently.  

    Fortunately there are things like coffeescript, someone even wrote a C#/XNA -> JS compiler for creating JS games.  Though I’m not sure I’d necessarily agree C# > JS as a language.

    • http://www.facebook.com/justin.m.chase Justin Chase

      Check out CoffeeScript if you’re still not sure. It’s basically javascript but is very clear, concise and expressive and compiles into js.

    • picos

      That is very relative. As a language with the typical bracket, parenthesis, semicolon, etc, it ressembles C, C++, java, perl, etc. So it I wouldn’t really call it ackward. More like ‘classic sintax’, which in practice means that it’s familiar to a huge amount of developers.

      As for the ackwardness, I do find it’s scope resolution and prototype based approach to OO to be more intuitive than those of C++, java, etc. I guess it’s a matter of getting used to it…?

  • http://bvanderveen.com Benjamin van der Veen

    Hate to say it, but you’re right, the writing is on the wall. JavaScript is here to stay, and it’s going to be more ubiquitous.

    I’m not a big fan of the JavaScript-the-language, and a lot programmers I respect have serious beef with it. It’s no wonder you see a lot of smart people building tools which cross-compile to JavaScript or otherwise generate JavaScript code from better abstractions. JavaScript is the new assembly?

    • http://mikescode.info Mike Griffith

      You might want to take a look at some of the new libraries like jquery or node.js.  I think a lot of the problems people had with javascript was that they were trying to use it like java or c# instead of getting a “true” feel for the language.  At least that was my issue with anyway, once I started realizing it was not only an object oriented but functional language it clicked.  

      • http://bvanderveen.com Benjamin van der Veen

        I’m pretty very familiar with both jQuery and Node. jQuery is a good tool for doing what it does—manipulating the browser DOM (which itself I am not a fan of, but that’s a whole other story ;) . But it doesn’t save you from JS-related awkwardness. 

        Node is also an excellent project, and the lower-level native bits (http-parser, libuv, etc.) are very nice, and Ryan Dahl is absolutely killing it. The everything-is-a-callback programming model makes sense from an architectural standpoint, but it’s rather annoying to use constantly. JavaScript’s lack of coroutines/generators really hurts here—you either have a deeply-nested anonymous callback structure, or your logic is spread across a ton of named functions. A smarter compiler can make this pain go away. See: C# 5 async/await and F# Async.It’s very true that JavaScript works better as a functional language. Unfortunately, many JavaScript programmers don’t really know what functional programming means and aren’t sufficiently disciplined to practice it. And even if you are a rock star, you have to keep on your toes to avoid nasty bits, especially when working with third-party libraries of varying quality. I realize that’s not actually an argument against the language itself, but the community and ecosystem of libraries are an important consideration. So my question is, why not build a better abstraction? Rather than dancing around the quirks of JS and prodding it into being functional, let’s just use a functional language. Google a project called Emscripten. It’s an LLVM backend for JavaScript. Wouldn’t it be great if you could write Node apps in Haskell? Probably wouldn’t be too hard to put something like that together.

        • David De Vloo

          About the annoying callback stuff,
          Have you tried Reactive Extensions (rx) for js?

  • Anonymous

    You may also want to add  @__DavidFlanagan:twitter  ”JavaScript: The Definitive Guide” to that list as many JS illuminati’s consider it to be the JavaScript Bible.
    Here’s a recent review of it on SlashDot: http://books.slashdot.org/story/11/06/02/1511219/

  • Slo

    JavaScript is the ugly duckling among programming languages. It takes time to embrace it and discover its beauty. I’ve done a lot of code in it and it is definitely one of my favorite languages. It is very powerful and expressive in my opinion and sometimes I miss that when going back to program stuff in C#. JavaScript:The Good Parts opened my eyes and I had many moments like “if I only had read this book before”.  Great post

  • http://www.facebook.com/justin.m.chase Justin Chase

    exactly.

  • Pingback: The Morning Brew - Chris Alcock » The Morning Brew #865

  • http://twitter.com/Jer0enH Jer0enH

    The unfortunate thing with javascript is that the language and tooling are not very helpful in leading programmers into the pit of success. I fully agree that js is a powerful language with some very interesting concepts baked in (and some rather unfortunate choices as well). But having had to clean up several rather big projects that were mainly javascript-based, I’ve had my share of “ugly javascript”. Now bad programmers write bad code in any language you give them, but js written in a non-js is… painful to say the least… 

    • http://twitter.com/b_d_m BDM

      This is very true!

      Davy makes a good point in his post. Recently I really started to enjoy the power of JQuery. When used wisely, this is obviously the future. But we always have to be careful to take the right path;

      A while ago, I was attending a certain technical event where one of the speakers opened his ‘codebase’ (read: one 1000 LOC+ giant pile of unmaintainable dirt .js file full of bugs). A shiver went down my spine, but no one in the room flinched. Because the result looked cool on the screen, right?

      That’s exactly what I’m afraid of: that the fanciness will make people forget about all the best practices and great tools we have, and enforce a ‘just hack something together and FTP it to the internetz’ mentality…

      Also, the old saying about hammers and nails applies: JS is just one of the tools in your toolbox, don’t overdo it!

  • Guest

    Yes, javascript ain’t going anywhere.

    The same goes for silverlight, wpf, .net, c++,…

    I’m amazed how people can be sucked into such bias and delusional thinking.  Microsoft is introducing great support for HTML5 and javascript, yes.  They are not (repeat: NOT) doing that at the cost of any other windows developing technology. 

    Claiming that is the case would be similar to claiming that .NET was coming to kill C++.
    It’s ridiculous.

    It’s pretty obvious why msft is going for full HTML5 support…  It’s to get all those developers on rival platforms to take what they allready know and have them develop for windows 8 without the need to learn XAML and .NET. 

    If you seriously think that these guys are about to abandon .NET, silverlight, wpf,… then you are delusional.

    • Jj

      If you seriously think they *won’t*, then you are delusional (at least in the case of silverlight)

    • http://davybrion.com Davy Brion

      once again (since you’ve made the statement in a comment to another post as well): i never said anything about abandoning .NET

      read the post again: it’s about how JavaScript is becoming increasingly relevant in multiple areas and that it’s definitely worth learning properly… you make it sound as if i’m pretending that JavaScript will be the one true language for all purposes.  It’s not, and i never said it was.  

  • Mohsin Hijazee

    The very to the point book on the subject is: Object Oriented JavaScript

  • Pingback: planetgeek.ch » The Future smells like JavaScript

  • Pingback: The future smells like JavaScript | FreeShareHere