As I dive into JavaScript, and prompted by a recent comment on the weblog, it
occurred to me that it might be useful to create a small list of books
resources, for those of you interested in going down the same rabbit hole and starting out along a similar path.
Grab some nice food and drinks, you’re gonna’ need ’em!
First off, I’m assuming you have a good basis in some common programming language, such as C, C++, or Java, and preferably also one of the scripting languages, such as Lua, Perl, Python, Ruby, or Tcl. This isn’t a list about learning to program, but a list to help you dive into JavaScript, and all the tools, frameworks, and libraries that come with it.
Because JavaScript is just the enabler, really. My new-found fascination with it is not the syntax or the semantics, but the fast-paced ecosystem that is evolving around JS.
One more note before I take off: this is just my list. If you don’t agree, or don’t like it, just ignore it. If there are any important pointers missing (of course there are!), feel free to add tips and suggestions in the comments.
JavaScript
There’s JavaScript (the language), and there are the JavaScript environments (in the browser: the DOM, and on the server: Node). You’ll want to learn about them all.
- JavaScript: The Good Parts by Douglas Crockford
2008, 1st ed, 176 pages, ISBN 0596517742 - JavaScript: The Definitive Guide by David Flanagan
2011, 6th ed, 1100 pages, ISBN 0596805527
Videos: again by Douglas Crockford, there’s an excellent list at Stack Overflow. Going through them will take many hours, but they are really excellent. I watched all of these.
Don’t skim over prototypes, “==” vs “===”, and how “this” gets passed to functions.
Being able to understand every single notation in JavaScript is essential. Come back here if you can’t. Or google for stuff. Just don’t cut corners – it’s bound to bite you.
If you want to dive in really deep, check out this page about JavaScript and Scheme.
In the browser
Next on the menu: the DOM, HTML, and CSS. This is the essence of what happens inside a browser. Can be consumed in small doses, as the need arises. Simply start with the just-mentioned Wikipedia links.
Not quite sure what to recommend here – I’ve picked this up over the years. Perhaps w3schools this or this. Focus on HTML5 and CSS3, as these are the newest
standards.
On the server
There are different implementations of JavaScript, but on the server, by far the most common implementation seems to be Node.js. This is a lot more than “just some JS implementation”. It comes with a standard API, full of useful functions and objects.
Node.js is geared towards asynchronous & event-driven operation. Nothing blocks, not even a read from a local disk – because in CPU terms, blocking takes too long. This means that you tend to call a “read” function and give it a “callback” function which gets called once the read completes. Very very different frame of mind. Deeply frustrating at times, but essential for any non-trivial app which needs to deal with networking, disks, and other “slow” peripherals. Including us mortals.
- Learning Node by Shelley Powers
2012, 1st ed, 396 pages, ISBN 1449323073
See also this great (but fairly long) list of tutorials, videos, and books at Stack Overflow.
SPA and MVC
Note that JavaScript on the server replaces all sorts of widespread approaches: PHP, ASP, and such. Even advanced web frameworks such as Rails and Django don’t play a role here. The server no longer acts as a templating system generating dynamic web pages – instead it just serves static HTML, CSS, JavaScript, and image files, and responds to requests via Ajax or WebSockets (often using JSON in both directions).
The term for this is Single-page web application, even though it’s not about staying on a single page (i.e. URL) at all costs. See this website for more background – also as PDF.
The other concepts bound to come up are MVC and MVVM. There’s an article about MVC at A List Apart. And here’s an online book with probably more than you want to know about this topic and about JavaScript design patterns in general.
In a nutshell: the model is the data in your app, the view is its presentation (i.e. while browsing), and the controller is the logic which makes changes to the model. Very (VERY!) loosely speaking, the model sits in the server, the view is the browser, and the controller is what jumps into action on the server when someone clicks, drags, or types something. This simplification completely falls apart in more advanced uses of JS.
Dialects
I am already starting to become quite a fan of CoffeeScript, Jade, and Stylus. These are pre-processors for JavaScript, HTML, and CSS, respectively. Totally optional.
Here are some CoffeeScript tutorials and a cookbook with recipes.
CoffeeScript is still JavaScript, so a good grasp of the underlying semantics is important.
It’s fairly easy to read these notations with only minimal exposure to the underlying language dialects, in my (still limited) experience. No need to use them yourself, but if you do, the above links are excellent starting points.
Just the start…
The above are really just pre-requisites to getting started. More on this topic soon, but let me just stress that good foundational understanding of JavaScript is essential. There are crazy warts in the language (which Douglas Crockford frequently points out and explains), but they’re a fact of life that we’ll just have to live with. This is what you get with a language which has now become part of every major web browser in the world.
Check out this amazing Javascript project from Ward Cunningham the inventor of the Wiki concept: http://wardcunningham.github.com/
That does look interesting… very interesting…
Great stuff! I’m looking forward to doing more with JavaScript than some interactive trickery in the browser.
As for HTML and CSS, w3schools is not a good source for learning about them. (want to know why? Try http://w3fools.com). The Mozilla Developer Network docs are a way better place to learn about these client-side languages: https://developer.mozilla.org/en-US/docs/HTML
Great info, thanks!
For MVVM in a Node.js projects I recently built I use KnockoutJS. Another strongly supported by Google similar project is AngularJS.
You sir, must be a clairvoyant… as you will see in tomorrow’s post :)
That’s going to keep me busy for a while… and all because of these darn Jeenodes…