JSFoo 2014

JavaScript as the centerpiece of a complex web stack

Gaurav Dadhania

@gvrv72

A curated tour of awesome JavaScript sources: Backbone edition

Submitted Jul 6, 2014

In the extremely fast-paced world of JavaScript development, it’s easy for a developer to lose their way amidst the plethora of frameworks and libraries being stuffed in their face. While moving from grunt to gulp, from jquery to backbone to angular to react, from animations in the browser to ORMs on the server to sensors on a board, and all that in the scope of a few years, the developer often loses focus of the bare bones language in question — the small, powerful, quirky JavaScript, they once fell in love with.

Let’s take a step back, and focus on what makes great JavaScript code, great! No wrangling with a library, no introductory tutorial on framework, we’ll just look at plain old vanilla.js code from one of the most popular JavaScript libraries in existence, to learn a thing or two about writing good code: what design patterns to use, what to avoid, how to avoid the quirks of language, how to work with them, how do the seasoned devs code?

Let’s learn from the collective intelligence of hundreds of contributors to take home at least a few coding lessons we can put to use immediately. Let’s focus on the language again and rekindle that romance!

Outline

Someone far smarter than me thinks that reading source is essential for a young Padawan dev to broaden their horizons.

Someone far smarter than me has written a little library called Backbone (and a little library called Underscore, and a little language called CoffeeScript).

Someone as smart as me was able to add these two things together and come up a topic for a talk!

Together we’ll investigate the Backbone.js source and learn a couple of JavaScript coding tricks along the way:

  • Did you know that the backbone.js is only 1600 LoC?
  • Do you know how backbone router deals with the History API
  • Do you know how backbone Object.extend pattern works?
  • Do you know how backbone is instantiated?
  • Do you like hacks and/or funny comments that make you smile?

In 40 minutes, we’ll take a look at some of the most interesting code snippets from the Backbone source and understand the clever hacks and patterns that have ended up there by the collective effort of hundreds of contributors. I hope you take away at least a few new patterns or ideas from this talk that you can start applying practically straight away.

Requirements

Just knowing vanilla.js syntax should be enough.

Speaker bio

Gaurav is a code connoisseur at CommonCode, where he works with clients like Kogan Australia and CottonOn. He thinks he’s fluent in Python and JavaScript. In the past, he has been lucky enough to talk at PyCon Australia and multiple MelbDjango meetups. He likes GIFs.

He’s not sure whether he should be writing this in the third-person.

Comments

{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Hosted by

JSFoo is a forum for discussing UI engineering; fullstack development; web applications engineering, performance, security and design; accessibility; and latest developments in #JavaScript. Follow JSFoo on Twitter more