it

Types of Risk in Project Management —

Types of Risk in Project Management —

ความเสี่ยงในโครงการ

Types of Risk in Project Management —

ความเสี่ยงในโครงการมีหลายประเภท Technical Schedule Cost Resource Scope Quality External Communication ต้องมีแผนรับมือแต่ละประเภท

เนื้อหาเกี่ยวข้อง — แนะนำให้อ่าน Java Quarkus Agile Scrum Kanban

Risk Management Process ประกอบด้วย Identification Assessment Response Planning Monitoring Control ทำต่อเนื่องตลอดโครงการ

เนื้อหาเกี่ยวข้อง — ดูเพิ่มเติมเรื่อง AWS CDK Service Level Objective SLO

ประเภทตัวอย่างผลกระทบ
Technicalเทคโนโลยีใหม่ใช้ไม่ได้ต้องเปลี่ยนเทคโนโลยี
Scheduleงานล่าช้ากว่ากำหนดส่งมอบไม่ทัน
Costงบประมาณบานปลายโครงการขาดทุน
Resourceคนลาออกกลางโครงการขาดแรงงาน
ScopeScope Creep เพิ่มงานงานไม่จบ
Externalกฎหมายเปลี่ยนต้องปรับแผน

Risk Assessment Framework

# risk_assessment.py — Risk Assessment Framework
from dataclasses import dataclass, field
from typing import List, Dict
from enum import Enum

class RiskCategory(Enum):
    TECHNICAL = "Technical"
    SCHEDULE = "Schedule"
    COST = "Cost"
    RESOURCE = "Resource"
    SCOPE = "Scope"
    QUALITY = "Quality"
    EXTERNAL = "External"
    COMMUNICATION = "Communication"

class MitigationStrategy(Enum):
    AVOID = "Avoid"
    MITIGATE = "Mitigate"
    TRANSFER = "Transfer"
    ACCEPT = "Accept"
    EXPLOIT = "Exploit"

@dataclass
class Risk:
    id: str
    description: str
    category: RiskCategory
    probability: int  # 1-5
    impact: int  # 1-5
    owner: str
    strategy: MitigationStrategy
    mitigation_plan: str
    trigger: str
    status: str = "Open"

    @property
    def score(self) -> int:
        return self.probability * self.impact

    @property
    def level(self) -> str:
        if self.score >= 15:
            return "Critical"
        elif self.score >= 10:
            return "High"
        elif self.score >= 5:
            return "Medium"
        return "Low"

class RiskRegister:
    """Risk Register สำหรับโครงการ"""

    def __init__(self, project_name: str):
        self.project_name = project_name
        self.risks: List[Risk] = []

    def add_risk(self, risk: Risk):
        self.risks.append(risk)

    def risk_matrix(self):
        """แสดง Probability x Impact Matrix"""
        print(f"\n{'='*55}")
        print(f"Risk Matrix — {self.project_name}")
        print(f"{'='*55}")

        matrix = {}
        for risk in self.risks:
            key = (risk.probability, risk.impact)
            if key not in matrix:
                matrix[key] = []
            matrix[key].append(risk.id)

        print(f"\n  Impact ->  1    2    3    4    5")
        for prob in range(5, 0, -1):
            row = f"  P={prob}      "
            for imp in range(1, 6):
                ids = matrix.get((prob, imp), [])
                if ids:
                    cell = ",".join(ids[:2])
                else:
                    cell = " . "
                row += f"{cell:<5}"
            print(row)

    def summary(self):
        """Risk Summary"""
        print(f"\n  Risk Summary:")
        print(f"    Total Risks: {len(self.risks)}")

        by_level = {}
        for risk in self.risks:
            level = risk.level
            by_level[level] = by_level.get(level, 0) + 1

        for level in ["Critical", "High", "Medium", "Low"]:
            count = by_level.get(level, 0)
            bar = "#" * (count * 3)
            print(f"    {level:>8}: {count:>2} {bar}")

        by_category = {}
        for risk in self.risks:
            cat = risk.category.value
            by_category[cat] = by_category.get(cat, 0) + 1

        print(f"\n    By Category:")
        for cat, count in sorted(by_category.items()):
            print(f"      {cat}: {count}")

    def top_risks(self, n=5):
        """Top N Risks"""
        sorted_risks = sorted(self.risks, key=lambda r: r.score, reverse=True)
        print(f"\n  Top {n} Risks:")
        for risk in sorted_risks[:n]:
            print(f"    [{risk.id}] Score={risk.score} ({risk.level})")
            print(f"      {risk.description}")
            print(f"      Strategy: {risk.strategy.value} | Owner: {risk.owner}")

