Pagebreaks: Multi-Cell Scopes in Computational Notebooks

Honorable Mention
Knowledge Worker Tools & WorkflowsComputational Methods in HCISoftware Engineers & DevelopersHCI Researchers

Research Background and Problem

  • Problems or Challenges Identified by the Authors:
    Programmers often encounter confusion when using Jupyter Notebook due to the extensive use of global variables, such as the need to track variables, avoid overwriting commonly used variables, and understand execution order. This reliance on global state can lead to difficulties in understanding, debugging, and organizing code. Additionally, users in the Notebook programming environment tend to use function scopes less frequently, partly because functions cannot span multiple cells and they limit interactivity and exploratory programming behaviors.

  • Why This Problem Is Important:
    As a mainstream tool for data science and exploratory programming, Notebook programming faces the dual challenge of simplifying code management while maintaining high interactivity. If these issues are not addressed, developing large-scale Notebook projects may become a complex and error-prone task. Moreover, the difficulty of managing global variables can negatively impact collaboration and reproducibility of results.

  • Research Motivation and Related Work:
    Existing research has found that Notebook users tend to avoid organizing code within functions, instead sharing state through global variables. This practice can lead to chaotic execution states, especially as Notebooks grow more complex. Furthermore, the Notebook programming environment emphasizes exploratory workflows, such as building code across multiple cells and interactively adjusting its effects. However, the function scope in traditional programming is incompatible with these exploratory behaviors.

Solution

  • Proposed Solution by the Authors:
    The authors designed a new language construct called "Pagebreaks," which allows users to create non-global scopes across multiple cells in Jupyter Notebook. Pagebreaks restrict the variables of certain cells to their defined scope but allow explicit exporting of variables for use in subsequent cells. Compared to functions, Pagebreaks preserve the exploratory behaviors of users in the Notebook environment.

  • Innovative Aspects of the Solution:

    1. Pagebreaks provide non-global scopes without disrupting the exploratory workflow of Notebooks (e.g., alternating versions, interleaving code and outputs, etc.).
    2. They allow scope to span multiple consecutive cells rather than being limited to a single function's scope.
    3. The variable export mechanism specifically addresses the issue of variable redefinition, making variables read-only outside their scope, thus reducing conflicts and confusion.
    4. The design is closely aligned with Notebook user behaviors, such as linear organization of scopes, to preserve the unique advantages of the Notebook's execution order.
  • Implementation Steps and Techniques:

    1. Design Requirements: Retain the exploratory workflow of Notebook users while providing better variable management.
    2. System Implementation: Pagebreaks were implemented as a plugin for Jupyter and IPython, modifying the program's Abstract Syntax Tree (AST) to add unique prefixes to each Pagebreak to manage their scope.
    3. Operational Mechanism: Users mark Pagebreaks through the interface, allowing variables to be freely used within the scope but requiring explicit export for subsequent cells to access them.
    4. Visualization Features: Background colors, visual hierarchies, and graphical interface elements like buttons are provided to help users organize their programs.

Research Outcomes

  • Specific Outcomes:

    1. Developed the "Pagebreaks" plugin to create scopes across multiple cells in the Notebook environment.
    2. Conducted a two-week user study observing five participants using Pagebreaks and the problems it addressed.
    3. Found that Pagebreaks improved users' ability to organize and manage Notebook programs without interfering with their existing exploratory behaviors.
  • Advantages Compared to Existing Solutions:

    1. Solves the challenge of managing global variables while retaining Notebook interactivity.
    2. Provides a more flexible cell organization model than function scopes, enabling cross-cell variable sharing.
    3. Supports improved debugging processes in Notebooks, helping isolate issues without disrupting the current program state.
  • Experimental or Evaluation Results:
    Participants noted that Pagebreaks helped track variables and reduce naming conflicts while aiding in code segmentation and file organization. The study found that Pagebreaks naturally extended Notebook user behaviors, addressing variable confusion without sacrificing familiar interactivity.

  • Limitations and Future Directions:

    1. The study involved a small number of participants and limited usage duration, leaving broader Notebook programming behaviors unexplored.
    2. Pagebreaks currently do not support user customization of colors and style settings.
    3. Future directions include adding features like highlighting exported variables and expanding the application scope of Pagebreaks.
    4. Subsequent research could explore the long-term impact of Pagebreaks on Notebook programming behaviors and how to further simplify its usage process.

Through this research, the authors effectively demonstrate how to design novel language features for Notebook programming that integrate user, language, and environment needs while preserving the flexibility of exploratory workflows. This provides an important reference for designing targeted programming environments in the future.

Quick Actions

Share

Share this page

ios_share

https://hci.top/en/papers/chi/188913/2025

AdRecommended

Learn AI Coding at CodeNow

open_in_newOpen DOI Link
DOI: https://dl.acm.org/doi/10.1145/3706598.3713620
At a Glance

Paper Snapshot

fact_check
dataset
Source
CHI
calendar_month
Year
2025
emoji_events
Award
Honorable Mention
group
Authors
2 authors
sell
Subtopics
Knowledge Worker Tools & Workflows, Computational Methods in HCI
work
Professions
Software Engineers & Developers, HCI Researchers
article
Content Status
Full text indexed
hub
Related Papers
10 related papers