Program design tools
도입됨
19:05
프로그래밍 개발 수명 주기
아주 작은 버그라도 출시될 때까지 발견되지 않으면 수정하는 데 큰 비용이 들 수 있습니다. 일찍 발견할 때보다 훨씬 더 많이 듭니다. 그래서 우리는 바로 코드를 입력하기 시작하지 않습니다. 우리는 …을 따릅니다
영어 내레이션 · 영어와 중국어 자막 전환 가능
이 수업의 내용
| English | 의미 |
|---|---|
| software engineering/ˈsɒftweə ˌendʒɪˈnɪərɪŋ/ | The planned work of making software that works well and is easy to manage. |
| code/kəʊd/ | Instructions written in a programming language for a computer to follow. |
| design stage | The stage of development that decides how a program will meet its requirements. |
| structure chart/ˈstrʌktʃə tʃɑːt/ | 구조도 |
| state-transition diagram/steɪt trænˈsɪʃn ˈdaɪəɡræm/ | 상태 전이도 |
| pseudocode/ˈsuːdəʊkəʊd/ | 가짜 코드 |
| Analysis/əˈnæləsɪs/ | The stage of development that identifies what a program must do. |
| data structures/ˈdeɪtə ˈstrʌktʃəz/ | A way of organising and storing data to support particular operations. |
| algorithms/ˈælɡərɪθəmz/ | A finite sequence of precise steps for solving a problem or carrying out a task. |
| modules/ˈmɒdjuːlz/ | Separately organised program components that perform defined tasks and communicate through interfaces. |
| interface/ˈɪntəfeɪs/ | A way for users or programs to communicate with the computer's hardware. |
| flowchart/ˈfləʊtʃɑːt/ | A diagram showing the sequence of steps and decisions in a process or algorithm. |
| logic/ˈlɒdʒɪk/ | The order of steps and decisions used to solve a problem. |
| transition/trænˈsɪʃn/ | A change from one state to another, caused by an event. |
| decomposition/ˌdiːkɒmpəˈzɪʃn/ | 분해 |
| subroutines/ˈsʌbruːtiːnz/ | 서브루틴 |
| parameters/pəˈræmɪtəz/ | parameters: 매개변수 |
| top-down design/tɒp daʊn dɪˈzaɪn/ | 상향식 설계 |
| caller/ˈkɔːlə/ | The program or module that asks another module to run. |
| selection/sɪˈlekʃn/ | Choosing which branch of instructions to execute according to a condition. |
| loop/luːp/ | A structure that repeats a sequence of instructions. |
| Hierarchy/ˈhaɪərɑːki/ | An arrangement of modules in levels showing which modules call others. |
| return value/rɪˈtɜːn ˈvæljuː/ | The value a function passes back to the part of the program that called it. |
| header/ˈhedə/ | The first line of a subroutine, stating its name, parameters and any return type. |
| array/əˈreɪ/ | An indexed collection of elements arranged in one or more dimensions. |
| main program | The top-level part of a program that controls its overall tasks and calls subroutines. |
| procedure/prəˈsiːdʒə/ | A named sequence of instructions that performs a task when called. |
| function/ˈfʌŋkʃn/ | A mapping that assigns exactly one output to each allowed input. |
| passing modes | Ways of passing parameters that determine how a subroutine can use or change data. |
| states/steɪts/ | 상태 |
| events/ɪˈvents/ | An occurrence detected by a program that can trigger a response. |
| action/ˈækʃn/ | Something a system does when an event causes a change of state. |
| start state | The state a system is in when it begins operating. |
| user interface/ˈjuːzə ˈɪntəfeɪs/ | The controls, displays and interaction mechanisms through which a person communicates with a computer system or program. |
| submodules | Smaller modules that carry out parts of the work of a larger module. |
소프트웨어가 공학이 된 해
- 1968년 10월, 세계 최고의 프로그래머 50명이 독일 가르미치(Garmisch)에 모여 대형 프로그램 실패 원인(지연, 예산 초과, 신뢰성 부족)을 논의했습니다. 그들은 결여된 것을 지칭하는 용어를 만들었는데, 그것이 바로 소프트웨어 엔지니어링(Software Engineering) 입니다.
- 불만 사항은 간단했습니다. 건축가는 건축 전에 도면을 그립니다. 엔지니어는 절단 전에 계산합니다. 그러나 프로그래머들은 아무도 프로그램의 도면을 그리기 전에 이미 코드를 타이핑하고 있었습니다.
- 그 decade 동안 탄생한 도면들이 바로 설계 단계에서 사용할 것들입니다. 프로그램이 부분으로 어떻게 분할되는지를 보여주는 구조도(structure chart) 와 프로그램이 어떻게 동작하는지를 보여주는 상태 전이 도표(state-transition diagram) 입니다.
- 이 수업에서는 이 도면들을 읽는 방법, 구성하는 방법, 그리고 구조도를 가짜 코드로 변환하는 방법을 다룹니다.
설계가 결정하는 것
- 분석(Analysis)은 프로그램이 무엇(what) 을 해야 하는지 설명했습니다. 설계(Design)는 어떻게(how) 를 결정합니다: 데이터 구조, 알고리즘, 모듈 및 인터페이스.
- 설계 단계에서는 프로그래머가 코딩할 수 있는 도면을 생성합니다: 하나의 알고리즘 논리를 위한 플로우차트, 텍스트로 같은 내용을 표현한 가상코드, 모듈들을 위한 구조 차트, 그리고 동작을 위한 상태 전이도입니다.
- 각 도구들은 서로 다른 질문에 답하며, 시험에서는 어떤 도구가 적합한지 묻습니다.
코딩하기 전에 그려진 단일 알고리즘의 논리
Software process lab
Classify development examples by the stage or tool they belong to.
구조도(structure chart)
- 구조도(structure chart) 는 프로그램이 모듈, 서브루틴(subroutines), 그리고 모듈 간에 전달되는 매개변수(parameters) 로서 계층적으로 분해(decomposition) 되는 과정을 보여줍니다. 이러한 상향식 설계(top-down design) 는 하나의 큰 문제를 작은 하위 문제로 나누며, 각 하위 문제는 하나의 모듈이 됩니다.
- 각 모듈은 직사각형입니다. 위쪽의 호출자(caller)와 아래쪽의 호출받는 모듈을 연결하는 선이 있습니다. 같은 레벨의 모듈들은 왼쪽에서 오른쪽 순서로 호출됩니다.
- 선 옆의 작은 화살표는 데이터를 나타냅니다: 모듈로 하향 전달되는 매개변수, 호출자로 상향 반환되는 결과입니다. 마름모꼴은 선택을, 곡선 화살표는 루프를 나타냅니다.

선에는 계층 구조, 화살표에는 데이터

A structure chart shows:
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
A structure chart is the hierarchical breakdown into modules, with parameters down and results up.
Breaking a problem into modules from the top down is called:
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Top-down design produces a modular solution.
worked example: 차트에서 서명(signatures) 읽기
CalculatePay
/ | \
GetEmployee CalculateBonus CalculateTax
returns: takes: sales takes: gross
employeeID returns: bonus returns: tax
GetEmployee은 아무것도 받지 않고 직원 ID를 반환합니다:FUNCTION GetEmployee() RETURNS INTEGER.CalculateBonus은 판매 금액을 하향으로 받아 보너스를 상향으로 보내므로:FUNCTION CalculateBonus(Sales : REAL) RETURNS REAL.CalculateTax은 총급여(gross pay)를 받아 세금(tax)을 반환합니다. 차트의 모든 화살표는 헤더에 있는 매개변수나 반환 값입니다. 차트에 표시되지 않은 매개변수가 포함된 헤더는 틀린 것입니다.
On a structure chart, a small arrow pointing down from the caller into a module shows a ____ passed to it.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Downward arrows are parameters going in; upward arrows are results returned. Together they give the module's header.
worked example: 구조도(structure chart) 만들기
- 프로그램이 학생의 성적을 입력받아 평균을 계산하고 등급을 출력합니다. 구조도를 그려보세요.
- 최상위 모듈:
ProcessStudent. 그 아래 왼쪽부터 오른쪽으로: 점수 배열을 반환하는ReadMarks, 점수 배열을 하향 받아 평균을 반환하는CalculateAverage, 평균을 하향 받아 아무것도 반환하지 않는OutputGrade. - 세 가지 요점이 점수를 받습니다: 상위에 주 임무를 배치한 계층 구조, 실행 순서에 따른 하위 작업, 그리고 올바른 방향으로 향하는 명명된 매개변수. 레이블이 없는 화살표는 최대 반점까지_GET_합니다.

구조도(structure chart)에서 가짜 코드(pseudocode)로
- 최상위 모듈이 메인 프로그램이 되고, 그 아래 직사각형들은 화살표를 통해 헤더를 읽은 프로시EDURE 또는 함수가 되어, 메인 프로그램은 왼쪽에서 오른쪽 순서로 이를 호출합니다.
PROCEDURE ProcessStudent()
DECLARE Marks : ARRAY[1:10] OF INTEGER
DECLARE Average : REAL
Marks ← ReadMarks()
Average ← CalculateAverage(Marks)
CALL OutputGrade(Average)
ENDPROCEDURE
- 반환되는 값이 있다면 이는 **
FUNCTION … RETURNS**이며, 아무것도 반환하지 않는 모듈은 **PROCEDURE**입니다. 매개변수 목록은 정확히 아래쪽 화살표들입니다.
Put the steps of designing a program with a structure chart in order.
난이도 3/5 · 200코인 + 오늘 첫 완료 시 작은 보너스 추가
Top down: task, sub-tasks, data flow, headers, calls. The chart is finished before the first line of code.
A module whose result is returned for use in an expression should be written as a PROCEDURE.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
A value returned for use in an expression requires a FUNCTION … RETURNS. A PROCEDURE can pass results back through BYREF parameters.
상태 전이 도표(state-transition diagram)
- 상태 전이 도표(state-transition diagram) 은 시스템의 동작(behaviour) 을 문서화합니다: 시스템이 가질 수 있는 상태(states) 와 한 상태에서 다른 상태로 이동시키는 이벤트(events).
- 각 상태는 원이나 둥근 사각형이며, 각 전이(transition)는 이를 유발하는 이벤트로 레이블이 붙은 화살표입니다. 때로는 취해진 action도 함께 표기합니다. 마커(start marker)는 시작 상태를 나타냅니다.
- 이벤트 대기 중이면서 반응하는 시스템에 적합합니다: 자판기, 신호등, 문 잠금 장치, 사용자 인터페이스.

