Chapter 2. Synchronous Versus Asynchronous Rewrites
When it comes to building software, the term rewrite is often met with fear and opposition, and for good reason. The thought of throwing something away in a field with such a bias toward efficiency is terrifying. But, like most things in software, there is more than one way to do a rewrite.
In this chapter, we’ll explain the difference between what we call a synchronous rewrite (one that requires you to stop and rewrite until it’s done) and an asynchronous rewrite (one that can be accomplished in parallel with ongoing work). We’ll provide you with strategies for successfully carrying out both kinds of rewrites.
In short, the asynchronous rewrite is an extension of general principles of modularity, and separation of concerns between data, behavior, and presentation. Building with a modular approach means you’re able to build up more complex interfaces out of very simple, context-free, and stateless UI components.
The asynchronous rewrite method relies on separating out your presentation from behavioral logic and data. This separation of concerns is a helpful evergreen principle to follow: if layout, behavior, and data are separated into three distinct layers, you’re able to make changes to any one layer independently without needing to change everything at once to keep the application working. This means you could extend these same patterns to rewrite other parts of your application asynchronously, too.
Let’s take a look at each ...