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

Traceable component communication

Perhaps the biggest challenge with large-scale JavaScript applications is keeping a mental-model of where events start and where they end, in other words, tracing the event as it flows through our components. Untraceable code puts the scalability of our software at risk because we cannot predict what will happen in response to a given event.

There are a number of tactics we can use during development to ease the pain of figuring out our event flow, perhaps even modifying the design to simplify things. Simplicity scales, and we can't simplify what we don't understand.

Subscribing to events

One nice aspect of the publish-subscribe messaging model is that we can jump in and add a new subscription. This means that if we're not sure about how something works, we can throw event callback functions at the problem from various angles, until we have a better idea of what's actually happening. This is a hacker tool, and tools that support hacking...