Moove It is now Qubika. For more information, visit our new website
Visit Qubika

DevSnack #43: Almost every developer has dealt with JavaScript in any of its flavors. However, not everyone spends the right amount of time analyzing their solutions, aiming for the best. Assuming we already know what a design pattern is, it is important to remark three main benefits of using them. As @addyosmani explains in his book Learning JavaScript Design Patterns:

  1. Patterns are proven solutions
  2. Patterns can be easily reused
  3. Patterns can be expressive

This DevSnack supplies some design patterns which can be used or at least be considered for improving your JS code quality.

 #1 – The Module Pattern

@toddmotto exposes the Module Pattern in a vast way, being a must-know pattern for every JS developer. This post is of great help for beginners who don’t know much about it.

#2 – The Prototype Pattern

When coming from other languages, especially traditional object-oriented ones, prototype pattern can become a little bit confusing. @addyosmani wrote a whole chapter for it, guiding us through the road from zero to hero.

#3 – The Bridge Pattern

Although being one of the most underused design patterns, bridges are quite helpful in event-driven apps. This type of apps are common in JavaScript  so why don’t spending some time on it. @JoeZimJS has a great post for it in his blog, just read it.

#4 – The Publisher Pattern

In this post @ded shows his own publisher pattern, described by himself as an “Observer Reloaded”. If I were you I would take a look at it, it’s always nice to learn from the big fish.

#5 – The Factory Pattern

Being used by a lot of JS frameworks, it is really useful to understand the factory pattern in depth. @carldanley published a short article about it, which I highly recommend.

Creative Commons License
DevSnack by Moove-it is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Get our stories delivered from us to your inbox weekly.