Chapter 11. Code modularization techniques

 

This chapter covers

  • Using the module pattern
  • Using current standards for writing modular code: AMD and CommonJS
  • Working with ES6 modules

So far we’ve explored the basic primitives of JavaScript, such as functions, objects, collections, and regular expressions. We have more than a couple of tools in our belt for solving specific problems with our JavaScript code. But as our applications start to grow, another whole set of problems, related to how we structure and manage our code, starts to emerge. Time and time again, it’s been proven that large, monolithic code bases are far more likely to be difficult to understand and maintain than smaller, well-organized ones. So it’s only natural that one way of improving the structure and organization of our programs is to break them into smaller, relatively loosely coupled segments called modules.

Do you know?

11.1. Modularizing code in pre-ES6 JavaScript

11.2. ES6 modules

11.3. Summary

11.4. Exercises