|
| 1 | +# Educational Anti-Pattern Backlog |
| 2 | + |
| 3 | +## Goal |
| 4 | + |
| 5 | +Add one focused **anti-pattern vs corrected version** example pair to the highest-leverage modules, while preserving cross-language parity and stable runnable behavior. |
| 6 | + |
| 7 | +This backlog prioritizes learning impact over raw file count. |
| 8 | + |
| 9 | +## Selection Rules |
| 10 | + |
| 11 | +- Keep each pair short and runnable. |
| 12 | +- Keep one teaching point per pair. |
| 13 | +- Keep observable output deterministic. |
| 14 | +- Keep scenario and output intent aligned across C++, C#, Go, Python, and TypeScript. |
| 15 | +- Keep contracts updated for any new runnable entrypoint. |
| 16 | + |
| 17 | +## Top 10 Modules (Priority Order) |
| 18 | + |
| 19 | +1. `02-core/input-validation` |
| 20 | +- Anti-pattern: trusting raw input and mixing parsing, validation, and business logic. |
| 21 | +- Correct version: parse -> validate -> normalize -> execute. |
| 22 | +- Why now: this is the most common beginner failure mode across tracks. |
| 23 | + |
| 24 | +2. `02-core/error-handling-and-defensive-programming` |
| 25 | +- Anti-pattern: swallowed errors or generic catch with no actionable context. |
| 26 | +- Correct version: specific error paths, explicit fallback, and user-facing explanation. |
| 27 | +- Why now: improves debugging habits early. |
| 28 | + |
| 29 | +3. `02-core/file-io-basics` |
| 30 | +- Anti-pattern: assume file exists and format is always valid. |
| 31 | +- Correct version: file open checks, parse guards, and malformed-row handling. |
| 32 | +- Why now: real-world robustness appears here first. |
| 33 | + |
| 34 | +4. `02-core/sorting-and-searching` |
| 35 | +- Anti-pattern: use linear search repeatedly after sorting; unstable assumptions on order. |
| 36 | +- Correct version: choose algorithm based on data shape and required guarantees. |
| 37 | +- Why now: teaches algorithm choice, not only implementation. |
| 38 | + |
| 39 | +5. `02-core/maps-and-frequency-counting` |
| 40 | +- Anti-pattern: manual counters with nested loops and missed edge cases. |
| 41 | +- Correct version: map-first counting, explicit tie/ordering policy. |
| 42 | +- Why now: foundational pattern reused in later projects. |
| 43 | + |
| 44 | +6. `03-advanced/constructors-and-invariants` |
| 45 | +- Anti-pattern: allow partially valid objects and patch later. |
| 46 | +- Correct version: enforce invariants at creation, reject invalid state early. |
| 47 | +- Why now: critical OOP mindset shift. |
| 48 | + |
| 49 | +7. `03-advanced/copy-and-move-semantics` |
| 50 | +- Anti-pattern: accidental expensive copies or broken ownership assumptions. |
| 51 | +- Correct version: explicit copy/move intent with observable lifecycle behavior. |
| 52 | +- Why now: frequent source of confusion and performance regressions. |
| 53 | + |
| 54 | +8. `03-advanced/inheritance-and-polymorphism` |
| 55 | +- Anti-pattern: brittle type checks / branching by concrete type. |
| 56 | +- Correct version: polymorphic dispatch and interface-driven design. |
| 57 | +- Why now: moves learners away from condition-heavy OOP. |
| 58 | + |
| 59 | +9. `04-expert/concurrency-basics` |
| 60 | +- Anti-pattern: unsynchronized shared state and race-prone updates. |
| 61 | +- Correct version: scoped synchronization and deterministic aggregation path. |
| 62 | +- Why now: high-impact correctness topic with subtle bugs. |
| 63 | + |
| 64 | +10. `04-expert/performance-and-profiling-basics` |
| 65 | +- Anti-pattern: optimize before measuring, micro-optimize wrong hotspot. |
| 66 | +- Correct version: baseline -> measure -> target bottleneck -> re-measure. |
| 67 | +- Why now: prevents cargo-cult “performance tuning”. |
| 68 | + |
| 69 | +## Deliverable Shape Per Module |
| 70 | + |
| 71 | +Add one pair under `example/` with naming that stays language-neutral: |
| 72 | + |
| 73 | +- `anti-pattern-main.*` |
| 74 | +- `corrected-main.*` |
| 75 | + |
| 76 | +Each file should include: |
| 77 | + |
| 78 | +- module-specific header comment, |
| 79 | +- short “what goes wrong / what is fixed” note, |
| 80 | +- deterministic output section. |
| 81 | + |
| 82 | +If a track cannot map the exact mechanism (language constraint), keep the same teaching intent and note adaptation in comments. |
| 83 | + |
| 84 | +## PR Plan |
| 85 | + |
| 86 | +### PR 1: Core Defensive Thinking |
| 87 | + |
| 88 | +Modules: |
| 89 | +- `02-core/input-validation` |
| 90 | +- `02-core/error-handling-and-defensive-programming` |
| 91 | +- `02-core/file-io-basics` |
| 92 | + |
| 93 | +Checks: |
| 94 | +- `python scripts/automation.py check-cross-language-parity` |
| 95 | +- `python scripts/automation.py check-example-output-contracts` |
| 96 | +- `python scripts/automation.py check-exercise-parity` |
| 97 | +- `python scripts/automation.py verify-repo` |
| 98 | + |
| 99 | +### PR 2: Core Algorithm Decisions |
| 100 | + |
| 101 | +Modules: |
| 102 | +- `02-core/sorting-and-searching` |
| 103 | +- `02-core/maps-and-frequency-counting` |
| 104 | + |
| 105 | +Checks: |
| 106 | +- same as PR 1 |
| 107 | + |
| 108 | +### PR 3: Advanced Object Design |
| 109 | + |
| 110 | +Modules: |
| 111 | +- `03-advanced/constructors-and-invariants` |
| 112 | +- `03-advanced/copy-and-move-semantics` |
| 113 | +- `03-advanced/inheritance-and-polymorphism` |
| 114 | + |
| 115 | +Checks: |
| 116 | +- same as PR 1 |
| 117 | + |
| 118 | +### PR 4: Expert Correctness and Performance |
| 119 | + |
| 120 | +Modules: |
| 121 | +- `04-expert/concurrency-basics` |
| 122 | +- `04-expert/performance-and-profiling-basics` |
| 123 | + |
| 124 | +Checks: |
| 125 | +- same as PR 1 |
| 126 | + |
| 127 | +## Definition of Done |
| 128 | + |
| 129 | +- Anti-pattern and corrected examples exist for all 10 modules across all 5 tracks. |
| 130 | +- Output contracts cover any new runnable example entrypoints. |
| 131 | +- Cross-language parity checks remain green. |
| 132 | +- Full `verify-repo` passes. |
| 133 | +- README/module notes mention the new pair for discoverability. |
0 commit comments