Book Image

JavaScript at Scale

By : Adam Boduch
Book Image

JavaScript at Scale

By: Adam Boduch

Overview of this book

Have you ever come up against an application that felt like it was built on sand? Maybe you've been tasked with creating an application that needs to last longer than a year before a complete re-write? If so, JavaScript at Scale is your missing documentation for maintaining scalable architectures. There's no prerequisite framework knowledge required for this book, however, most concepts presented throughout are adaptations of components found in frameworks such as Backbone, AngularJS, or Ember. All code examples are presented using ECMAScript 6 syntax, to make sure your applications are ready for next generation browsers.
Table of Contents (12 chapters)
11
Index

Communication models

There are various communication models we can use to enable inter-component communication. The simplest would be method invocations, or function calls. This approach is the most direct and the easiest to implement. However, there's also a deep coupling between one component that directly invokes method of another. This can't scale beyond a couple components.

Instead, we need a level of indirection between our components; something that mediates the communication from one component to another. This helps us to scale our inter-component communication because we're no longer communicating directly with other components. Instead, we're relying on our communication mechanism to fulfill message delivery. The two prevalent models for such a communication mechanism are message passing and event triggering. Let's compare the two approaches.

Message-passing models

Message-passing communication models are commonplace in JavaScript applications. For example...