Chapter 5. Embracing modularity and dependency management
This chapter covers
- Working with code encapsulation
- Understanding modularity in JavaScript
- Incorporating dependency injection
- Using package management
- Trying out ECMAScript 6
Now that we’re done with the Build First crash course, you’ll notice a decline in Grunt tasks, though you’ll definitely continue to improve your build. In contrast, you’ll see more examples discussing the tradeoffs between different ways you can work with the JavaScript code underlying your apps. This chapter focuses on modular design, driving down the code complexity of applications by separating concerns into different modules of interconnected, small pieces of code that do one thing well and are easily testable. You’ll manage complexity in asynchronous code flows, client-side JavaScript patterns and practices, and various kinds of testing in chapters 6, 7, and 8, respectively.
Part 2 boils down to increasing the quality in your application designs through separation of concerns. To improve your ability to separate concerns, I’ll teach you all about modularity, shared rendering, and asynchronous JavaScript development. To increase the resiliency of your applications, you should test your JavaScript, as well, which is the focus of chapter 8. While this is a JavaScript-focused book, it’s crucial that you understand REST API design principles to improve communication across pieces of your application stack, and that’s exactly the focus of chapter 9.