比較與決策矩陣

關於比較圖

comparison 是涵蓋整個「並排比較與決策」家族的單一引擎。選擇一個 mode:,同一套 DSL 即可渲染五種不同的專業圖表:

  • tchart — 2 至 N 欄帶標籤的項目清單(經典的比較對照 T 型圖;三欄即為 Y 型圖)。
  • pros-cons — 兩欄清單,帶有綠色 ✓ / 紅色 ✗ 的正負標記。
  • matrix — 選項 × 準則網格;儲存格可填自由文字或 yes / no / partial 標記。
  • decision(別名標頭 pugh)— 加權決策矩陣:每個準則帶有 weight:,每個選項帶有數字分數,引擎自動計算每個選項的加權總分 Σ(weight × score),進行排名並標示勝出者。這是 Stuart Pugh 的收斂控制法(ASQ / 六標準差概念選擇)——與 pertfaulttree 一樣,都是「引擎計算答案」的設計理念。
  • double-bubble — 思維地圖的比較對照組織圖:兩個中心,共同特徵居中,獨有特徵向外展開。

請勿與 matrix 混淆。 那個引擎是在兩個連續軸上定位項目(艾森豪矩陣、BCG、影響-努力矩陣)。comparison 排列的是表格,而在 decision 模式下,計算決策結果。兩者是人們常混淆的兩個截然不同的工具。

comparison·§
↘ preview
100%
Selecting a CI/CD platform Decision matrix: 3 options × 4 weighted criteria. Winner: "GitHub Actions" — weighted score 61, highest of 3 options. Selecting a CI/CD platform GitHub Actions GitLab CI Jenkins datum Ease of setup ×5 5 4 2 Build speed ×4 4 4 3 Cost at our scale ×4 4 3 5 Self-host control ×2 2 5 5 Weighted total 61 #1 58 #2 52 #3 vs datum +9 +6 0 Winner: "GitHub Actions" — weighted score 61, highest of 3 options.
UTF-8 · LF · 22 lines · 452 chars✓ parsed·2.4 ms·14.2 KB SVG

1. 標頭與模式

標頭關鍵字為 comparison(別名 comparevs)。標頭關鍵字 tchartpugh 可直接設定模式。或使用 mode: 指令選擇:

comparison "Title"
mode: tchart | pros-cons | matrix | decision | double-bubble
legend: on | off

若省略 mode:,系統會根據您使用的關鍵字推斷——但明確指定更可靠。

2. T 型圖(與 Y 型圖)

宣告每個 column,然後用 - 列出各欄要點。三欄即讀作 Y 型圖。

tchart "TCP vs UDP"
column "TCP"
- Connection-oriented (handshake)
- Guaranteed, ordered delivery
column "UDP"
- Connectionless, fire-and-forget
- Minimal header, low latency

3. 優缺點

comparison "Migrate to microservices?"
mode: pros-cons
pro "Independent team deploys"
pro "Scale hot paths in isolation"
con "Distributed-systems complexity"
con "Operational + infra cost goes up"

pro 行填入綠色欄,con 行填入紅色欄——順序無關。

4. 比較矩陣

宣告每個 option(欄),再宣告每個 criterion(列),並以縮排的 選項名稱: 數值 格式填入各選項的儲存格。儲存格值:yes / no / partial 渲染為 ✓ / ✗ / ~,數字為分數,帶引號的文字原樣顯示。選項名稱必須與某個 option 完全吻合(拼字錯誤會被標示,而非靜默忽略)。

comparison "Cloud provider — managed services"
mode: matrix
option "AWS"
option "GCP"
option "Azure"
criterion "Free tier"
  AWS: "12 months"
  GCP: "Always-free"
  Azure: "12 months"
criterion "Managed Postgres"
  AWS: yes
  GCP: yes
  Azure: partial

也接受簡潔的管線格式:criterion "Free tier" | "12 months" | "Always-free" | "12 months"(按選項順序對應位置)。

5. 決策矩陣(計算型)

為每個準則加上 weight: 並在每個儲存格填入數字分數。引擎會附加一列加權總分,對選項排名(#1#2……),並標示勝出者。加上 baseline: "選項名稱" 作為 Pugh 基準——該欄會以陰影標示,並新增一列與基準的差值

pugh "Database for the new service"
baseline: "PostgreSQL"
option "PostgreSQL"
option "MongoDB"
option "DynamoDB"
criterion "Query flexibility" weight: 5
  PostgreSQL: 5
  MongoDB: 3
  DynamoDB: 2
criterion "Horizontal scaling" weight: 4
  PostgreSQL: 3
  MongoDB: 4
  DynamoDB: 5
criterion "Operational cost" weight: 3
  PostgreSQL: 4
  MongoDB: 3
  DynamoDB: 3

您無需手動寫出總分——引擎自動計算 Σ(weight × score),因此修改某個分數就會改變計算出的勝出者。

6. 雙泡泡圖(比較對照)

comparison "Plant cell vs Animal cell"
mode: double-bubble
left "Plant cell"
right "Animal cell"
shared "Has a nucleus"
shared "Mitochondria"
left-only "Cell wall"
left-only "Chloroplasts"
right-only "Centrioles"
right-only "Lysosomes"

shared 特徵居中,與兩個中心相連;left-only / right-only 向各自的中心展開。

7. 主題

default 使用帶有綠色/紅色/琥珀色標記的品牌藍;monochrome 取消顏色(標記改用 ✓/✗/~,勝出者改用粗邊框)以便黑白列印;dark 使用 Catppuccin 深色主題。

標準依據

Pugh,《Total Design》(1991)收斂控制法・ASQ 決策矩陣・Hyerle 思維地圖(雙泡泡)・K-12 圖形組織工具慣例。參見 docs/reference/51-COMPARISON-STANDARD.md

Found this useful?

Schematex is free, fully open source, and zero-dependency. A star helps other developers discover it.