Browse Source

Add visual guide and README for terminology proposal

Co-authored-by: tig <[email protected]>
copilot-swe-agent[bot] 1 month ago
parent
commit
75d5c49df7
2 changed files with 692 additions and 0 deletions
  1. 254 0
      TERMINOLOGY_README.md
  2. 438 0
      TERMINOLOGY_VISUAL_GUIDE.md

+ 254 - 0
TERMINOLOGY_README.md

@@ -0,0 +1,254 @@
+# Application.Run Terminology Proposal - README
+
+This directory contains a comprehensive proposal for improving the terminology around `Application.Run` and related APIs in Terminal.Gui.
+
+## ๐Ÿ“‹ Documents
+
+### 1. [TERMINOLOGY_PROPOSAL.md](TERMINOLOGY_PROPOSAL.md)
+**Complete proposal with detailed analysis**
+
+Contents:
+- Executive Summary
+- Problem Statement (why current terminology is confusing)
+- Current Terminology Analysis
+- Three proposed options with pros/cons
+- Recommendation: Option 1 (Session-Based)
+- Migration strategy
+- Documentation changes required
+- FAQ
+
+**Start here** for the full context and rationale.
+
+### 2. [TERMINOLOGY_QUICK_REFERENCE.md](TERMINOLOGY_QUICK_REFERENCE.md)
+**Quick comparison tables and code examples**
+
+Contents:
+- Current vs Proposed (all 3 options)
+- Side-by-side comparison table
+- Usage examples for each option
+- Manual event loop control examples
+- High-level vs low-level API comparison
+
+**Use this** for quick lookup and comparison.
+
+### 3. [TERMINOLOGY_INDUSTRY_COMPARISON.md](TERMINOLOGY_INDUSTRY_COMPARISON.md)
+**How Terminal.Gui compares to other frameworks**
+
+Contents:
+- Comparison with WPF, WinForms, Avalonia, GTK, Qt
+- Web framework patterns (ASP.NET, Entity Framework)
+- Game engine patterns (Unity, Unreal)
+- Industry standard terminology analysis
+- Why "Session" is the right choice
+
+**Read this** to understand industry context.
+
+### 4. [TERMINOLOGY_VISUAL_GUIDE.md](TERMINOLOGY_VISUAL_GUIDE.md)
+**Visual diagrams and flowcharts**
+
+Contents:
+- Visual comparison of current vs proposed
+- Lifecycle diagrams
+- Event flow diagrams
+- Nested sessions (modal dialogs)
+- Complete example flows
+- Benefits visualization
+
+**Use this** for visual learners and presentations.
+
+## ๐ŸŽฏ The Problem
+
+The current `Application.Run` terminology is confusing:
+
+```csharp
+// What's the difference between these "Run" methods?
+Application.Run(window);           // Complete lifecycle
+Application.RunLoop(runState);     // Event loop
+Application.RunIteration();        // One iteration
+
+// What is RunState? State or a handle?
+RunState runState = Application.Begin(window);  // Begin what?
+
+// What's ending?
+Application.End(runState);  // End what?
+```
+
+**Result:** Confused users, steeper learning curve, unclear documentation.
+
+## โœ… The Solution
+
+### Option 1: Session-Based Terminology (Recommended)
+
+```csharp
+// High-level API (unchanged)
+Application.Run(window);  // Simple and familiar
+
+// Low-level API (clearer names)
+ToplevelSession session = Application.BeginSession(window);    // โœ… Clear
+Application.ProcessEvents(session);                            // โœ… Clear
+Application.EndSession(session);                               // โœ… Clear
+```
+
+**Why this wins:**
+- โœ… "Session" accurately describes bounded execution
+- โœ… "ProcessEvents" is explicit about what happens
+- โœ… "BeginSession/EndSession" are unambiguous
+- โœ… Aligns with industry patterns (HttpContext, DbContext)
+- โœ… Minimal disruption to existing API
+
+### Complete Mapping
+
+| Current | Proposed | Why |
+|---------|----------|-----|
+| `Run()` | `Run()` | Keep - familiar |
+| `RunState` | `ToplevelSession` | Clear it's a session token |
+| `Begin()` | `BeginSession()` | Clear what's beginning |
+| `RunLoop()` | `ProcessEvents()` | Describes the action |
+| `RunIteration()` | `ProcessEventsIteration()` | Consistent |
+| `End()` | `EndSession()` | Clear what's ending |
+| `RequestStop()` | `StopProcessingEvents()` | Explicit |
+
+## ๐Ÿ“Š Comparison Matrix
+
+| Criterion | Current | Proposed (Option 1) |
+|-----------|---------|---------------------|
+| **Clarity** | โš ๏ธ "Run" overloaded | โœ… Each term is distinct |
+| **Accuracy** | โš ๏ธ "State" is misleading | โœ… "Session" is accurate |
+| **Learnability** | โš ๏ธ Steep curve | โœ… Self-documenting |
+| **Industry Alignment** | โš ๏ธ Unique terminology | โœ… Standard patterns |
+| **Breaking Changes** | N/A | โœ… None (old APIs kept) |
+
+## ๐Ÿš€ Migration Path
+
+### Phase 1: Add New APIs (Release 1)
+```csharp
+// Add new APIs
+public static ToplevelSession BeginSession(Toplevel toplevel) { ... }
+
+// Mark old APIs obsolete
+[Obsolete("Use BeginSession instead. See TERMINOLOGY_PROPOSAL.md")]
+public static RunState Begin(Toplevel toplevel) { ... }
+```
+
+### Phase 2: Update Documentation (Release 1-2)
+- Update all docs to use new terminology
+- Add migration guide
+- Update examples
+
+### Phase 3: Community Adoption (Release 2-4)
+- Examples use new APIs
+- Community feedback period
+- Adjust based on feedback
+
+### Phase 4: Consider Removal (Release 5+)
+- After 2-3 releases, consider removing `[Obsolete]` APIs
+- Or keep them indefinitely with internal delegation
+
+## ๐Ÿ’ก Key Insights
+
+### 1. High-Level API Unchanged
+Most users won't be affected:
+```csharp
+Application.Init();
+Application.Run(window);  // Still works exactly the same
+Application.Shutdown();
+```
+
+### 2. Low-Level API Clarified
+Advanced users get clearer APIs:
+```csharp
+// Before (confusing)
+var rs = Application.Begin(window);
+Application.RunLoop(rs);
+Application.End(rs);
+
+// After (clear)
+var session = Application.BeginSession(window);
+Application.ProcessEvents(session);
+Application.EndSession(session);
+```
+
+### 3. Complete Backward Compatibility
+```csharp
+// Old code continues to work
+RunState rs = Application.Begin(window);  // Works, but obsolete warning
+Application.RunLoop(rs);                   // Works, but obsolete warning
+Application.End(rs);                       // Works, but obsolete warning
+```
+
+## ๐Ÿ“ˆ Benefits
+
+### For Users
+- โœ… **Faster learning** - Self-documenting APIs
+- โœ… **Less confusion** - Clear, distinct names
+- โœ… **Better understanding** - Matches mental model
+
+### For Maintainers
+- โœ… **Easier to explain** - Clear terminology in docs
+- โœ… **Fewer questions** - Users understand the pattern
+- โœ… **Better code** - Internal code can use clearer names
+
+### For the Project
+- โœ… **Professional** - Aligns with industry standards
+- โœ… **Accessible** - Lower barrier to entry
+- โœ… **Maintainable** - Clearer code is easier to maintain
+
+## ๐Ÿค” Alternatives Considered
+
+### Option 2: Modal/Show Terminology
+```csharp
+Application.ShowModal(window);
+var handle = Application.Activate(window);
+Application.EventLoop(handle);
+Application.Deactivate(handle);
+```
+**Rejected:** Doesn't fit Terminal.Gui's model well.
+
+### Option 3: Lifecycle Terminology
+```csharp
+var context = Application.Start(window);
+Application.Execute(context);
+Application.Stop(context);
+```
+**Rejected:** Breaks Begin/End pattern, "Execute" less explicit.
+
+See [TERMINOLOGY_PROPOSAL.md](TERMINOLOGY_PROPOSAL.md) for full analysis.
+
+## ๐Ÿ“š Additional Resources
+
+### Terminal.Gui Documentation
+- [Application Class](https://gui-cs.github.io/Terminal.Gui/api/Terminal.Gui.App.Application.html)
+- [Multitasking Guide](docfx/docs/multitasking.md)
+
+### Related Issues
+- Issue #4329 - Original discussion about Run terminology
+
+## ๐Ÿ—ณ๏ธ Community Feedback
+
+We welcome feedback on this proposal:
+
+1. **Preferred option?** Session-Based, Modal/Show, or Lifecycle?
+2. **Better names?** Suggest alternatives
+3. **Migration concerns?** Share your use cases
+4. **Timeline?** How long do you need to migrate?
+
+## ๐Ÿ“ž Contact
+
+For questions or feedback:
+- Open an issue in the Terminal.Gui repository
+- Comment on the PR associated with this proposal
+- Join the discussion in the community forums
+
+## ๐Ÿ“„ License
+
+This proposal is part of the Terminal.Gui project and follows the same license (MIT).
+
+---
+
+**Status:** ๐Ÿ“ Proposal (awaiting community feedback)
+
+**Author:** GitHub Copilot (generated based on issue #4329)
+
+**Date:** 2025-10-25
+
+**Version:** 1.0

+ 438 - 0
TERMINOLOGY_VISUAL_GUIDE.md

@@ -0,0 +1,438 @@
+# Application.Run Terminology - Visual Guide
+
+This document provides visual representations of the Application execution lifecycle to clarify the terminology.
+
+## Current Terminology (Confusing)
+
+### The Problem: "Run" Everywhere
+
+```
+โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+โ”‚                   Application.Run()                     โ”‚  โ† High-level API
+โ”‚                                                         โ”‚
+โ”‚  "Run" means the complete lifecycle                    โ”‚
+โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+                          โ”‚
+                          โ–ผ
+        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+        โ”‚   Application.Begin(toplevel)   โ”‚  โ† "Begin" what?
+        โ”‚                                 โ”‚
+        โ”‚   Returns: RunState             โ”‚  โ† Sounds like state data
+        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+                          โ”‚
+                          โ–ผ
+        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+        โ”‚  Application.RunLoop(runState)  โ”‚  โ† "Run" again? Run vs RunLoop?
+        โ”‚                                 โ”‚
+        โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
+        โ”‚  โ”‚ while (running)           โ”‚ โ”‚
+        โ”‚  โ”‚   RunIteration()          โ”‚ โ”‚  โ† "Run" again? What's the difference?
+        โ”‚  โ”‚     ProcessInput()        โ”‚ โ”‚
+        โ”‚  โ”‚     Layout/Draw()         โ”‚ โ”‚
+        โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
+        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+                          โ”‚
+                          โ–ผ
+        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+        โ”‚   Application.End(runState)     โ”‚  โ† "End" what?
+        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+
+Issues:
+โŒ "Run" appears 4 times meaning different things
+โŒ RunState sounds like state, but it's a token
+โŒ Begin/End don't clarify what's beginning/ending
+โŒ RunLoop vs RunIteration relationship unclear
+```
+
+## Proposed Terminology - Option 1: Session-Based โญ
+
+### The Solution: Clear, Explicit Names
+
+```
+โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+โ”‚                   Application.Run()                     โ”‚  โ† High-level (unchanged)
+โ”‚                                                         โ”‚
+โ”‚  Complete lifecycle: Begin + ProcessEvents + End       โ”‚
+โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+                          โ”‚
+                          โ–ผ
+        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+        โ”‚ Application.BeginSession(toplevel)  โ”‚  โœ… Clear: starting a session
+        โ”‚                                     โ”‚
+        โ”‚ Returns: ToplevelSession            โ”‚  โœ… Clear: it's a session token
+        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+                          โ”‚
+                          โ–ผ
+        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+        โ”‚ Application.ProcessEvents(session)  โ”‚  โœ… Clear: processing events
+        โ”‚                                     โ”‚
+        โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
+        โ”‚  โ”‚ while (running)              โ”‚  โ”‚
+        โ”‚  โ”‚   ProcessEventsIteration()   โ”‚  โ”‚  โœ… Clear: one iteration of processing
+        โ”‚  โ”‚     ProcessInput()           โ”‚  โ”‚
+        โ”‚  โ”‚     Layout/Draw()            โ”‚  โ”‚
+        โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
+        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+                          โ”‚
+                          โ–ผ
+        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+        โ”‚  Application.EndSession(session)    โ”‚  โœ… Clear: ending the session
+        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+
+Benefits:
+โœ… "Session" clearly indicates bounded execution
+โœ… "ProcessEvents" describes the action
+โœ… BeginSession/EndSession are unambiguous
+โœ… Terminology is consistent and clear
+```
+
+## Lifecycle Comparison
+
+### Application Lifecycle (Init/Shutdown) vs Session Lifecycle (Begin/ProcessEvents/End)
+
+```
+โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Application Lifetime โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+โ”‚                                                                           โ”‚
+โ”‚  Application.Init()          โ† Initialize once per application           โ”‚
+โ”‚      โ”œโ”€ Create driver                                                    โ”‚
+โ”‚      โ”œโ”€ Initialize screen                                                โ”‚
+โ”‚      โ””โ”€ Setup subsystems                                                 โ”‚
+โ”‚                                                                           โ”‚
+โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Session 1 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”‚
+โ”‚  โ”‚  Application.BeginSession(window1) โ†’ session1             โ”‚          โ”‚
+โ”‚  โ”‚      โ”œโ”€ Initialize window1                                โ”‚          โ”‚
+โ”‚  โ”‚      โ”œโ”€ Layout window1                                    โ”‚          โ”‚
+โ”‚  โ”‚      โ””โ”€ Draw window1                                      โ”‚          โ”‚
+โ”‚  โ”‚                                                            โ”‚          โ”‚
+โ”‚  โ”‚  Application.ProcessEvents(session1)                      โ”‚          โ”‚
+โ”‚  โ”‚      โ””โ”€ Event loop until RequestStop()                    โ”‚          โ”‚
+โ”‚  โ”‚                                                            โ”‚          โ”‚
+โ”‚  โ”‚  Application.EndSession(session1)                         โ”‚          โ”‚
+โ”‚  โ”‚      โ””โ”€ Cleanup window1                                   โ”‚          โ”‚
+โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ”‚
+โ”‚                                                                           โ”‚
+โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Session 2 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”‚
+โ”‚  โ”‚  Application.BeginSession(dialog) โ†’ session2              โ”‚          โ”‚
+โ”‚  โ”‚  Application.ProcessEvents(session2)                      โ”‚          โ”‚
+โ”‚  โ”‚  Application.EndSession(session2)                         โ”‚          โ”‚
+โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ”‚
+โ”‚                                                                           โ”‚
+โ”‚  Application.Shutdown()      โ† Cleanup once per application              โ”‚
+โ”‚      โ”œโ”€ Dispose driver                                                   โ”‚
+โ”‚      โ””โ”€ Restore terminal                                                 โ”‚
+โ”‚                                                                           โ”‚
+โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+
+Key Insight: Multiple sessions within one application lifetime
+```
+
+## Event Flow During ProcessEvents
+
+### Current (Confusing)
+
+```
+RunLoop(runState)
+    โ”‚
+    โ””โ”€> while (toplevel.Running)
+            โ”‚
+            โ”œโ”€> RunIteration(runState)    โ† What's the difference?
+            โ”‚       โ”‚
+            โ”‚       โ”œโ”€> MainLoop.RunIteration()
+            โ”‚       โ”‚       โ””โ”€> Process driver events
+            โ”‚       โ”‚
+            โ”‚       โ”œโ”€> Layout (if needed)
+            โ”‚       โ””โ”€> Draw (if needed)
+            โ”‚
+            โ””โ”€> (repeat)
+```
+
+### Proposed (Clear)
+
+```
+ProcessEvents(session)
+    โ”‚
+    โ””โ”€> while (toplevel.Running)
+            โ”‚
+            โ”œโ”€> ProcessEventsIteration(session)  โœ… Clear: one iteration of event processing
+            โ”‚       โ”‚
+            โ”‚       โ”œโ”€> MainLoop.RunIteration()
+            โ”‚       โ”‚       โ””โ”€> Process driver events
+            โ”‚       โ”‚
+            โ”‚       โ”œโ”€> Layout (if needed)
+            โ”‚       โ””โ”€> Draw (if needed)
+            โ”‚
+            โ””โ”€> (repeat)
+```
+
+## Manual Control Pattern
+
+When you need fine-grained control over the event loop:
+
+### Current (Confusing)
+
+```
+RunState rs = Begin(toplevel);        โ† Begin what?
+EndAfterFirstIteration = true;        โ† End what?
+
+while (!done)
+{
+    RunIteration(ref rs, first);      โ† Run what? How does this relate to RunLoop?
+    first = false;
+    
+    // Custom processing
+    DoMyCustomStuff();
+}
+
+End(rs);                              โ† End what?
+```
+
+### Proposed (Clear)
+
+```
+ToplevelSession session = BeginSession(toplevel);     โœ… Clear: starting a session
+StopAfterFirstIteration = true;                       โœ… Clear: stop after one iteration
+
+while (!done)
+{
+    ProcessEventsIteration(ref session, first);       โœ… Clear: process one iteration
+    first = false;
+    
+    // Custom processing
+    DoMyCustomStuff();
+}
+
+EndSession(session);                                  โœ… Clear: ending the session
+```
+
+## RequestStop Flow
+
+### Current
+
+```
+User Action (e.g., Quit Key)
+    โ”‚
+    โ–ผ
+Application.RequestStop(toplevel)
+    โ”‚
+    โ–ผ
+Sets toplevel.Running = false
+    โ”‚
+    โ–ผ
+RunLoop detects !Running
+    โ”‚
+    โ–ผ
+RunLoop exits
+    โ”‚
+    โ–ผ
+Application.End() cleans up
+```
+
+### Proposed (Same flow, clearer names)
+
+```
+User Action (e.g., Quit Key)
+    โ”‚
+    โ–ผ
+Application.StopProcessingEvents(toplevel)    โœ… Clear: stops event processing
+    โ”‚
+    โ–ผ
+Sets toplevel.Running = false
+    โ”‚
+    โ–ผ
+ProcessEvents detects !Running
+    โ”‚
+    โ–ผ
+ProcessEvents exits
+    โ”‚
+    โ–ผ
+Application.EndSession() cleans up
+```
+
+## Nested Sessions (Modal Dialogs)
+
+```
+โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Main Window Session โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+โ”‚                                                  โ”‚
+โ”‚  session1 = BeginSession(mainWindow)            โ”‚
+โ”‚                                                  โ”‚
+โ”‚  ProcessEvents(session1) starts...              โ”‚
+โ”‚      โ”‚                                           โ”‚
+โ”‚      โ”‚  User clicks "Open Dialog" button        โ”‚
+โ”‚      โ”‚                                           โ”‚
+โ”‚      โ”œโ”€> โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Dialog Session โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”‚
+โ”‚      โ”‚   โ”‚                               โ”‚      โ”‚
+โ”‚      โ”‚   โ”‚  session2 = BeginSession(dialog)     โ”‚
+โ”‚      โ”‚   โ”‚                               โ”‚      โ”‚
+โ”‚      โ”‚   โ”‚  ProcessEvents(session2)      โ”‚      โ”‚
+โ”‚      โ”‚   โ”‚  (blocks until dialog closes) โ”‚      โ”‚
+โ”‚      โ”‚   โ”‚                               โ”‚      โ”‚
+โ”‚      โ”‚   โ”‚  EndSession(session2)         โ”‚      โ”‚
+โ”‚      โ”‚   โ”‚                               โ”‚      โ”‚
+โ”‚      โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ”‚
+โ”‚      โ”‚                                           โ”‚
+โ”‚      โ”‚  (returns to main window)                โ”‚
+โ”‚      โ”‚                                           โ”‚
+โ”‚  ...ProcessEvents continues                     โ”‚
+โ”‚                                                  โ”‚
+โ”‚  EndSession(session1)                           โ”‚
+โ”‚                                                  โ”‚
+โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+
+Key Insight: Sessions can be nested (modal dialogs)
+```
+
+## Complete Example Flow
+
+### Simple Application
+
+```
+START
+  โ”‚
+  โ”œโ”€> Application.Init()                     [Application Lifecycle]
+  โ”‚       โ””โ”€> Initialize driver, screen
+  โ”‚
+  โ”œโ”€> window = new Window()
+  โ”‚
+  โ”œโ”€> Application.Run(window)                [High-level API]
+  โ”‚       โ”‚
+  โ”‚       โ”œโ”€> BeginSession(window)           [Session begins]
+  โ”‚       โ”‚       โ””โ”€> Initialize, layout, draw
+  โ”‚       โ”‚
+  โ”‚       โ”œโ”€> ProcessEvents(session)         [Event processing]
+  โ”‚       โ”‚       โ””โ”€> Loop until stopped
+  โ”‚       โ”‚
+  โ”‚       โ””โ”€> EndSession(session)            [Session ends]
+  โ”‚               โ””โ”€> Cleanup
+  โ”‚
+  โ”œโ”€> window.Dispose()
+  โ”‚
+  โ””โ”€> Application.Shutdown()                 [Application Lifecycle]
+          โ””โ”€> Restore terminal
+END
+```
+
+### Application with Manual Control
+
+```
+START
+  โ”‚
+  โ”œโ”€> Application.Init()
+  โ”‚
+  โ”œโ”€> window = new Window()
+  โ”‚
+  โ”œโ”€> session = Application.BeginSession(window)    [Manual Session Control]
+  โ”‚       โ””โ”€> Initialize, layout, draw
+  โ”‚
+  โ”œโ”€> Application.StopAfterFirstIteration = true
+  โ”‚
+  โ”œโ”€> while (!done)                                 [Custom Event Loop]
+  โ”‚       โ”‚
+  โ”‚       โ”œโ”€> Application.ProcessEventsIteration(ref session, first)
+  โ”‚       โ”‚       โ””โ”€> Process one iteration
+  โ”‚       โ”‚
+  โ”‚       โ”œโ”€> DoCustomProcessing()
+  โ”‚       โ”‚
+  โ”‚       โ””โ”€> first = false
+  โ”‚
+  โ”œโ”€> Application.EndSession(session)               [Manual Session Control]
+  โ”‚       โ””โ”€> Cleanup
+  โ”‚
+  โ”œโ”€> window.Dispose()
+  โ”‚
+  โ””โ”€> Application.Shutdown()
+END
+```
+
+## Terminology Mapping Summary
+
+### API Name Changes
+
+```
+CURRENT                          PROPOSED
+โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
+
+Application.Run()           โ†’    Application.Run()                    (unchanged)
+
+RunState                    โ†’    ToplevelSession                     โœ… Clear: session token
+
+Application.Begin()         โ†’    Application.BeginSession()          โœ… Clear: begin a session
+
+Application.RunLoop()       โ†’    Application.ProcessEvents()         โœ… Clear: processes events
+
+Application.RunIteration()  โ†’    Application.ProcessEventsIteration() โœ… Clear: one iteration
+
+Application.End()           โ†’    Application.EndSession()            โœ… Clear: end the session
+
+Application.RequestStop()   โ†’    Application.StopProcessingEvents()  โœ… Clear: stops processing
+
+EndAfterFirstIteration      โ†’    StopAfterFirstIteration            โœ… Consistent naming
+
+NotifyNewRunState          โ†’    NotifyNewSession                   โœ… Consistent naming
+
+NotifyStopRunState         โ†’    NotifyStopSession                  โœ… Consistent naming
+
+RunStateEventArgs          โ†’    ToplevelSessionEventArgs           โœ… Consistent naming
+```
+
+## Benefits Visualized
+
+### Before: Confusion
+
+```
+User thinks:
+"What's the difference between Run, RunLoop, and RunIteration?"
+"Is RunState storing state or just a handle?"
+"What am I Beginning and Ending?"
+
+         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+         โ”‚    Run()    โ”‚  โ† What does "Run" mean exactly?
+         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+                โ”‚
+         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+         โ”‚   Begin()   โ”‚  โ† Begin what?
+         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+                โ”‚
+         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+         โ”‚  RunLoop()  โ”‚  โ† Is this the same as Run?
+         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+                โ”‚
+         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+         โ”‚    End()    โ”‚  โ† End what?
+         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+
+Result: User confusion, slower learning curve
+```
+
+### After: Clarity
+
+```
+User understands:
+"Run() does the complete lifecycle"
+"BeginSession/EndSession manage a session"
+"ProcessEvents processes events until stopped"
+"ToplevelSession is a token for the session"
+
+         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+         โ”‚     Run()       โ”‚  โœ… Complete lifecycle
+         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+                โ”‚
+         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+         โ”‚ BeginSession()  โ”‚  โœ… Start a session
+         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+                โ”‚
+         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+         โ”‚ ProcessEvents() โ”‚  โœ… Process events
+         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+                โ”‚
+         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
+         โ”‚  EndSession()   โ”‚  โœ… End the session
+         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
+
+Result: Clear understanding, faster learning curve
+```
+
+## See Also
+
+- [TERMINOLOGY_PROPOSAL.md](TERMINOLOGY_PROPOSAL.md) - Full proposal with rationale
+- [TERMINOLOGY_QUICK_REFERENCE.md](TERMINOLOGY_QUICK_REFERENCE.md) - Quick comparison tables
+- [TERMINOLOGY_INDUSTRY_COMPARISON.md](TERMINOLOGY_INDUSTRY_COMPARISON.md) - Industry patterns