모든 상태, 모든 이벤트, 모든 화살표

A state-transition diagram shows:
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
States are circles; transitions are event-labelled arrows. Ideal for vending machines, locks, traffic lights.
What does a state-transition diagram show? Select 모든 that apply.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
States, labelled transitions and the start marker. Timing is not part of the diagram.
worked example: 도어락 다이어그램 읽기
- 잠금장치는 코드 2, 5, 9에서 열립니다. 잠금(Locked) 상태에서 시작합니다. 2를 누르면 *하나의 숫자만 맞음(One digit correct)*으로 이동하고, 그 상태에서 5를 누르면 *두 개의 숫자가 맞음(Two digits correct)*으로 이동하며, 마지막으로 9를 누르면 *해제(Unlocked)*됩니다.
- 대기 상태 중 어느 상태에서도 다른 키를 누르면 다시 *잠금(Locked)*으로 돌아갑니다: 도표에는 이러한 화살표도 표시되어 있으며, 이들을 생략하면 도표에 빈틈이 생깁니다. 해제(Unlocked) 상태에서 2를 누르면 어떻게 됩니까? 화살표에 명시된 내용이 없다면, 이는 설계 단계에서 결정되지 않았음을 의미합니다.
- 바로 이것이 도표가 필요한 이유입니다: 모든 상태는 각 이벤트 발생 시 어떤 일이 일어나는지 명시해야 하므로, 누락된 전이(transitions)는 사용자에게 맡기기보다 문서상에서 미리 확인되어야 합니다.

A state-transition diagram makes missing or unhandled transitions easy to spot, because every state and the events between them are laid out.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Seeing every state and event reveals cases you have not handled — e.g. an unexpected second coin in a vending machine.
도구 선택
- 프로그램이 모듈로 분리되고 그들 사이에서 무엇이 전달되는지를 보여줄 때: 구조도(structure chart).
- 시스템이 이벤트에 대응하여 시간에 따라 어떻게 작동하는지, 특히 모드(mode)를 가진 기계나 인터페이스의 경우를 보여줄 때: 상태 전이 도표(state-transition diagram).
- 하나의 알고리즘에 대한 **단계별 논리(step-by-step logic)**를 보여줄 때: 흐름도(flowchart) 또는 가상의코드(pseudocode). 어떤 것을 사용해야 하며 그 이유를 설명하십시오.

Match each design tool to what it shows.
난이도 2/5 · 140코인 + 오늘 첫 완료 시 작은 보너스 추가
Each tool views the design differently — structure (modules), behaviour (states), flow (flowchart) or steps (pseudocode).
A traffic-light controller must respond to a timer and a pedestrian button. Which design tool documents its behaviour best?
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
Red, red-and-amber, green, amber are states; the timer and the button are events. A structure chart would show the modules, not the behaviour.
놓칠 수 있는 점
- 구조도는 흐름도가 아닙니다. 모듈 내부의 의사결정 순서를 보여주는 것이 아니라 계층(hierarchy)과 매개변수(parameters)를 나타냅니다.
- 모든 화살표에 매개변수나 결과물의 이름을 붙이고 올바른 방향으로 향하게 하십시오. 이름이 없는 단순한 화살표는 아무런 의미를 가지지 않습니다.
- 상태는 시스템이 대기 중인 조건이며, 이벤트는 시스템에 일어나는 일입니다. "5 누르기"는 상태가 아닌 이벤트입니다.
- 가상의코드 헤더들은 도표와 일치해야 합니다: 동일한 매개변수, 동일한 반환 값, 동일한 호출 순서여야 합니다.
이해했습니다
- **구조도(structure chart)**는 상하분해(top-down decomposition)를 통해 모듈로 나누어 주며, 매개변수는 아래로 전달되고 결과물은 레이블이 있는 화살표를 통해 위로 반환됩니다.
- 가상의코드 헤더를 도표에서 읽으십시오: 아래쪽 화살표는 매개변수 목록이며, 위쪽 화살표는 이를
FUNCTION … RETURNS으로 만들며, 메인 모듈은 왼쪽에서 오른쪽으로 호출합니다. - **상태 전이 도표(state-transition diagram)**는 **상태(states)**와 그들 사이를 이동시키는 **이벤트(events)**를 보여주며, 아직 결정되지 않은 전이(transitions)를 드러냅니다.
- 분해(decomposition) → 구조도; 동작(behaviour) → 상태 전이 도표; 단일 알고리즘의 논리 → 흐름도 또는 가상의코드
어떤 문제가 있었나요? 사이트 팀만 이 내용을 볼 수 있습니다.