Buổi 06: Strategic Analysis — Phân Tích Codebase 4 Chiều 🔍
Thành quả: 9 Windows analysis + proposal document cho 1 improvement thực tế
🎯 Mục Tiêu
- Master cm-brainstorm-idea: Double Diamond + 9 Windows (TRIZ)
- Phân tích codebase theo 4 chiều: Tech, Product, Design, Business
- Generate 2-3 qualified options, evaluate multi-dimensionally
- Viết proposal document chuyên nghiệp
- Bridge output sang cm-planning
📖 Phần 1: Double Diamond Process
DISCOVER DEFINE DEVELOP EVALUATE
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Scan wide │ │ Qualify the │ │ Generate │ │ Score & │
│ understand │ → │ REAL problem│ → │ 2-3 options │ → │ Recommend │
│ current │ │ │ │ │ │ │
└──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
Diamond 1 (Diverge → Converge) Diamond 2 (Diverge → Converge)Anti-Pattern: "Jump to Solution"
❌ Junior dev: "API chậm → thêm Redis cache!"
Problem: Chưa biết TẠI SAO chậm → có thể N+1 query, có thể missing index
✅ VibeCoder: "API chậm → Measure → Root cause → 2-3 options → Evaluate → Choose"
Result: Fix đúng gốc rễ, không over-engineer📖 Phần 2: Phase 1 — Discover
4 Chiều Phân Tích
| Chiều | Câu hỏi | Tool |
|---|---|---|
| Tech | Code quality? Scalability? Tech debt? Performance? | cm-codeintell, test results |
| Product | Features đủ chưa? Users hài lòng? Funnel gaps? | User interviews, analytics |
| Design | UX quality? Accessibility? Mobile? Design system? | cm-ux-master, browser devtools |
| Business | Revenue impact? Market position? ROI of this change? | Stakeholder interviews |
Tech Assessment Template
markdown
## Tech Assessment
### Code Quality (1-10): ___
- [ ] TypeScript strict mode?
- [ ] ESLint + Prettier configured?
- [ ] No `any` types?
- [ ] Consistent naming conventions?
- [ ] Clean imports (no circular)?
### Test Coverage: ___%
- [ ] Unit tests exist?
- [ ] Integration tests?
- [ ] E2E tests?
- [ ] CI runs tests automatically?
### Scalability (1-10): ___
- [ ] Database queries optimized?
- [ ] Caching strategy?
- [ ] Connection pooling?
- [ ] Rate limiting?
### Tech Debt (list):
1. [debt item 1]
2. [debt item 2]
3. [debt item 3]
### Performance:
- API average response: ___ms
- Largest Contentful Paint: ___s
- Bundle size: ___KB📖 Phần 3: Phase 2 — 9 Windows Analysis
Template cho Software Projects
┌─────────────────┬──────────────────────┬──────────────────────┬──────────────────────┐
│ │ PAST │ PRESENT │ FUTURE │
├─────────────────┼──────────────────────┼──────────────────────┼──────────────────────┤
│ SUPER-SYSTEM │ Industry trends │ Competitor landscape │ Emerging tech │
│ (ecosystem) │ before this product │ right now │ AI, edge, serverless │
├─────────────────┼──────────────────────┼──────────────────────┼──────────────────────┤
│ SYSTEM │ V1 architecture │ Current state │ Ideal architecture │
│ (the product) │ Original decisions │ Strengths/Weaknesses │ With improvements │
├─────────────────┼──────────────────────┼──────────────────────┼──────────────────────┤
│ SUB-SYSTEM │ V1 tech stack │ Current components │ Needed components │
│ (components) │ Original choices │ Dependencies │ Upgrades/Replacements│
└─────────────────┴──────────────────────┴──────────────────────┴──────────────────────┘Ví dụ: E-commerce Platform
┌─────────────────┬────────────────────┬────────────────────┬────────────────────┐
│ │ PAST │ PRESENT │ FUTURE │
├─────────────────┼────────────────────┼────────────────────┼────────────────────┤
│ SUPER-SYSTEM │ Desktop-first era │ Mobile 70% traffic │ AI shopping │
│ │ PayPal only │ Multi-payment │ Voice commerce │
├─────────────────┼────────────────────┼────────────────────┼────────────────────┤
│ SYSTEM │ Monolithic PHP │ Express + React │ Microservices? │
│ │ MySQL, no cache │ PostgreSQL + Redis │ Edge computing? │
├─────────────────┼────────────────────┼────────────────────┼────────────────────┤
│ SUB-SYSTEM │ jQuery, Bootstrap │ React 17, REST API │ React 19, GraphQL │
│ │ No tests │ 30% test coverage │ 80%+ coverage │
└─────────────────┴────────────────────┴────────────────────┴────────────────────┘
Insights:
- PAST→PRESENT: Successfully migrated from monolith to modern stack
- PRESENT tension: Mobile traffic high but mobile UX poor (Design gap)
- FUTURE opportunity: AI-powered recommendations could 3x conversion📖 Phần 4: Phase 3-4 — Generate & Evaluate Options
Generating Options: 3 Perspectives
| Perspective | Focus | Example |
|---|---|---|
| User-first | What makes users happiest? | "Redesign checkout flow, reduce steps from 5 to 2" |
| Tech-first | What eliminates most debt? | "Migrate to microservices, add test coverage" |
| Business-first | What generates ROI fastest? | "Add AI recommendations, 3x conversion" |
Evaluation Matrix
| Dimension | Weight | Option A: UX Redesign | Option B: Microservices | Option C: AI Recs |
|---|---|---|---|---|
| Tech | 25% | 6/10 | 9/10 | 7/10 |
| Product | 30% | 9/10 | 5/10 | 8/10 |
| Design | 20% | 9/10 | 3/10 | 6/10 |
| Business | 25% | 7/10 | 4/10 | 9/10 |
| Weighted | 100% | 7.8 | 5.3 | 7.6 |
Recommendation: Option A (UX Redesign) — highest weighted score, addresses the mobile UX gap identified in 9 Windows.
📖 Phần 5: Proposal Document
Template
markdown
# Proposal: [Initiative Name]
Generated by: cm-brainstorm-idea
Date: [date]
## Why We're Doing This
### Qualified Problem
**For:** [user segment]
**Who:** [pain point]
**Current state:** [what exists]
**Desired state:** [what should exist]
### 9 Windows Key Insight
[The most important finding]
## Options Evaluated
### Option A: [Name] — Score: X/10
[Summary + pros/cons]
### Option B: [Name] — Score: X/10
[Summary + pros/cons]
## Recommendation
**Choose Option [X]** because:
1. [Reason 1]
2. [Reason 2]
3. [Reason 3]
## Next Steps for cm-planning
1. [Scope to plan]
2. [Constraints]
3. [Open questions]🧪 Lab: Analyze an Open-Source Project
Task: Full analysis of a real codebase (60 min)
- Pick any open-source project with ~100+ files
- Run 5-Step Onboarding from Buổi 05
- Fill 9 Windows analysis
- Identify 1 improvement area
- Generate 2 options, evaluate, recommend
- Write proposal.md
🎓 Tóm Tắt
| Phase | Output |
|---|---|
| Discover | 4-dimension assessment |
| Define | 9 Windows + qualified problem |
| Develop | 2-3 options from different perspectives |
| Evaluate | Weighted scoring matrix |
| Handoff | Proposal document for cm-planning |
⏭️ Buổi tiếp theo
Buổi 07: Refactoring Mastery — Clean Code Có Hệ Thống 🔧