JavaScript Concurrency

Build better software with concurrent JavaScript programming, and unlock a more efficient and forward thinking approach to web development
Preview in Mapt

JavaScript Concurrency

Adam Boduch

1 customer reviews
Build better software with concurrent JavaScript programming, and unlock a more efficient and forward thinking approach to web development
Mapt Subscription
FREE
$29.99/m after trial
eBook
$10.00
RRP $35.99
Save 72%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$10.00
$44.99
$29.99 p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


JavaScript Concurrency Book Cover
JavaScript Concurrency
$ 35.99
$ 10.00
Learning JavaScript Data Structures and Algorithms - Third Edition Book Cover
Learning JavaScript Data Structures and Algorithms - Third Edition
$ 35.99
$ 10.00
Buy 2 for $20.00
Save $51.98
Add to Cart

Book Details

ISBN 139781785889233
Paperback292 pages

Book Description

Concurrent programming may sound abstract and complex, but it helps to deliver a better user experience. With single threaded JavaScript, applications lack dynamism. This means that when JavaScript code is running, nothing else can happen. The DOM can’t update, which means the UI freezes. In a world where users expect speed and responsiveness – in all senses of the word – this is something no developer can afford.

Fortunately, JavaScript has evolved to adopt concurrent capabilities – one of the reasons why it is still at the forefront of modern web development. This book helps you dive into concurrent JavaScript, and demonstrates how to apply its core principles and key techniques and tools to a range of complex development challenges. Built around the three core principles of concurrency – parallelism, synchronization, and conservation – you’ll learn everything you need to unlock a more efficient and dynamic JavaScript, to lay the foundations of even better user experiences.

Throughout the book you’ll learn how to put these principles into action by using a range of development approaches. Covering everything from JavaScript promises, web workers, generators and functional programming techniques, everything you learn will have a real impact on the performance of your applications. You’ll also learn how to move between client and server, for a more frictionless and fully realized approach to development. With further guidance on concurrent programming with Node.js, JavaScript Concurrency is committed to making you a better web developer.

The best developers know that great design is about more than the UI – with concurrency, you can be confident every your project will be expertly designed to guarantee its dynamism and power.

Table of Contents

Chapter 1: Why JavaScript Concurrency?
Synchronous JavaScript
Types of concurrency
JavaScript concurrency principles: Parallelize, Synchronize, Conserve
Summary
Chapter 2: The JavaScript Execution Model
Everything is a task
Execution contexts
Creating tasks using timers
Responding to DOM events
Responding to network events
Concurrency challenges with this model
Summary
Chapter 3: Synchronizing with Promises
Promise terminology
Resolving and rejecting promises
Reacting to promises
Building callback chains
Synchronizing several promises
Promises without executors
Summary
Chapter 4: Lazy Evaluation with Generators
Call stacks and memory allocation
Creating generators and yielding values
Infinite sequences
Deferring to other generators
Passing data to generators
Coroutines
Summary
Chapter 5: Working with Workers
What are workers?
Types of workers
Worker environments
Communicating with workers
Sharing application state
Performing sub-tasks with sub-workers
Error handling in web workers
Summary
Chapter 6: Practical Parallelism
Functional programming
Do we need to go parallel?
Candidate problems
Keeping the DOM responsive
Summary
Chapter 7: Abstracting Concurrency
Writing concurrent code
Worker communication with promises
Lazy workers
Using Parallel.js
Worker pools
Summary
Chapter 8: Evented IO with NodeJS
Single threaded IO
More connections, more problems
Evented network IO
Evented file IO
Summary
Chapter 9: Advanced NodeJS Concurrency
Coroutines with Co
Child Processes
Process Clusters
Server clusters
Summary
Chapter 10: Building a Concurrent Application
Getting started
Requirements
Building the API
Building the UI
Additions and improvements
Summary

What You Will Learn

  • Understand exactly how JavaScript works in a web browser environment, and how these mechanisms power our event-driven JavaScript code
  • Use promises to turn complex synchronization scenarios into readable and maintainable values
  • Compute values lazily and avoid unnecessary memory allocations using generators.
  • Write concurrent code that doesn’t feel like concurrent code by abstracting away boilerplate chores
  • Leverage true hardware parallelism with web workers to get a better performance
  • Get to grips with the NodeJS model of concurrency and learn why it’s good for I/O-intensive web applications

Authors

Table of Contents

Chapter 1: Why JavaScript Concurrency?
Synchronous JavaScript
Types of concurrency
JavaScript concurrency principles: Parallelize, Synchronize, Conserve
Summary
Chapter 2: The JavaScript Execution Model
Everything is a task
Execution contexts
Creating tasks using timers
Responding to DOM events
Responding to network events
Concurrency challenges with this model
Summary
Chapter 3: Synchronizing with Promises
Promise terminology
Resolving and rejecting promises
Reacting to promises
Building callback chains
Synchronizing several promises
Promises without executors
Summary
Chapter 4: Lazy Evaluation with Generators
Call stacks and memory allocation
Creating generators and yielding values
Infinite sequences
Deferring to other generators
Passing data to generators
Coroutines
Summary
Chapter 5: Working with Workers
What are workers?
Types of workers
Worker environments
Communicating with workers
Sharing application state
Performing sub-tasks with sub-workers
Error handling in web workers
Summary
Chapter 6: Practical Parallelism
Functional programming
Do we need to go parallel?
Candidate problems
Keeping the DOM responsive
Summary
Chapter 7: Abstracting Concurrency
Writing concurrent code
Worker communication with promises
Lazy workers
Using Parallel.js
Worker pools
Summary
Chapter 8: Evented IO with NodeJS
Single threaded IO
More connections, more problems
Evented network IO
Evented file IO
Summary
Chapter 9: Advanced NodeJS Concurrency
Coroutines with Co
Child Processes
Process Clusters
Server clusters
Summary
Chapter 10: Building a Concurrent Application
Getting started
Requirements
Building the API
Building the UI
Additions and improvements
Summary

Book Details

ISBN 139781785889233
Paperback292 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Go Programming Blueprints - Second Edition Book Cover
Go Programming Blueprints - Second Edition
$ 39.99
$ 10.00
Go Design Patterns Book Cover
Go Design Patterns
$ 39.99
$ 10.00
JavaScript: Functional Programming for JavaScript Developers Book Cover
JavaScript: Functional Programming for JavaScript Developers
$ 63.99
$ 10.00
Learning Vue.js 2 Book Cover
Learning Vue.js 2
$ 35.99
$ 10.00
Flux Architecture Book Cover
Flux Architecture
$ 35.99
$ 10.00
React Components Book Cover
React Components
$ 27.99
$ 10.00