Promises are currently the best tool we have for asynchronous programming and they appear to be our best hope for the forseeable future, even if they’ll be hiding behind generators or async functions. For now, we’ll need to use promises directly, so we should learn some good techniques for using them right now, especially when dealing with asynchronous operations on collections, whether they happen in parallel or sequentially.
tag : design patterns
It’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!
Recently, 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.
When 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.
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.