Getting Started with CommonJS Modules and Browserify

Monday, January 5th, 2015

Modules allow us to organize code and prevent polluting the global namespace. Until ES6, JavaScript didn’t have a native module system. There were however popular module systems created by the community. In the browser, the most popular module system was the Asynchronous Module Definition (AMD). In order to use AMD modules, you could use a library like Require.js. The Node.js environment took a different approach to modules and created a module system called CommonJS. If you’d like to use CommonJS style modules in the browser, there is a tool called Browserify which has been picking up steam. Which module system you choose is entirely up to your team’s preference and application’s needs.

Read More

The Template Method Design Pattern in JavaScript

Thursday, January 1st, 2015

Over the past year I have been reading a lot about design patterns. One of the patterns I learned about was the Template Method pattern. After reading about it, I realized that I had already been using it and found there was a name for it. I wanted to show a practical example of this pattern where I used it to create a reusable class for autocomplete components.

Read More

Angular and CoffeeScript: The Tricky Parts

Monday, December 29th, 2014

CoffeeScript has been an interesting language to learn. At first, I wasn’t really into it because it required me to learn another another language that compiled down to the language I was already comfortable with. I also didn’t like the fact that CoffeeScript wasn’t a superset of JavaScript. I couldn’t incrementally learn CoffeeScript by writing JavaScript while incorporating CoffeeScript features as I learned them. Being forced to use CoffeeScript at work, after a couple weeks, I became comfortable with the language and I could appreciate certain aspects. Then, I started using CoffeeScript with Angular.js and ran into a few troubles that I thought I’d share.

Read More

Treating Backbone Views like Angular Controllers for Easier Unit Testing

Saturday, December 13th, 2014

One of the things I have found most challenging when working with Backbone.js is writing maintainable and unit testable views. Based on recent experience, I have been writing lots of unit tests for models, collections, reusable view abstractions, and services, but not for my application’s views.

Read More

Data Modeling in Angular.js with angular-data

Thursday, November 6th, 2014

Recently I gave angular-data a try and found it awesome for data modeling in Angular.js.

Read More