docs(conductor): Complete Phase 1 of AppController curation (Audit & Guidelines)

This commit is contained in:
2026-05-13 18:03:22 -04:00
parent a81b2088ba
commit 511aabbd0d
7 changed files with 125 additions and 1 deletions
+9 -1
View File
@@ -180,4 +180,12 @@ To minimize token usage and enhance visual scanning for human reviewers, heavily
## 14. Logical Region Blocks
For extremely large files that violate the "Anti-OOP" rule by necessity (e.g., `App` class holding global UI state), use `#region: Section Name` and `#endregion: Section Name` tags to strictly organize methods and state properties. This establishes a predictable structure that MCP tools and agents can leverage for contextual masking.
For extremely large files that violate the "Anti-OOP" rule by necessity (e.g., `App` class holding global UI state), use `#region: Section Name` and `#endregion: Section Name` tags (or `# --- Section Name ---` for visual grouping) to strictly organize methods and state properties. This establishes a predictable structure that MCP tools and agents can leverage for contextual masking.
## 15. Modular Controller Pattern
To prevent "God Object" bloat in core controllers (like `AppController`):
- **Extract Logic:** Move all state-independent or purely utility logic to module-level functions.
- **Dependency Injection:** Module-level functions that require class state should accept the instance as their first argument (e.g., `def my_extracted_logic(controller: AppController, ...)`).
- **Handler Maps:** Replace massive `if/elif` blocks (like those in event dispatchers) with dictionaries mapping keys to module-level handler functions.
- **Inner Class Extraction:** Never define nested classes or functions within methods. Move them to the module level.