Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Design Patterns for JavaScript Applications

Design Patterns for JavaScript Applications

This item in japanese

We are writing increasingly larger and more complex JavaScript applications using the latest frameworks and libraries but we tend to overlook the core principles involved in the creation of these libraries Carl Danley, a senior web engineer, motivates the start of a series of blog posts about JavaScript design patterns. Patterns provide a clear approach to writing structured, scalable and maintainable code, concepts which all are extremely important when developing large JavaScript applications

Some of the reasons why Carl finds the use of patterns so important are:

  • Patterns are an easy way to refer to a very specific implementation of code while avoiding the additional discussion it would take to get everyone on the same page if the vocabulary used for patterns didn’t exist.
  • Patterns can help in overcoming minor issues at an early stage thus preventing them from becoming major issues later on.
  • Patterns exemplify a level of sophistication that can provide both performance boosts and reduce memory usage.
  • Patterns are established through rigorous testing and, for the most part, helps solving a particular type of problem.

Carl quotes Addy Osmani, author of the book Learning JavaScript Design Patterns:

One of the most important aspects of writing maintainable code is being able to notice the recurring themes in that code and optimize them. This is an area where knowledge of design patterns can prove invaluable.

So far Carl has covered the following patterns:

For each of the patterns Carl describes the purpose and main use cases together with advantages and disadvantages. He has also written a small example for each of them.
His plan for the near future includes the Factory, Mixin and Decorator Patterns.

Carl has contributed to a number of open-source frameworks and libraries e.g. jQuery, WordPress, Backbone and Angular.js.

Rate this Article