DEV Community

Cover image for A Guide to the Doherty Threshold in JavaScript Apps
Chelsea Devereaux for MESCIUS inc.

Posted on • Originally published at developer.mescius.com

A Guide to the Doherty Threshold in JavaScript Apps

What You Will Need

  • Wijmo

Controls Referenced

Tutorial Concept
The Doherty Threshold in Web Applications - Explore the Doherty Threshold and its impact on your JavaScript applications.


In the ever-evolving world of web development, user experience (UX) is a major determining factor in whether an application is successful. A great user interface not only captures attention but also keeps users engaged and satisfied. One of the key UX principles that can significantly improve user interaction is the Doherty Threshold*.* Let's jump into this principle and explore how it can be applied to JavaScript UI components for optimized user interactions. We will review:

What is the Doherty Threshold?

The Doherty Threshold was introduced in 1982 by Walter J. Doherty and Arvind J. Thadani. It establishes that for a user to stay engaged with a computer system, the interaction needs to happen at a response time of 400 milliseconds or less. This speed enables users to maintain their thought process without interruption, which achieves a more seamless flow.

Put simply, the Doherty Threshold suggests keeping response times under 400 milliseconds allows users to stay "in the zone" and engaged and to actively interact with the interface rather than being interrupted by delays. When systems can meet this threshold, they feel more responsive, which enhances productivity and user satisfaction.

How the Doherty Threshold Applies to Web Components

For web applications, especially those using UI frameworks, meeting the Doherty Threshold can mean the difference between a frictionless experience and a frustrating one. Many web components, such as grids, charts, and input controls, deal with large amounts of data, which can lead to performance bottlenecks. However, by applying the Doherty Threshold as a guiding principle, developers can ensure that interactions with these components feel instant and engaging, even when dealing with large data sets.

To learn more about the Doherty Threshold, please check out this article.

Applying the Doherty Threshold to Wijmo Components

Below are a few examples of how we can leverage the Doherty Threshold to make UI components more responsive and user-friendly:

Optimize Data Loading in Grids

Data grids can become slow when rendering large data sets. One way to overcome this is by implementing virtual scrolling and lazy loading techniques to keep load times under 400 ms.

FlexGrid, a highly customizable data grid in Wijmo, can utilize virtual scrolling. This allows the grid to load only the visible portion of data and creates an illusion of instantaneous response. With Wijmo’s API, developers can easily configure this to avoid loading the entire dataset at once.

Data virtualization

Pre-Fetch and Cache Data

Frequent data requests can slow down performance, especially when switching between components. To overcome this, pre-fetching and caching strategies can help deliver data more efficiently. With Wijmo’s data collection and caching functionalities, data can be loaded in the background or cached locally to minimize the number of server calls. This is particularly useful for charts and grids that rely on data from remote sources.

Streamline Validation in Input Components

Input components can feel sluggish if validation checks delay user feedback. The solution to this is to implement asynchronous validation and debounce functions. For instance, if users are typing in an InputMask field, you can delay validation until they stop typing for a moment. This approach ensures instant feedback, preserving the 400-ms response time whenever possible.

Use Asynchronous Loading for Heavy Visual Elements

Visual components like chart controls may take time to render, especially when dealing with complex datasets or multiple series. To overcome this, asynchronous loading and progressive rendering techniques can help the component display as quickly as possible. For instance, using Wijmo’s chart controls in a way that renders axes and labels first while data points load progressively can keep users engaged without long delays.

Chart controls

Provide Visual Feedback During Delays

In some cases, keeping interactions under 400 ms is impossible, especially when dealing with complex data operations. When these delays are unavoidable, visual feedback like loading spinners, progress bars, or skeleton screens can help retain the user’s sense of control and keep them engaged. Wijmo components offer options to integrate such UI elements so that users are informed of the ongoing process and can anticipate when the operation will conclude.

Progress bar

Progress

Real-World Use Case: Optimizing FlexGrid for the Doherty Threshold

Let’s consider a realistic use case for this UX law using Wijmo’s FlexGrid to display a large amount of data. A common scenario might involve filtering through thousands of customer records. To apply the Doherty Threshold in this case, we should leverage:

  • Virtual Scrolling: By enabling virtual scrolling, only the records that are visible are rendered at any given time, ensuring smoother scrolling and faster initial load times.
  • Local Filtering and Sorting: Instead of sending a new request to a server for each filter or sort action, consider downloading the entire dataset initially and implementing client-side sorting and filtering to minimize delays.
  • Batch Editing: Grouping changes into a single update operation rather than submitting every edit individually to the backend can improve responsiveness.

Batch editing

Final Thoughts

Applying the Doherty Threshold to JavaScript web componentshelps ensure that user interactions feel immediate, creating a smoother and more seamless experience. By focusing on optimizing load times, utilizing asynchronous operations, and providing meaningful feedback, developers can design applications that keep users engaged and productive.

As a UX principle, the Doherty Threshold is about meeting user expectations for speed and fluidity. When integrated with the flexibility and power of Wijmo’s UI components, this principle becomes a valuable asset in delivering responsive and intuitive applications.

Top comments (0)