Stroustrup's Rule (2024)
2 days ago
- #learning-curve
- #programming-syntax
- #language-design
- Stroustrup's Rule states that beginners require explicit syntax while experts favor terse syntax for programming features.
- The rule is illustrated through examples like error handling in Rust, evolving from explicit match statements to the ? operator as familiarity grew.
- Mental model development explains this shift: beginners lack internal models and need explicit info, whereas experts find explicit syntax cluttered and prefer brevity.
- The rule applies both individually (as programmers gain experience) and communally (language evolution from beginner-friendly to expert-focused features).
- Conflicts arise, such as the Python 'walrus' operator debate, where experts supported terseness for elegance while teachers and beginners opposed it for complexity.
- In teaching, instructors must resist using terse notation that is easier for them, opting for explicit syntax to aid beginners' understanding, as seen in TLA+ type invariants.