Category Archives: Web Development
Automating JavaScript Unit Tests with Git
How many of you JavaScript developers out there write unit tests?
The key to unit tests is that they’re run EVERY TIME you touch your code… otherwise your tests aren’t going to do anything (obviously). If your tests don’t do anything, there’s no point in having them.
I’d like to share an example app in which I create a bash script that runs my unit tests via PhantomJS. By utilizing a Git pre-commit hook, I ensure my unit tests are run EVERY TIME I touch my code, and (best of all) it won’t allow me to commit code that doesn’t pass my tests! Continue reading
JavaScript: Selection vs. Insertion Sort
“Selection Sort” and “Insertion Sort” are two popular sorting algorithms. If they have the same Big-O notation, which is better?
The point here is that Big-O notation, although certainly helpful, doesn’t always tell us the full story. It’s great to know what the worst possible performance is for our code… but we need to know how often to expect that situation. Continue reading
JavaScript: Binary Search vs Linear Search
The linear search algorithm is often “good enough” for most applications. Although optimization would improve performance, the benefit might only be minimal if our data set (stored in an array) is relatively small.
But what happens to our algorithm as the data set increases in size?
I put together a short example comparing the expected (worst-case) and actual performance of these two search algorithms. Continue reading
JavaScript Encapsulation
I recently had a discussion with a colleague about encapsulation. We lamented the fact that many developers cannot adequately define, describe or otherwise communicate the concept during the interview process – even at the “senior developer” level.
After our conversation, I went home and Googled “JavaScript encapsulation” just to see what came up. After seeing the search results I am not at all surprised that few JavaScript programmers really understand the concept. I didn’t feel satisfied by any of the examples or definitions I found, so here’s my crack at explaining things. Continue reading
Book Review: Test Driven JavaScript Development
Test Driven JavaScript Development is probably the best book about JavaScript that I’ve read yet.
I realize that’s a bold statement to make, but I challenge anyone to name another book that (1) explains fundamental JavaScript concepts as clearly, or (2) offers specific advice on how to tackle an enterprise solution in JavaScript. Continue reading
Code Reviews: Why Your Code Sucks
Over the past few years I’ve been asked to perform Code Reviews on many web applications, often projects utilizing ExtJS or Sencha Touch.
I always enjoy peeking into the thought process behind an application because you never know when you’re going to learn something useful. As someone who takes an immense amount of pride in my profession, I strongly believe that education should never stop because someone will always do something better than you. At the very least, reading someone else’s code will trigger ideas of your own.
That being said, code reviews are sometimes fun… but more often frustrating. Continue reading
A Rant in Defense of JavaScript
Yesterday, my Twitter feed exploded with people talking about Google’s new Dart language. I’ll be honest and say that it struck a nerve with me… and so I begin my rant in defense of JavaScript. Continue reading
Book Review: Location Aware Applications
Over the past month, I’ve had the pleasure of reading Location Aware Applications by Richard Ferraro and Murat Aktihanoglu. As a web developer who increasingly focuses on mobile applications, I was immediately drawn to this book. Continue reading
Book Review: The Art of Unit Testing
Unit testing has become a hot topic over the past few years in the web development industry. As websites and web applications become increasingly complex, the need for unit/integration testing on the client has reached critical mass. Unfortunately, the few tools currently available for client-side web application testing are limited in scope, often difficult to implement, and even harder to automate.
In short, “The Art of Unit Testing” caught my eye because I feel passionately about improving my skills and adding value to the projects in which I’m involved. Continue reading
Book Review: jQuery In Action
At the August meeting of the Chicago Sencha User Group, Shawn Khameneh presented “Plugin Development and Animation using jQuery”. Despite being an employee of Sencha and a fanatic of ExtJS, I have been a longtime JavaScript enthusiast and dabbled in a variety of client-side technologies. Like most web developers, I’ve used jQuery to build websites – but my exposure to the more advanced constructs of the library has been limited.
After enjoying Shawn’s presentation I had the chance to read jQuery in Action (2nd Edition), which was the featured prize for our group at that meeting. Continue reading
