BT

Design Patterns for JavaScript Applications

by Jan Stenberg on Sep 10, 2013 |

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.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT