본문 바로가기

장 실습: 변경 하나의 계획 기록

phone 추가에 따른 기능점수, 추정, 일정, 확인 기록을 한 파일로 모아 변경 계획을 검토합니다.

이 장에서 만든 조각을 하나의 결과로 모읍니다. 완성 파일을 열기 전에 직접 작성하고 체크포인트마다 기대 결과와 비교합니다.

시작 상태

범위에서 기능점수까지의 reading-lab/examples/ch8-4.mjs를 준비합니다. 앞 세 글에서 만든 작업 목록, threePoint, schedule, criticalPath를 함께 씁니다. 실행 위치는 reading-lab입니다.

명령은 reading-lab 폴더에서 실행합니다.

완성할 과제

진행자가 "신청할 때 전화번호 phone도 받자"고 요청했습니다. 이 변경 하나에 이 장의 계산을 모두 모아 계획 기록을 만드세요. ch8-4.mjs를 그대로 복사해 reading-lab/examples/ch8-plan.mjs로 저장하고, 그 끝에 코드를 더해 다음을 차례로 출력합니다.

  • 규모: 변경 전후의 UFP와 등급이 바뀐 기능
  • 추정: 아래 네 작업의 세 점 추정 기대값과 폭(소수 둘째 자리)
  • 일정: 기대값을 기간으로 쓴 완료 시각과 임계 경로
  • 확인: 확인 기록이 없는 작업과, 스스로 확인한 작업
아이디이름선행 작업낙관, 보통, 비관만드는 사람 / 확인하는 사람확인 기록
Aphone 정책 합의없음0.5, 1, 1.5업무 담당 / 진행자진행자 승인 기록
B신청에 phone 받기A1, 1.5, 5개발자 / 코드 검토자없음
C안내 문구 고치기A0.5, 1, 1.5문서 담당 / 사용자없음
D회귀·인수 확인B, C1, 1, 7테스트 담당 / 테스트 담당없음

힌트: 다른 예제 파일을 import하면 그 파일의 출력까지 실행되므로, ch8-2.mjs의 threePoint, ch8-3-slack.mjs의 schedule과 연습 문제의 criticalPath는 이 파일로 옮겨 적습니다. 규모는 이미 있는 clubFunctions와 changed를 비교하고, 확인은 작업 분해와 역할 연습 문제의 두 filter를 씁니다. threePoint(...item.estimate)처럼 펼침 구문으로 배열의 세 값을 인수로 넘길 수 있습니다.

단계별 체크포인트

체크포인트 1: 규모 변경 추적하기

ch8-4.mjs를 복사한 뒤 변경 전후를 비교합니다. UFP는 25에서 26, 등급이 바뀐 기능은 register 하나인지 확인합니다.

체크포인트 2: 기대값으로 일정 만들기

A~D 작업을 선행 순서로 넣습니다. 기대값은 1, 2, 1, 2이고 완료 시각은 5, 임계 경로는 A → B → D인지 확인합니다.

체크포인트 3: 확인 기록을 계획에 붙이기

확인 기록이 없는 작업 B, C, D와 스스로 확인한 D를 따로 출력합니다. D의 확인자와 비관 값의 이유를 검토합니다.

다를 때 먼저 볼 곳

증상다를 때 먼저 볼 곳
함수나 변수가 정의되지 않음ch8-4.mjs의 계산 코드와 세 함수를 모두 옮겼는지 확인합니다.
선행 순서 오류work에서 A가 B·C보다, B·C가 D보다 앞인지 확인합니다.
완료 시각이나 임계 경로가 다름기간에 보통 값이 아닌 threePoint의 expected를 썼는지 확인합니다.

완성 파일

완성 파일과 결과 확인하기

기능점수 계산부터 계획 기록까지 모은 완성 파일입니다.

reading-lab/examples/ch8-plan.mjs
const weights = {
  ILF: [7, 10, 15],
  EIF: [5, 7, 10],
  EI: [3, 4, 6],
  EO: [4, 5, 7],
  EQ: [3, 4, 6],
};
const matrix = [
  [0, 0, 1],
  [0, 1, 2],
  [1, 2, 2],
];
const levels = ["낮음", "보통", "높음"];
const band = (value, firstMax, secondMax) => (value <= firstMax ? 0 : value <= secondMax ? 1 : 2);

function requireCount(value, minimum, name) {
  if (!Number.isSafeInteger(value) || value < minimum) {
    throw new TypeError(`${name} must be an integer >= ${minimum}`);
  }
}

function classify(fn) {
  if (!Object.hasOwn(weights, fn.type)) throw new TypeError("unknown function type");
  requireCount(fn.det, 1, "DET");
  let row;
  let column;
  if (fn.type === "ILF" || fn.type === "EIF") {
    requireCount(fn.ret, 1, "RET");
    row = band(fn.ret, 1, 5);
    column = band(fn.det, 19, 50);
  } else if (fn.type === "EI") {
    requireCount(fn.ftr, 0, "FTR");
    row = band(fn.ftr, 1, 2);
    column = band(fn.det, 4, 15);
  } else {
    requireCount(fn.ftr, fn.type === "EQ" ? 1 : 0, "FTR");
    row = band(fn.ftr, 1, 3);
    column = band(fn.det, 5, 19);
  }
  const index = matrix[row][column];
  return { level: levels[index], weight: weights[fn.type][index] };
}

function measure(functions) {
  return functions.reduce((sum, fn) => sum + classify(fn).weight, 0);
}

const clubFunctions = [
  { id: "club-record", type: "ILF", det: 8, ret: 2 },
  { id: "eligibility", type: "EIF", det: 3, ret: 1 },
  { id: "register", type: "EI", det: 4, ftr: 2 },
  { id: "cancel", type: "EI", det: 4, ftr: 1 },
  { id: "summary-ratio", type: "EO", det: 6, ftr: 1 },
  { id: "title-lookup", type: "EQ", det: 4, ftr: 1 },
];
for (const fn of clubFunctions) {
  const { level, weight } = classify(fn);
  console.log(fn.id, fn.type, level, weight);
}
console.log("UFP:", measure(clubFunctions));

const changed = clubFunctions.map((fn) =>
  fn.id === "register" ? { ...fn, det: 5 } : fn.id === "club-record" ? { ...fn, det: 9 } : fn,
);
console.log("phone 추가 뒤 UFP:", measure(changed));

function threePoint(optimistic, mostLikely, pessimistic) {
  const expected = (optimistic + 4 * mostLikely + pessimistic) / 6;
  const spread = (pessimistic - optimistic) / 6;
  return { expected, spread };
}

function schedule(tasks) {
  const times = new Map();
  for (const task of tasks) {
    if (task.after.some((id) => !times.has(id))) throw new Error("tasks must be in dependency order");
    const es = Math.max(0, ...task.after.map((id) => times.get(id).ef));
    times.set(task.id, { es, ef: es + task.duration });
  }
  const duration = Math.max(...[...times.values()].map((time) => time.ef));
  for (const task of [...tasks].reverse()) {
    const successors = tasks.filter((other) => other.after.includes(task.id));
    const lf = successors.length ? Math.min(...successors.map((other) => times.get(other.id).ls)) : duration;
    const time = times.get(task.id);
    Object.assign(time, { ls: lf - task.duration, lf, slack: lf - task.duration - time.es });
  }
  return { duration, times };
}

function criticalPath(tasks, times) {
  return tasks.filter((task) => times.get(task.id).slack === 0).map((task) => task.id);
}

console.log("--- phone 변경 계획 ---");
console.log("UFP:", measure(clubFunctions), "→", measure(changed));
clubFunctions.forEach((fn, i) => {
  const oldLevel = classify(fn).level;
  const newLevel = classify(changed[i]).level;
  if (oldLevel !== newLevel) console.log("등급이 바뀐 기능:", fn.id, oldLevel, "→", newLevel);
});

const work = [
  { id: "A", name: "phone 정책 합의", after: [], estimate: [0.5, 1, 1.5], maker: "업무 담당", checker: "진행자", checked: "진행자 승인 기록" },
  { id: "B", name: "신청에 phone 받기", after: ["A"], estimate: [1, 1.5, 5], maker: "개발자", checker: "코드 검토자", checked: "" },
  { id: "C", name: "안내 문구 고치기", after: ["A"], estimate: [0.5, 1, 1.5], maker: "문서 담당", checker: "사용자", checked: "" },
  { id: "D", name: "회귀·인수 확인", after: ["B", "C"], estimate: [1, 1, 7], maker: "테스트 담당", checker: "테스트 담당", checked: "" },
];
const tasks = [];
for (const item of work) {
  const { expected, spread } = threePoint(...item.estimate);
  console.log(item.id, item.name, "기대", expected.toFixed(2), "폭", spread.toFixed(2));
  tasks.push({ id: item.id, duration: expected, after: item.after });
}

const { duration, times } = schedule(tasks);
console.log("완료 시각:", duration);
console.log("임계 경로:", criticalPath(tasks, times).join(" → "));

const unchecked = work.filter((item) => !item.checked.trim()).map((item) => item.id);
const selfChecked = work.filter((item) => item.maker === item.checker).map((item) => item.id);
console.log("확인 기록이 없는 작업:", unchecked.join(", "));
console.log("스스로 확인한 작업:", selfChecked.join(", "));

node examples/ch8-plan.mjs로 실행해 ch8-4.mjs의 출력 뒤에 다음이 나오면 완성입니다.

--- phone 변경 계획 ---
UFP: 25 → 26
등급이 바뀐 기능: register 낮음 → 보통
A phone 정책 합의 기대 1.00 폭 0.17
B 신청에 phone 받기 기대 2.00 폭 0.67
C 안내 문구 고치기 기대 1.00 폭 0.17
D 회귀·인수 확인 기대 2.00 폭 1.00
완료 시각: 5
임계 경로: A → B → D
확인 기록이 없는 작업: B, C, D
스스로 확인한 작업: D

forEach는 항목마다 함수를 부르며 둘째 인수로 위치 번호 i를 넘기고, tasks.push는 배열의 끝에 항목을 더합니다. 일정은 A 01, B 13, C 12, D 35가 되고 C만 여유가 1이라 임계 경로는 A→B→D입니다.

규모는 1점 늘었을 뿐이지만 D는 폭이 가장 넓고, 임계 경로 위에 있으며, 스스로 확인합니다. 그러니 계획을 확정하기 전에 D의 확인자를 바꾸고 비관 값이 7인 이유를 위험 목록에 올립니다. 출력이 다르면 work가 선행 작업 순서대로인지, 옮겨 적은 함수 이름이 맞는지부터 봅니다.

더 해 보기

  • D의 확인자를 진행자로 바꾸어 스스로 확인한 작업 목록이 비는지 확인합니다.
  • 위험 하나를 risk, trigger, owner 속성을 가진 객체로 더해 함께 출력합니다.

크기, 구현의 어려움, 학습자의 이해도는 서로 다른 측정 대상이며, 어떤 숫자든 그 정의와 범위, 판본을 함께 남겨야 합니다. 다음 장의 품질 요구와 평가 모델에서는 소프트웨어의 품질을 무엇으로 정의하고 어떻게 평가하는지 다룹니다.