Chris Webb

Front-end developer at Funda.

Page 2


Book Review: JavaScript testing with Jasmine by Evan Hahn

js-testing-with-jasmine.gif

JavaScript Testing with Jasmine is a new book written by Evan Hahn and published by O'Reilly that aims to:

…explain the concepts of testing and test-driven development, as well as why they’re useful… dive into Jasmine and explain how it can help programmers test their JavaScript code… give readers an understanding of Jasmine’s concepts and syntax.
— Evan Hahn

What’s Good

If you’re just getting started with Jasmine and want to save yourself some time researching and reading documentation and blog posts, JavaScript Testing With Jasmine is a concise read that will help take a bit of the pain out of understanding Jasmine.

Misses

I feel like there’s some missed opportunities with the book. It doesn’t seem to offer quite enough information either for a complete beginner or for a seasoned pro. For a novice in JavaScript or testing, it would have been useful to really dive into the...

Continue reading →


Client-side error logging with Google Event Tracking

Thanks to this article: Client-Side Error Logging With Google Analytics I started an experiment yesterday with logging client-side JavaScript errors as an event in Google Analytics in 3 lines of code. Within a couple hours, I could generate a report of which scripts were causing the most errors, what the errors are, which pages and/or which browsers have the most errors. I still think it would be a good idea to have a dedicated solution, but in the meantime this is a great way to get an instant picture of the current situation.

Here’s the code I’m using in case you want to give it a try.

window.onerror = function(message, file, line) { _gaq.push(['_trackEvent', 'JS Error', file + ':' + line + '\n\n' + message]); }; 

Related Reading

  • You really should log client-side errors
  • Client-side Error Logging from dev.opera
  • Google’s guide to Event Tracking

Continue reading →


Promise & Deferred Objects in JavaScript Pt.2: in Practice

Introduction

In part 1 of this post, I spent a lot of time looking at the theory of promises and deferreds: what promises are and how they behave. Now it’s time to actually explore some ways to use promises and deferreds in JavaScript and dive into some best practices. I’ll start with some basic uses and examples of promises and then will dive into a number of specifics pertaining to using promises in jQuery. While the exact specifics of the API may vary from your chosen library, there is enough overlap in concepts to illustrate the use of promises.

Note: The code samples will use jQuery in spite of jQuery’s deviations from the Promise/A proposal, which is particularly noticeable in the case of error handling and when working with other promise libraries. Since part 1 discussed and included links to in-depth articles on the topic, I will refrain from saying anything else about it in...

Continue reading →


Promise & Deferred objects in JavaScript Pt.1: Theory and Semantics.

Introduction

In the not too distant past the primary tool available to JavaScript programmers for handling asynchronous events was the callback.

A callback is a piece of executable code that is passed as an argument to other code, which is expected to call back ( execute ) the argument at some convenient time
Wikipedia

In other words, a function can be passed as an argument to another function to be executed when it is called.

There’s nothing inherently wrong with callbacks, but depending on which environment we are programming in there are a number of options available for managing asynchronous events. In this post my goal is to examine one set of available tools: promise objects and deferred objects. In part I, we will cover theory and semantics and in part 2 we will look at the use.

One of the keys to effectively working with asynchronous events in JavaScript is understanding...

Continue reading →


Book of the Day: Effective Javascript

When a book about JavaScript has a foreword written by Brendan Eich and rave reviews from Paul Irish, Rebecca Murphey, Alex Russell and Anton Kovalyov, you might begin to suspect that you should check it out — in this case you would be right.

Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript by David Herman and part of the ‘Effective Software Development Series’ is a distillation of the type of knowledge you gain along the way — through years of being a programmer — tackling problems, asking questions and running into brick walls. In other words the lessons of experience are in here and while you may already know some of the information you will find things you don’t know.

Effective JavaScript reminds me of JavaScript: The Good Parts by Douglas Crockford in its short dense explanations of a wide variety of important concepts including scoping, functions,...

