Should I learn Javascript ?

October 11th, 2008 at 11:38 am

It’s some time now that I’m wondering whether I should spend the time required to get acquainted with Javascript. So, this post is a pseudo-random dump of arguments for and against this idea.

For: I’ll be able to tweak my blog’s various plugins that use Javascript. Most of them do, and when I want to customize them to my needs, I often find myself stumped because of my almost complete lack of understanding of what’s going on. It’s not the language itself (which is simple), but rather the whole DOM / AJAX / events idea that I simply have to learn about.

Against: As the argument above hints, to learn JS is not just to learn the language. The language is C-like and relatively simple, it seems. The problem is with all the mountain of frameworks, concepts and libraries that must be learned. To be really good in JS, one has to understand DOM, events, AJAX, connection with server-side code (PHP), common libraries (JQuery, Prototype), CSS and much, much more. Oh, and don’t get me started on learning all the quircks of the various browsers, all of which seem to understand JS a bit differently.

Stevey says here that application programming is often harder than systems programming. Here’s a more detailed discussion of the topic. I agree. The problem is – you have to learn so much frameworks and libraries to be proficient in something, that the application level starts looking hard.

For: But JS is really cool! It is, really. Recently I realized that some of the applications I’m writing at home would be most usable as web applications. But for that, one has to construct a usable front-end in the browser, and for this knowledge of JS is required. JS these days is the canonical way to build in-browser “GUIs” to web applications, and knowing it is essential for constructing usable tools.

Against: I’m usually trying to direct my learning efforts to directions that would benefit my work. But JS has absolutely nothing to do with what I do at work (the technical aspects of which are either FPGA coding in VHDL, low-level C for micro-controllers or Python scripts for everything PC-based).

Against: I know myself. I can’t learn something just a little. If I start, I’ll invest a lot of time into this. I’ll learn the language itself, the browser DOM model, AJAX, connection to server side scripting, debugging, compression, some of the popular libraries like JQuery. It will take a long time, and I have to think what other spare-time hacking activities will get less attention.

Related posts:

  1. The server-side Javascript meme
  2. A simple canvas-based Javascript game, with a Django back-end
  3. Finding out the mouse click position on a canvas with Javascript
  4. C -> Parrot compiler

11 Responses to “Should I learn Javascript ?”

  1. fantasybeiNo Gravatar Says:

    it seems your job have little relationship with web app? so, maybe you can learn it when you need it, just a dynamic language, uah?

  2. x5315No Gravatar Says:

    Javascript is good.

    You just have to learn how to use it properly. Don’t follow tutorials or code snippets off the net. Chances are that 95% of them are poor quality.

  3. Valentin JacqueminNo Gravatar Says:

    “Recently I realized that some of the applications I’m writing at home would be most usable as web applications. But for that, one has to construct a usable front-end in the browser, and for this knowledge of JS is required.”

    I don’t agree with this. It’s clearly possible to create beautiful webapps without any knowledge of JS. For example, the flex framework let you build professional webapps without any JS code (e.g. https://buzzword.acrobat.com/#o).

  4. Ted HenryNo Gravatar Says:

    After your in-depth study of SICP, you may find JavaScript lacking some horsepower as JavaScript is close enough to Scheme that you can almost taste it but you can’t have it. JavaScript is good but it isn’t Scheme.

    Learning the browsers is way more time consuming than learning the language. Feature detection and progressive enhancements is the most interesting and difficult topic of building browser apps. It is black art which means a lot of hunting for obscure bits of info and techniques.

    In general, the code in libraries like Prototype.js and jQuery is not high quality. They are medium to low quality and only suitable for use in a few of the most modern browsers under certain circumstances. Reading libraries like this is a good way to start but almost surely you will want to write your own libraries. This is very time consuming.

    I struggle to resist the temptation to implement my own programming language daily. If you can live with your blog the way it is, you’ll have a lot more spare time ;-)

  5. Alex MartelliNo Gravatar Says:

    I think learning Javascript is a good idea — I recommend O’Reilly’s “Javascript: the good parts”, a _very thin_ book (no, really!) to identify the parts of the language that should be avoided like the plague (but *DON’T* go modifying builtins as that book’s author does…!!!).

    I agree with Ted Henry about the quality of Prototype and jQuery, which is why I strongly recommend Dojo, a *very Pythonic* framework that has pretty high quality throughout — even at the most basic level, you get functions resembling Python’s map and filter, ones that work like functools.partial or like method bindings in Python, Deferred for async work (like in Twisted), a good module system — on top on that, there are good abstractions over Ajax, Gears, &c, and a widget-based GUI framework which looks decent (but I haven’t done much with the latter). Again, ORA’s “Definitive Guide” book on Dojo is quite good.

    For debugging, you’ll want Firefox, with Firebug and Yslow add-ons, and no doubt arrangements as close to that as you can get for any other browser you care about (if any;-).

    Alex

  6. elibenNo Gravatar Says:

    Thanks for all the interesting suggestions. Right now I’ve backed off the idea because I don’t have things to tweak in the blog. But I’m sure I’ll come back thinking about this quite soon, and I will take these things into consideration.

  7. Lateef JacksonNo Gravatar Says:

    I wrote a blog post a while back about this:
    (http://blog.hackingthought.com/2008/08/javascript-is-lingua-franca.html) and it sound like you are not doing much web programming. If you do need to jump into web space then I think it is almost a required language. With all the integrated libraries Javascript can be the only language you need to know for web programming skipping all the backend frameworks and just using some AJAX Storage API.

  8. abelNo Gravatar Says:

    Hi Eli…

    The release of Google chrome may signal browser wars, but it seems to me, it is all about the JS VM wars. Chrome with V8 and firefox coming up with a new implementation of their js engine.

    It looks like the future is high performance JS especially in DOM and other serialized data manipulation on the client side.

    if you do start look forward to some decent posts :)

  9. CymenNo Gravatar Says:

    JavaScript and the worry of multiple implementations/browsers/platforms is daunting at first but start out with something like an XMLHttpRequest in plain JavaScript then try doing it with Prototype and jQuery. Part of the benefits of these libraries is that they work around the implementation details. So while certainly there is a lot to learn, in practice one can accomplish quite a bit knowing a bit about when events are triggered, a bit about how to use the libraries, and a bit about DOM.

    In terms of practicing JavaScript, writing GreaseMonkey scripts that are pure JS is a good way to learn and see how to tweak DOM. Internally at work, I’ve used this approach to change how a few things work in order to get acceptance of how I think things should work. Once the change is approved, I can simply put the JavaScript onto the pages themselves as it is pure (and relatively simple) JS.

  10. ManishNo Gravatar Says:

    Eli, I am in the same predicament right now as you were in while writing this post.
    I too have an Embedded Systems Background; and wanting to learn more regarding the Web frameworks and the likes;

    If you could briefly list the path you took towards gaining an insight to the Web World (DOM, JS etc) do do a brief post or update the comments herein.

  11. elibenNo Gravatar Says:

    Manish,

    I must admit I didn’t pursue this too far. I learned a bit of JS, enough to create a simple game (http://eli.thegreenplace.net/2010/02/24/a-simple-canvas-based-javascript-game-with-a-django-back-end/) and to add some usability to a couple of private web apps. I guess I know JS a bit better now, but I definitely don’t consider myself an expert.