UNPKG

bc-code-intelligence-mcp

Version:

BC Code Intelligence MCP Server - Complete Specialist Bundle with AI-driven expert consultation, seamless handoffs, and context-preserving workflows

76 lines (58 loc) 3.75 kB
--- title: "AL Blank Line Organization" domain: "roger-reviewer" difficulty: "beginner" bc_versions: "14+" tags: ["formatting", "readability", "code-organization"] samples: "samples/al-blank-line-organization.md" type: "improvement-pattern" category: "code-formatting" pattern_type: "good" severity: "medium" impact_level: "medium" improvement_suggestion: "Use strategic blank lines to organize AL code into logical sections" implementation_steps: ["identify-logical-sections", "insert-separating-blank-lines", "validate-consistency"] validation_criteria: ["logical-grouping-clear", "consistent-spacing-applied"] technical_areas: ["al-code"] --- # AL Blank Line Organization ## Overview Strategic blank line placement in AL code creates visual separation between logical sections, improving readability and maintainability. Proper blank line organization helps developers quickly identify code structure and navigate complex procedures and functions. **Key Principle**: Use blank lines to separate distinct logical operations, not arbitrary code segments. ## Strategic Framework ### Visual Code Organization - **Logical Grouping**: Separate variable declarations, business logic sections, and error handling - **Functional Boundaries**: Use blank lines before and after major functional blocks - **Context Switching**: Insert blank lines when switching between different data operations - **Method Structure**: Consistent spacing patterns within methods and triggers ### Readability Enhancement Blank lines act as visual punctuation, allowing developers to parse code structure quickly. They reduce cognitive load by creating natural reading breaks and highlighting important transitions. ## Architecture Focus ### Code Structure Patterns - **Declaration Blocks**: Separate variable declarations from executable code - **Business Logic Sections**: Group related operations with clear boundaries - **Error Handling**: Isolate error handling code with appropriate spacing - **Data Processing**: Separate input validation, processing, and output operations ### Consistency Principles Establish team-wide conventions for blank line usage to ensure consistent code appearance across all AL objects. Consistent formatting reduces context switching overhead when reviewing code. ## Best Practices ### Effective Blank Line Placement - **After variable declarations** before first executable statement - **Between major functional blocks** within procedures - **Before and after loops** containing significant logic - **Around error handling blocks** for clear separation - **Between related but distinct operations** for logical grouping ### Grouping Strategies Group related variable declarations together, separate business logic sections clearly, and use blank lines to emphasize important transitions in code flow. ### Consistency Rules Apply blank line patterns consistently across all AL objects in your extension. Document team conventions for blank line usage in coding standards. ## Anti-Patterns ### Avoid These Approaches - **Excessive blank lines** that fragment code unnecessarily - **Random spacing** without logical organization principles - **No blank lines** creating dense, hard-to-read code blocks - **Inconsistent patterns** across different AL objects - **Blank lines within tightly coupled operations** that should remain grouped Inconsistent blank line usage creates visual noise and makes code harder to scan effectively. Avoid both extremes of no spacing and excessive spacing. *Implementation examples: see samples/al-blank-line-organization.md* *Related patterns: al-formatting-consistency-patterns.md, al-readability-optimization.md*