Continue reading →


Book of the Day: Metaprogramming Ruby

Metaprogramming Ruby: Program Like the Ruby Pros by Paolo Perrotta is a book whose style tends to be divisive. In other words, you will probably love it or hate it. Once you’ve realised that, it’s important to note that even if you fall into the category of people who hate it, it’s worth giving it a chance and pushing through. The content inside makes it worth your time.

The concepts are wrapped in a thin narrative and presented while walking through solving a series of problems in which you get the thought process and concepts along with code samples that evolve iteratively incorporating the concept being discussed. Some of the concepts covered in the book include: object model, methods, blocks, class definitions, code that writes code and Rails. The explanation of the Ruby object model is one of the best I’ve ever read.

While the narrative isn’t everyone’s preferred style ( just...

Continue reading →


Goodbye ubiquitous digital service

Over the past months I’ve been transitioning away from a number of the digital services and apps I use. Honestly I didn’t set out to do it, rather it has become a snowball effect that started with one service I hated using and has led to an almost meditative evaluation of my digital workspaces and the way I interact with the technologies that are intertwined with my existence.

As a front-end developer and modern first-world citizen I spend most of my day in front of a screen. I am immersed in technology - keeping up with it, using it, interacting with it. It is after all my work. I spend all day shifting between my text editor, terminal, browser and phone. I use social media to interact with the wider world around me. I use a RSS reader to streamline my ability to find, read and share content with others. I use digital bookmarks to keep track of the knowledge I need access to ( ...

Continue reading →


Book of the Day: Secrets of the JavaScript Ninja

I’ve decided to write a new series of posts: Book of the Day. In prior posts I’ve written some recommendations of my favorite books related to JavaScript and Ruby:

  • 4 best JavaScript or JQuery books for beginners
  • JavaScript books to take your skills to the next level
  • 6 Best Books for Learning or Advancing your Ruby Knowledge

Book of the Day will highlight a book — generally related to design or development — that I think is worth the time to read along with why. As always when I write a about a book, my hope is to give some clues about the book to help you make the difficult decision about whether it’s a book for you. The only catch is that I won’t be publishing them daily.

Without further ado…

Secrets of the JavaScript Ninja

The first book on the list: Secrets of the Javascript Ninja.

As developers, we frequently rely on the libraries and frameworks built by others, however an...

Continue reading →


Open source community mentors: Thank you!

As a front-end developer, I’ve never had a mentor; at least not a face to face mentor. The closest I’ve had to a coding mentor was my ActionScript instructor, Liza Brown from Inkling, when I was in design school. Like many other front-end developers, I’ve learned through books, blogs, studying the code of others, experimenting and of course through doing — tackling the problems I come across as I work.

In a profession that is full of the self-taught, mentors and teachers are important. Mentors and teachers play a significant role in passing on the collected wisdom and knowledge of the community — to the community.

The past weeks, I’ve been reflecting on my development as a front-end developer, and I wanted to stop and say thank you to three people who have inspired me and served as my mentors along the way without knowing it: Michael Hartl, Addy Osmani and Rebecca Murphey. Through...

Continue reading →


App.net isn’t like other social media networks

I’ve recently joined App.net, the ad-free, subscription-based social media platform, founded by Dalton Caldwell and Bryan Berg. I’ve been meaning to try out App.net for a while but hadn’t taken the plunge until a couple weeks ago.

I love what’s missing in App.net.

There’s a lot I love about App.net. Not only is the network ad-free, it’s not yet been overrun by corporate and individual brands attempting to advertise themselves — looking to gain all the followers they can with a steady stream of “content” delivery and a low rate of interaction. I’m hoping
( possibly naively ) that this isn’t just a side-effect of how new App.net is, but that it’s also fostered by the ad-free culture of the company.

App.net still has a global stream and it’s still engaging and not completely overrun with junk. Unlike Twitter, there seems to be relatively few App.net celebrities who enjoy the luxury of a...

Continue reading →