I’m a backend programmer who works mainly in Python. I’ll probably never want to be a full time front end developer, but with the goal of growing my skill set, I would like to become at least passably proficient in JavaScript. It seems like a language that is wearing a lot of hats nowadays, and if nothing else, I’d like to a little more knowledgable about ‘their world’ when I’m working with front end guys.
We’re using NodeJS for some server side work at my company, and I was curious about it. I’ve found a few good tutorials and it seems interesting. It seems like it might be a good way to familiarize myself with JavaScript, since it comes at it from an angle that I understand — server side programming.
But I am also a little worried that if I learn both at once, I won’t be able to keep track of what’s ‘Stock JavaScript’ vs features that are particular to NodeJS.
What do you guys think? Is bootstrapping myself into JavaScript familiarity by learning NodeJS a good idea? Or will I just confuse myself if I jump into Node without a solid understanding of the fundamentals of JavaScript?
3
It won’t matter.
In either case, you’ll be learning things that are specific to the domain in which you’re working. On the client, you’ll be learning things about DOM and cross-browser compliance. On the server-side you’ll be learning things like file access and database libraries.
It’s really six to one, and half-dozen to the other. If anything, you’ll be less distracted by the the intricacies of Node than you will the intricacies of browser-based JavaScript.
Getting into JavaScript is definitely a good idea, as JavaScript is only getting better and more popular.
Front-end JavaScript development is extremely different then Node.js (Server-side) programming/development. Each browser has their own support of JavaScript features, meaning, features are not always readily available across every browsers. Especially with the new version of ECMAScript, it’s becoming extremely hard to take advantage of, as most browsers, or the majority of users (apart from chrome) are on older browsers. Chrome has had auto-updates for a long time, so it’s users don’t need to take any action. They typically get the majority of their users upgraded within a few weeks. You still have Internet Explorer 6,7, and 8 problems, and even 9 (Not many new features that are in HTML5 and ECMAScript spec). Firefox is fairly good, and they seem to be on a good track implementing new features all the time.
On the client-side you have 3-5 different JavaScript engines; V8 (Chrome & Node.js), IonMonkey (Firefox has had multiple engines), Carakan (Opera), JavaScriptCore (Safari), Chakra (Internet Explorer). Each engine has different architectures (JIT, byte-code, machine code, etc…) and now each have different support for ECMAScript 6 (Harmony).
With Node.js, you can start to take advantage of newer JavaScript features as you only have to support one JavaScript engine (V8). This makes it extremely easy to work with, as you’re not jumping through hoops trying to do feature detection, hack the system, etc…
Lesson 1: Developing within Node.js is luxury compared to the client-side, but with the power of frameworks and libraries like JQuery, Ember.js, Angular, Handlebars (Templating), Modernizr, etc… your work load dramatically decreases.
Performance, Optimization, and the DOM… This is what client-side development is like. If you start with Node.js, you’ll start to use (hopefully) build and deploy tools like GruntJS, Yeoman, Cake, etc… These will be incredibly useful when working with client-side JavaScript. Start looking into different module systems; Node.js uses CommonJS. AMD is another choice for development.
JavaScript as a language is simple to get started with. Once you dig deeper down, you’ll find how flexible a prototypal model is.
The asynchronous model might be a little scary at first, but no need to be afraid. It’s quite simple when you understand it. You’ll go through the traditional stage of callback hell, but you’ll be able to learn some design patterns to avoid them.
Node essentially capitalizes on all the stuff that makes JavaScript stand out as a language so I’d say it’s probably a better start than client-side work for you. Also, Python’s trust-the-user philosophy and the Python community’s devotion to writing cross-platform software that isn’t clumsy, hamfisted and stupid tends to be a good fit with JavaScript’s complete abandon with regards to giving its users plenty of rope to do with as they please and the JS community’s legacy of normalizing for browsers that refuse to agree on how things are done exactly fits nicely with that Python-cross-platform chutzpah.
So I guess what I’m saying, is that I wouldn’t sweat it. You’ve got the server-side paradigm down and Python and JS, while different, tend to come from similar lines of thought which I would boil down to:
- Don’t protect me from myself or the other guy
- Don’t assume I’m a dummy or that I’ll never want to learn anything after college
- Be easy to use right out of the box but give me serious power when I bother to really learn the crap out of the language and what it’s capable of
The important thing to remember about JavaScript is that in spite of what all the bigwig speaking-engagement-types say, JS is not a language we are “stuck with.” It is not something that happened to dominate web UI and then spread across all platforms like a super-virus by accident. It did not kick the crap out of VB, Flash, ActionScript and Java applets merely because of foolishly misguided efforts at owning the front end of the web by abstracting from how everything actually works, or being intolerably proprietary in terms of how those language business models were in their own right completely and 100% unacceptable. And it sure as Hell isn’t the only real choice for writing cross-platform mobile platform apps just because JS devs are hyperactive and prolific. It won those battles because it’s a really good tool for those jobs.
It’s elegant, it has a strong, highly-focused opinion, and it walks a nice line of being accessible to people who just want to get simple things done in obvious ways while offering very powerful options to people who are willing to take it a step further and properly understand how it fuses functional and functionally-OOP into a master-blend.
And remember that the whole point of Node.js is to basically bury threads with JavaScript. You can run two I/O processes simultaneously but JS is just the thing that sets processes off and waits for them to finish. The fact that the language is naturally blocking but highly proficient at asynchronous response essentially turns JS into a kind of auto-queuing messenger. It’s probably not the best tool for everything you’d ever want to do on a server but it’s a pretty interesting paradigm for a lot more than just covering basic web server stuff. But not if you don’t accept it for what it is and why that’s been successful. So, have fun with it. Learn more about Python as you learn more about how JavaScript is different from it.
And sorry about the C-based syntax. You won’t notice as much after a while, I promise. But skip CoffeeScript until you know how it limits you on the OOP front. You probably won’t want it.
JavaScript, by itself, is a pretty small language that is easily understandable by most programmers, especially if you’re a proficient Python programmer. There are no new programming concepts in core JavaScript. You probably already know 90% of what there is to know about JavaScript itself.
The real learning curve comes when you use JavaScript to try to do some useful work. Inside a browser, you use the DOM (Document Object Model) to interact with web pages. That is sometimes annoying, so you can also use jQuery to manipulate the DOM with shorter expressions.
NodeJS is a way of writing back-end server processes in JavaScript using a highly asynchronous programming model. Unless you’re using Twisted in Python, you’re probably not going to be very familiar with the asynchronous style of programming used in NodeJS. So that would be another learning curve.
Basically it depends on what you want to actually do with JavaScript – it’s just a programming language tool. The libraries that people build around JavaScript are where the interesting things happen.
4