Adding State to the Update Notification Pattern, Part 1 -- Raymond Chen

RaymondChen_5in-150x150.jpgIn software development, handling notifications efficiently is pivotal, particularly in user interface scenarios. While traditional notification patterns inform handlers of changes, they often lack crucial state information. In this article, we explore the intricacies of managing stateful updates within the context of C++/WinRT, addressing challenges such as race conditions and ensuring that notification handlers operate on the most recent data for optimal user experience.

Adding State to the Update Notification Pattern, Part 1

by Raymond Chen

From the article:

Some time ago, we looked at the update notification pattern, but in those cases, the notification carried no state.

Consider the case where you want to call a notification handler, and the handler also receives a copy of data derived from the most recent state, rather than just being called to be told that something changed and forcing them to figure out what changed.

For example, suppose you want to add autocomplete to an edit control, but calculating the autocomplete results is potentially slow, so you want to do it in the background. But while you are calculating the autocomplete results, the user might type into the edit control, and you want the final autocomplete results to reflect the most recent edit in the edit control, rather than any results from what the edit control used to contain at some point in the past.

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.