Why Adapters and Facades Are Awesome

Adapters and Facades Are AwesomeIt's been a long time since I've actually been on here teaching you something; 9 months since my last actual tutorial and really useful article. Sorry about that! I'm trying to get back on track now though. You should see much more frequent posting and hopefully some very useful posts. Anyway, this tutorial is about a great idea I implemented at work that involved the Adapter and Facade patterns. After using these patterns in this way, I have a much deeper respect for them and I want you to share that repect, so let's take a look at some awesome ways/reasons to use them! Continue reading →



Dependency Injection with Node.js

Dependency Injection with Node.jsRecently, I went over Dependency Injection to help you understand a simple way to decouple your code a little bit and help your testing out. Sometimes, though, in Node.js a module will depend on a system API provided by Node, which can make it pretty difficult to make sure that private dependency is being used properly. Normal dependency injection doesn't work in this situation, but don't give up hope just yet. Continue reading →



Event-Based Architecture: Getting Decoupled

Event-Based Architecture: Getting DecoupledEvery JavaScript developer knows that events are quite normal in JavaScript and that an event-based system can be quite fun and simple to use. Most even use event mechanisms almost every time they write JavaScript, but have you tried taking it to the extreme? What does it look like when you have an application architecture that rarely has two objects communicating directly with one another? Continue reading →



Dependency Injection with JavaScript

Dependency InjectionWhen looking through design patterns that help to decouple objects in your applications, one of the simplest techniques to use is dependency injection. This is a common practice in Backbone.js, most notably when assigning models to views, but I haven't seen it as much as I think I should. Here I'll be examining what dependency injection is, how it helps, and how I'm putting it to good use in my latest project. Continue reading →



Book Review: Pro JavaScript Design Patterns

Book Review: Pro JavaScript Design PatternsThere are a lot of good books out there, whether they’re novels, references, or they teach you a skill or craft. In the JavaScript world, the book selection can be somewhat limited because it was only until semi-recent years that it took hold as a real language with real applicability, so older books on the subject can be a bit out of the loop. One of the books that treats JavaScript like a real language is Pro JavaScript Design Patterns. Continue reading →



JavaScript Closures and the Module Pattern

JavaScript Closures and the Module PatternOne of the most widely used design patterns in JavaScript is the module pattern.  The module pattern makes use of one of the nicer features of JavaScript – closures – in order to give you some control of the privacy of your methods so that third party applications cannot access private data or overwrite it. In this post I'll teach you what a closure is, how it works, and how to utilize it to implement the module pattern in your own JavaScript code. Continue reading →



JavaScript Design Patterns: Chain of Responsibility

We've made it to the final installment in the JavaScript Design Patterns series. That's right, after this you'll no longer have any clue what post will be coming out every Monday! Well today, we'll be talking about the Chain of Responsibility Pattern. This pattern decouples the sender and receiver of a request. This is done with a chain of objects, each of which can handle the request itself or pass it on to the next object. Confused? Read on.
Continue reading →




JavaScript Design Patterns: Observer

It's time to introduce you guys to the Observer pattern. If you've been following this blog lately, you may have already had an introduction through my post talking about my jQuery plugin called JZ Publish/Subscribe. Well, here we'll be talking about a few other ways to implement the Observer pattern, so you'll know the method that works best for you and your application. Continue reading →



JavaScript Design Patterns: Proxy

This is the 9th installment of the JavaScript Design Patterns series and today we’re featuring the Proxy pattern. The word “proxy” can be defined as a substitute, and that essentially explains what a proxy is. A proxy is an object that has the same interface as another object and is used in place of that other object. The only question is why we would use a proxy instead of the original object. Continue reading →