Project 2: “Hello, GUI!” Application

A simple graphical application that displays a window with a “Hello, World!” button. When you click the button, it prints a message to the debug console.

Quick Reference

Attribute Value
Primary Language C++
Alternative Languages N/A
Difficulty Level 2: Intermediate
Time Estimate Weekend
Knowledge Area GUI Programming / Event Loops
Tooling LibGUI, LibCore
Prerequisites Project 1, basic C++ knowledge (classes, lambdas).

What You Will Build

A simple graphical application that displays a window with a “Hello, World!” button. When you click the button, it prints a message to the debug console.

Why It Matters

This project builds core skills that appear repeatedly in real-world systems and tooling.

Core Challenges

  • Creating a Core::EventLoop → maps to understanding the heart of every application
  • Initializing a GUI::Window → maps to interacting with the WindowServer
  • Adding widgets to a window → maps to learning the GUI layout system
  • Handling button clicks with lambdas → maps to event-driven programming in SerenityOS

Key Concepts

  • Event Loop: “Programming SerenityOS” Ch. 3 (hypothetical, based on common structure)
  • Widget Hierarchy: Source code of any simple app like About.
  • IPC with WindowServer: Implicit in creating a GUI::Window.

Real-World Outcome

Deliver a working demo with observable output that proves the feature is correct.


Implementation Guide

  1. Reproduce the simplest happy-path scenario.
  2. Build the smallest working version of the core feature.
  3. Add input validation and error handling.
  4. Add instrumentation/logging to confirm behavior.
  5. Refactor into clean modules with tests.

Milestones

  • Milestone 1: Minimal working program that runs end-to-end.
  • Milestone 2: Correct outputs for typical inputs.
  • Milestone 3: Robust handling of edge cases.
  • Milestone 4: Clean structure and documented usage.

Validation Checklist

  • Output matches the real-world outcome example
  • Handles invalid inputs safely
  • Provides clear errors and exit codes
  • Repeatable results across runs

References

  • Main guide: LEARN_SERENITYOS_DEEP_DIVE.md
  • “Programming SerenityOS” (work-in-progress book by core developers)