Urgent.News

What's breaking now, across thousands of outlets.

Tech

Your daily reminder needs three states, not a boolean

I built a checklist that opens itself at 8 am. The hard part wasn't opening it. It was working out when to stop. The version that fails The obvious model is a boolean. One flag per day: { " 2026-09-20 " : { opened : false } } A timer checks every thirty seconds. Is it past 8am, and is opened still false? Show the window. When the person presses Start My Day , set it true and go quiet until…

The author describes building a checklist application that opens automatically at 8 am, but the real challenge was determining when to stop displaying the window. Initially, the author tried using a boolean flag to track whether the window had been opened or dismissed. However, this approach proved insufficient, as simply closing the window did not clear the flag, causing the window to reopen repeatedly.

The author eventually discovered that the key to resolving this issue lay in introducing a third state, alongside 'opened' and 'dismissed', which represents a window that has been answered but not yet closed. By adopting this three-state approach, the checklist app could more accurately reflect the user's actions and avoid unnecessary reopenings.

Additionally, the author highlights how this change simplifies the timer logic, as it can now focus on checking whether a slot has been settled or dismissed instead of dealing with various workarounds. The author emphasizes that a boolean flag alone is insufficient for accurately tracking user interaction and that the correct question to ask is whether the user has actually engaged with the window, regardless of whether they've completed the task or simply closed it.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Java Concurrency & Multithreading: 40 Interview Questions

1. Process vs Thread A process has its own memory space and OS resources; threads live inside a process and share its heap and file handles but keep their own stack and program counter.

  • Threads share process memory but have separate stacks and program counters.
  • Java provides platform threads (expensive) and lightweight virtual threads (Project Loom).
  • Java Memory Model ensures visibility guarantees for shared state between threads.

GM Revives CarPlay for 2027 Trucks

Natalie Neff, Autoweek: General Motors is reversing course after having begun to remove Apple CarPlay from its vehicles, showing off instead a redesigned infotainment interface for the 2027 Chevrolet…

More from Sunday 20 September →