Bourns Hall

Work to improve event-based programming receives $1.2 million grant

UC Riverside and New Jersey Institute of Technology split funds to work on the joint project

August 6, 2021
Author: Holly Ober
August 6, 2021

Zhijia Zhao, an associate professor of computer science and engineering in UC Riverside’s Marlan and Rosemary Bourns College of Engineering, has received a $600,000 grant from the National Science Foundation, or NSF, to improve event-based programming for computers and mobile devices. The project is a collaboration with Iulian Neamtiu at the New Jersey Institute of Technology, who received an NSF grant for the same amount.

Zhijia Zhao

Event-based programming is used to construct software systems with billions of users, including mobile apps, Web clients and servers, and Internet-of-Things, or IoT, devices. It is a programming paradigm in which the workflow responds to external cues or actions, such as user clicks, sensor data, or messages passing from other programs, and is central to graphical user interfaces that perform actions in response to user inputs. Event-based programs therefore power many of the software systems used every day, from Android/IOS devices to IoT devices to Javascript and the Web. 

“Taking Android as an example, if a user edited her profile in an app and clicked the ‘save’ button, the system would generate an event and trigger a piece of code to process this event. In this case, this piece of code should implement the logic to save a changed user profile,” explained Zhao. “To achieve this, Android provides a programming interface, called event handlers, for developers to implement such functionalities. In this way, when the events of interest occur, they would be automatically processed by their corresponding event handlers.”

Despite their popularity, event-based systems are poorly understood and prone to errors because the events that trigger actions must be organized in the correct order. Yet, it is difficult for programmers to know beforehand what that order should be. The programs are relatively easy to write but hard to get right. These difficulties have wide-ranging consequences such as losing users' work in mobile apps, silent errors or downtime in Web services, and unexpected IoT device behavior, such as a smart lock locking a user out of their own home.

“You can write a 10-line program that accomplishes a lot. Soon though it becomes a nightmare because the programmer has no control over ordering and makes a ton of assumptions: ‘trust me I know I’ll get the events in this order that I like, not the order they actually come in’, and all sorts of bad things happen,” said Neamtiu.

Zhao and Neamtiu aim to construct a “grand unified theory” of event-based programs that will make them easier to analyze and construct an approach for determining the order between key events before the program runs to prevent ordering errors. The goal is to give programmers and correctness-checking tools information about the assumptions programmers made about order when creating a program and recommend checking to make sure these assumptions are sound. The results of their work should also update older established tools for checking program correctness with the ability to analyze these newer event-based programs. The researchers plan to apply these techniques to widely used platforms and programs, such as Android apps, home automation systems, and Javascript code used by the top-100 websites.