# ตัวอย่าง
register = RiskRegister("E-Commerce Platform v2.0")

risks = [
    Risk("R01", "API ของ Payment Gateway เปลี่ยน Breaking Changes",
         RiskCategory.TECHNICAL, 3, 5, "Tech Lead",
         MitigationStrategy.MITIGATE, "สร้าง Adapter Pattern แยก Layer", "API Deprecation Notice"),
    Risk("R02", "Senior Developer ลาออก",
         RiskCategory.RESOURCE, 3, 4, "PM",
         MitigationStrategy.MITIGATE, "Cross-training ทีม Document Knowledge", "แจ้งลาออก"),
    Risk("R03", "Scope Creep จาก Stakeholders",
         RiskCategory.SCOPE, 4, 3, "PM",
         MitigationStrategy.AVOID, "Change Control Board ทุก Change Request", "Request นอก Scope"),
    Risk("R04", "Performance ไม่ถึง SLA",
         RiskCategory.QUALITY, 2, 5, "Tech Lead",
         MitigationStrategy.MITIGATE, "Load Test ทุก Sprint Performance Budget", "Response > 500ms"),
    Risk("R05", "งบประมาณ Cloud เกิน 30%",
         RiskCategory.COST, 3, 3, "PM",
         MitigationStrategy.TRANSFER, "ใช้ Reserved Instances Spot Instances", "Monthly Bill > Budget"),
    Risk("R06", "PDPA Compliance ไม่ครบ",
         RiskCategory.EXTERNAL, 2, 5, "Legal",
         MitigationStrategy.AVOID, "PDPA Audit Checklist ก่อน Launch", "Audit พบ Gap"),
    Risk("R07", "Integration กับ Legacy System ล้มเหลว",
         RiskCategory.TECHNICAL, 4, 4, "Tech Lead",
         MitigationStrategy.MITIGATE, "สร้าง Mock Service ทดสอบก่อน Anti-corruption Layer", "Integration Test Fail"),
]

for risk in risks:
    register.add_risk(risk)

register.summary()
register.risk_matrix()
register.top_risks()

Mitigation Strategies

Types of Risk in Project Management —
# mitigation.py — Risk Mitigation Strategies
from dataclasses import dataclass
from typing import List, Dict

@dataclass
class MitigationPlan:
    risk_id: str
    strategy: str
    actions: List[str]
    cost: str
    timeline: str
    kpi: str

class MitigationPlanner:
    """Risk Mitigation Planner"""

    def __init__(self):
        self.plans: List[MitigationPlan] = []

    def add(self, plan: MitigationPlan):
        self.plans.append(plan)

    def show_all(self):
        print(f"\n{'='*55}")
        print(f"Mitigation Plans")
        print(f"{'='*55}")

        for plan in self.plans:
            print(f"\n  [{plan.risk_id}] Strategy: {plan.strategy}")
            print(f"    Cost: {plan.cost} | Timeline: {plan.timeline}")
            print(f"    KPI: {plan.kpi}")
            print(f"    Actions:")
            for action in plan.actions:
                print(f"      - {action}")

    def strategy_guide(self):
        """Risk Response Strategy Guide"""
        strategies = {
            "Avoid": {
                "when": "ความเสี่ยงสูงมาก ยอมรับไม่ได้",
                "how": "เปลี่ยนแผน ตัด Feature เปลี่ยนเทคโนโลยี",
                "example": "ไม่ใช้เทคโนโลยี Beta ใน Production",
            },
            "Mitigate": {
                "when": "ลดโอกาสหรือผลกระทบได้",
                "how": "เพิ่ม Testing เพิ่มคน Cross-training",
                "example": "เพิ่ม Load Test ลด Performance Risk",
            },
            "Transfer": {
                "when": "โอนความเสี่ยงให้คนอื่นจัดการ",
                "how": "ประกันภัย Outsource SLA กับ Vendor",
                "example": "ใช้ Managed Service แทนดูแลเอง",
            },
            "Accept": {
                "when": "ความเสี่ยงต่ำ หรือค่าจัดการแพงกว่า",
                "how": "เตรียม Contingency Plan สำรองงบ",
                "example": "ยอมรับ Minor Bug แก้ใน Next Sprint",
            },
            "Exploit": {
                "when": "เป็น Positive Risk / Opportunity",
                "how": "เพิ่มทรัพยากร เร่งให้เกิด",
                "example": "ทีม Deliver เร็ว -> Release Early ได้",
            },
        }

        print(f"\n  Strategy Guide:")
        for name, info in strategies.items():
            print(f"\n    [{name}]")
            print(f"      When: {info['when']}")
            print(f"      How: {info['how']}")
            print(f"      Example: {info['example']}")

