docs(conductor): Complete Phase 1 of AppController curation (Audit & Guidelines)
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user