Skip to content

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

  1. Master cm-brainstorm-idea: Double Diamond + 9 Windows (TRIZ)
  2. Phân tích codebase theo 4 chiều: Tech, Product, Design, Business
  3. Generate 2-3 qualified options, evaluate multi-dimensionally
  4. Viết proposal document chuyên nghiệp
  5. 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ềuCâu hỏiTool
TechCode quality? Scalability? Tech debt? Performance?cm-codeintell, test results
ProductFeatures đủ chưa? Users hài lòng? Funnel gaps?User interviews, analytics
DesignUX quality? Accessibility? Mobile? Design system?cm-ux-master, browser devtools
BusinessRevenue 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

PerspectiveFocusExample
User-firstWhat makes users happiest?"Redesign checkout flow, reduce steps from 5 to 2"
Tech-firstWhat eliminates most debt?"Migrate to microservices, add test coverage"
Business-firstWhat generates ROI fastest?"Add AI recommendations, 3x conversion"

Evaluation Matrix

DimensionWeightOption A: UX RedesignOption B: MicroservicesOption C: AI Recs
Tech25%6/109/107/10
Product30%9/105/108/10
Design20%9/103/106/10
Business25%7/104/109/10
Weighted100%7.85.37.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)

  1. Pick any open-source project with ~100+ files
  2. Run 5-Step Onboarding from Buổi 05
  3. Fill 9 Windows analysis
  4. Identify 1 improvement area
  5. Generate 2 options, evaluate, recommend
  6. Write proposal.md

🎓 Tóm Tắt

PhaseOutput
Discover4-dimension assessment
Define9 Windows + qualified problem
Develop2-3 options from different perspectives
EvaluateWeighted scoring matrix
HandoffProposal document for cm-planning

⏭️ Buổi tiếp theo

Buổi 07: Refactoring Mastery — Clean Code Có Hệ Thống 🔧

Powered by CodyMaster × VitePress