planner = MitigationPlanner()

plans = [
    MitigationPlan("R01", "Mitigate", [
        "สร้าง Payment Adapter Pattern",
        "เขียน Integration Tests ครอบคลุม",
        "Monitor API Changelog ของ Gateway",
    ], "2 Man-days", "Sprint 2", "Test Coverage > 90%"),
    MitigationPlan("R07", "Mitigate", [
        "สร้าง Anti-corruption Layer",
        "Mock Service สำหรับ Development",
        "Integration Test ทุก Sprint",
        "Fallback Strategy เมื่อ Legacy ล่ม",
    ], "5 Man-days", "Sprint 1-3", "Integration Success Rate > 99%"),
]

for plan in plans:
    planner.add(plan)

planner.show_all()
planner.strategy_guide()

Monte Carlo Simulation

# monte_carlo.py — Monte Carlo Risk Simulation
import numpy as np

def monte_carlo_schedule(tasks, simulations=10000):
    """Monte Carlo Simulation สำหรับ Schedule Risk"""
    np.random.seed(42)
    results = []

    for _ in range(simulations):
        total_days = 0
        for task_name, (optimistic, likely, pessimistic) in tasks.items():
            # PERT Distribution
            mean = (optimistic + 4 * likely + pessimistic) / 6
            std = (pessimistic - optimistic) / 6
            duration = max(optimistic, np.random.normal(mean, std))
            total_days += duration
        results.append(total_days)

    results = np.array(results)

    print(f"\n{'='*55}")
    print(f"Monte Carlo Schedule Simulation ({simulations:,} runs)")
    print(f"{'='*55}")
    print(f"  Min Duration: {np.min(results):.0f} days")
    print(f"  Max Duration: {np.max(results):.0f} days")
    print(f"  Mean: {np.mean(results):.0f} days")
    print(f"  Median: {np.median(results):.0f} days")
    print(f"  Std Dev: {np.std(results):.0f} days")

    percentiles = [50, 75, 85, 90, 95]
    print(f"\n  Confidence Levels:")
    for p in percentiles:
        val = np.percentile(results, p)
        print(f"    P{p}: {val:.0f} days ({p}% confidence)")

    return results

# ตัวอย่าง Tasks (Optimistic, Most Likely, Pessimistic) ในวัน
tasks = {
    "Requirements": (5, 10, 20),
    "UI/UX Design": (10, 15, 25),
    "Backend Development": (20, 30, 50),
    "Frontend Development": (15, 25, 40),
    "Integration": (5, 10, 20),
    "Testing": (10, 15, 25),
    "Deployment": (3, 5, 10),
}

print("Project Tasks (O, M, P):")
for task, (o, m, p) in tasks.items():
    expected = (o + 4*m + p) / 6
    print(f"  {task:<25} O={o:>2}, M={m:>2}, P={p:>2} -> E={expected:.0f} days")

results = monte_carlo_schedule(tasks)

Best Practices

  • Risk Register: สร้างและอัปเดต Risk Register ตลอดโครงการ
  • Weekly Review: ทบทวนความเสี่ยงทุกสัปดาห์ในทีม
  • Risk Owner: กำหนดผู้รับผิดชอบทุกความเสี่ยง
  • Contingency Budget: สำรองงบ 10-15% สำหรับความเสี่ยง
  • Lessons Learned: บันทึกบทเรียนสำหรับโครงการถัดไป
  • Monte Carlo: ใช้ Simulation ประเมิน Schedule Risk โครงการใหญ่

ความเสี่ยงในโครงการมีกี่ประเภท

Technical Schedule Cost Resource Scope Quality External Communication แต่ละประเภทต้องมีแผนรับมือแตกต่างกัน

แนะนำเพิ่มเติม — คอร์สเทรด Forex ที่ iCafeForex

เนื้อหาเกี่ยวข้อง — แนะนำให้อ่าน OpenTelemetry Collector Zero Downtime Deployment

XM Legend · เทรดเดอร์ & ผู้สอน Forex 13 ปี

ผู้ก่อตั้ง SiamCafe ตั้งแต่ปี 1997 · เทรดเดอร์สาย Forex มากกว่า 13 ปี ได้รับการยกย่องเป็น XM Legend · แบ่งปันความรู้ Forex, ไอที, AI และการเทรด จากประสบการณ์จริงในตลาดจริง