Tuesday, November 13, 2012

Scalable JavaScript Application Architecture

Went to Yahoo developer meetup last week. Nicholas Zakas was the speaker that talked about how to build a scalable javascript application. There are some key points I’d like to share.

First is the overall architecture diagram.

Nicholas mentioned loose coupling is important to make an application scalable.

A loosely coupled system is one in which each of its components has, or makes use of, little or no knowledge of the definitions of other separate components.
  • Only the base library knows which browser is being used. 
  • Only the application core knows which base library is being used 
  • Only the sandbox knows which application core is being used 
  • The modules know nothing except that the sandbox exists 
  • No part knows about the web application
The advantages of such system are
  • Multiple different applications can be created with the same framework. 
  • Each part can be tested separately. 
  • Replace any parts do not break the application. 

The following link is Nicholas’ full slides with some pseudocode