Part 1. The basics


This part of the book will get you acquainted with some basic concepts you’ll need to know before developing your first single-page web application.

In chapter 1, we’ll talk about what an SPA is in very clear terms. It’s important to know what this type of architecture involves and why you might choose it over that of a traditional web application.

Keeping your application’s code base clean and maintainable becomes critical when working within the context of a single page. Chapter 2 compares different styles of JavaScript framework that help you achieve that goal. The chapter frames the discussion with an introduction to the three architectural patterns that heavily influenced these frameworks: MVC, MVP, and MVVM. The chapter then progresses into how the same application must change based on the style of framework that’s implemented.

In chapter 3, you’ll get a crash course on the module pattern and how it will change the way you think about organizing your JavaScript code. Using this pattern, you’ll be able to create functions and variables as you normally would but within the cozy confines of a structure that mimics classic encapsulation in other languages. As you’ll find out in this chapter, modular programming is crucial for a successful SPA.