Book Image

JavaScript at Scale

By : Adam Boduch
Book Image

JavaScript at Scale

By: Adam Boduch

Overview of this book

Table of Contents (17 chapters)
JavaScript at Scale
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
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 our software help us...