Five Traits of Well-Managed JavaScript

added by JavaScript Kicks
12/16/2014 8:44:10 AM


As JavaScript projects grow, they tend to become difficult to manage if you're not careful. We found ourselves running into common problems including code that was difficult to reuse or test, and code that broke when introduced in new pages. As we explored the problems in more detail, we found the root cause was most often due to ineffective dependency management. For example, script A relies on script B that relies on script C, and somehow the dependency chain would break on some pages because script C didn't get included properly. To help solve this problem, we've adopted the Asynchronous Module Definitions (AMD) pattern and introduced require.js to our tech stack. After exploring AMD further we've identified that well-organized javascript takes on the following five traits