跳到主要内容

软件开发

A-Level 计算机科学知识点 12

本主题的视频课程 打开视频页面
19:05

程序开发生命周期

一个微小的 Bug 如果泄露到发布版本,修复成本将十分高昂——远大于早期发现时的代价。这就是为什么我们不仅仅开始输入代码。我们遵循……

英文讲解 · 可切换中英文字幕

12.1

程序开发生命周期

教学大纲
考生应能: 注释与指导
理解开发生命周期的目的
理解根据所开发程序的不同,需要采用不同的开发生命周期 包括:瀑布模型、迭代模型、快速应用开发(RAD)
描述每种类型生命周期的原则、优点和缺点
理解程序开发生命周期中的分析、设计、编码、测试和维护阶段

来源:Cambridge International 教学大纲

English

A development life cycle 开发生命周期 is the set of stages from idea to finished, maintained software. It exists to plan, manage and control a project — to build the right product, on time, with good quality.

A software team collaborating around a table
Software is built by teams who follow a development life cycle to stay coordinated
A flowchart with terminators, process boxes and decision diamonds
A flowchart plans a program's logic during the design stage of the cycle

Why a life cycle is needed

The examiner's list for "the purpose of a development life cycle": it breaks a large project into stages that can be planned and managed; it makes sure the requirements are found and agreed before design and coding begin; it builds in testing and documentation rather than leaving them to the end; it lets the team track progress against milestones and manage risk; and it gives the customer defined points at which to review the work. Without one, a team codes first and discovers late that it built the wrong thing.

Why there are different ones

No single life cycle fits every project, so several development life cycles exist. The choice depends on the size and complexity, how clear the requirements 需求 are at the start, how much change is expected, the risk level, the team, and the deadline.

Common models

  • Waterfall 瀑布模型 — a linear sequence (Analysis → Design → Coding → Testing → Maintenance), each stage finished before the next. Clear and well-documented; good for stable requirements, but poor at coping with mid-project change, and the customer sees nothing working until the end.
  • Iterative model 迭代模型 — repeated passes, each producing a partial version that is reviewed and refined. Catches problems earlier; good when requirements are discovered over time, but harder to estimate.
  • Rapid Application Development 快速应用开发 (RAD) — heavy use of a prototype 原型 and user feedback. Very fast first delivery; good for changing requirements, but depends on user availability and suits smaller systems.
  • Agile 敏捷 — short iterations ("sprints"), constant collaboration and testing. Flexible and adaptive, but needs a committed customer and a skilled team.
Five boxes (Analysis, Design, Coding, Testing, Maintenance) cascading down, each leading to the next
The waterfall model: each stage is finished before the next begins
A Design-Build-Test-Review cycle with a repeat loop back to Design, and version bars growing taller each pass until complete
The iterative model: repeated passes refine the program
Three parts built in parallel as prototypes that refine with user feedback, then combine into the final system
Rapid application development: teams work on parts in parallel

Principles, benefits and drawbacks — as the mark scheme lists them.

Model Principle Benefits Drawbacks
waterfall the stages run in a fixed order, each completed and signed off before the next starts; going back means restarting the sequence simple to manage; every stage is fully documented; requirements are fixed early, so costs and dates can be estimated inflexible once a stage is finished; no working software until late; a mistake in analysis is expensive to fix later; the customer cannot see progress
iterative a small working version is built first, then repeatedly improved through further versions until complete working software early and often; problems found in early versions; the customer's feedback shapes each version; requirements can change hard to estimate the total time and cost; repeated testing costs effort; needs the customer to be available; can drift if versions are not planned
RAD prototypes of parts of the system are built quickly and refined with the user until accepted, often in parallel by several teams very fast delivery of a first version; the user is involved throughout, so the product fits their needs; changes are easy to absorb needs skilled developers and committed users; documentation is weak; less suited to large or safety-critical systems

Worked example. A company must be the first to launch a website for a new games console, and the design will change as the console's features are announced. Name the most suitable life cycle and justify it.

RAD. A prototype of the site can be built and shown to the users within days, and refined as the requirements change; the site is small enough for a prototype-driven approach, and speed of delivery is the main requirement. Waterfall would fix the requirements before any page was built and deliver nothing until the end.

The standard stages

Each stage has a purpose, an output and typical activities — a "describe the … stage" question wants two or three of these.

Four stages in a row — analysis, design, coding, testing — with an arrow feeding back from testing to design
The four stages of program development; testing feeds back to fix and refine the design
  • analysis — find out what the program must do. Activities: interviews, questionnaires and observation of the current system; a feasibility study; agreeing the requirements specification, which every later stage is checked against.
  • design — decide how it will do it. Outputs: the structure chart (modules and parameters), flowcharts or pseudocode for each module, identifier tables and data structures, screen and file layouts, and the test plan written now, from the specification, before any code exists.
  • coding (implementation 实现) — write the program in a high-level language, module by module, following the design; each module is tested as it is written.
  • testing — run the program against the test plan (normal, abnormal, extreme and boundary data) and correct the errors found; integration, alpha, beta and acceptance testing follow.
  • maintenance 维护 — after release, correct faults, adapt the program to new hardware, software or law, and improve it (see below).

Worked example. Complete the waterfall diagram Analysis → ? → ? → ? → Maintenance and describe what happens at the design stage.

The missing stages are Design, Coding, Testing. At the design stage the requirements are turned into a plan for the program: the problem is decomposed into modules (a structure chart), the algorithm for each module is written as pseudocode or a flowchart, the data structures and identifiers are chosen, the screens and files are laid out, and the test plan is written from the specification.

探索

程序开发生命周期

逐步走过每个项目经历的阶段。在分析中把需求弄对最重要——一个在测试中抓住的错误,比一个早抓住的修复起来贵得多。

探索

软件过程实验

根据阶段或所属工具对开发示例进行分类。

词汇 训练
English 中文 拼音
development life cycle/dɪˈveləpmənt laɪf ˈsaɪkl/ 开发生命周期 kāi fā shēng mìng zhōu qī
requirements/rɪˈkwaɪəmənts/ 需求 xū qiú
waterfall/ˈwɔːtəfɔːl/ 瀑布模型 pù bù mó xíng
maintenance/ˈmeɪntənəns/ 维护 wéi hù
iterative model/ˈɪtərətɪv ˈmɒdl/ 迭代模型 dié dài mó xíng
Rapid Application Development/ˈræpɪd ˌæplɪˈkeɪʃn dɪˈveləpmənt/ 快速应用开发 kuài sù yìng yòng kāi fā
prototype/ˈprəʊtəʊtaɪp/ 原型 yuán xíng
Agile/ˈædʒaɪl/ 敏捷 mǐn jié
implementation/ˌɪmplɪmənˈteɪʃn/ 实现 shí xiàn
12.2

程序设计

教学大纲
考生应能: 注释与指导
使用结构图将问题分解为子任务,并表达作为算法设计一部分的各个模块/过程/函数之间传递的参数 描述结构图的用途
为给定问题构建结构图
从结构图导出等价的伪代码
展示对状态转换图用于记录算法这一目的的理解

来源:Cambridge International 教学大纲

English

Structure chart

A structure chart 结构图 shows the hierarchical decomposition 分解 of a program into modules (subroutines 子程序) and the parameters 参数 passed between them. Each module is a rectangle; lines link caller (above) to callee (below); small arrows show data going down and results coming back up. The design can then be turned into equivalent pseudocode 伪代码.

                CalculatePay
            /        |         \
       GetEmployee  CalculateBonus  CalculateTax
       Returns:     Takes: sales    Takes: gross
       employeeID   Returns: bonus  Returns: tax

It is a design-stage tool, and you can read the procedure signatures off it.

A structure chart with Convert temperature at the top and INPUT, Convert to Celsius and OUTPUT modules below, with temperature parameters on the links
A structure chart: modules with the parameters passed between them

The symbols the examiner asks about. A box is a module; a line links a caller (above) to the modules it calls (below), read left to right in the order they are called. A small arrow with an open circle at its tail is a data couple — a parameter passed down into a module or a value returned up; an arrow with a filled circle is a control couple, a flag (usually BOOLEAN) that passes control information between modules, for example to determine the action a called module performs. A diamond at a branch means selection: only one of the modules below it is called, depending on a condition. A curved arrow sweeping across the links means iteration: the modules under it are called repeatedly in a loop.

A structure chart showing every symbol: module boxes, calling lines, an open-circle data couple carrying item ID down, a filled-circle control couple returning an in-stock flag up, a diamond selecting between Print invoice and Reject order, and a curved arrow marking the modules repeated for each order
The structure-chart symbols: data and control couples, a selection diamond and an iteration arrow

Worked example. Four modules are defined as PROCEDURE Main(), PROCEDURE ReadData(BYREF Count : INTEGER), FUNCTION IsValid(Value : INTEGER) RETURNS BOOLEAN and PROCEDURE Report(Total : INTEGER, Count : INTEGER). Main calls ReadData, then calls IsValid once for each value read, then calls Report. Describe the structure chart.

Main at the top; ReadData, IsValid and Report in a row beneath it, left to right in calling order. On the ReadData link an upward data couple Count (a BYREF parameter comes back). On the IsValid link a downward data couple Value and an upward control couple (the BOOLEAN result), with a curved iteration arrow across that link because it is called for each value. On the Report link two downward data couples, Total and Count. Reading the other way, a function is any module that returns a value — its header needs RETURNS and the returned type.

State-transition diagram

A state-transition diagram 状态转换图 shows the states 状态 a system can be in and the events that move it between them — good for vending machines, traffic lights, user interfaces. State-transition diagrams are used to document the behaviour of an algorithm or system. Each state is a circle; each transition is an arrow labelled with the event.

   coin inserted               item selected
[Idle] --------------→ [Awaiting selection] ----------→ [Dispensing]

It makes missing transitions easy to spot ("what if a second coin is inserted while awaiting selection?").

A state diagram: Locked to Waiting for second digit to Waiting for third digit to Unlocked, with correct-digit and wrong-digit transitions
A state-transition diagram for a door lock with code 259

Reading and drawing one. Each transition is labelled input | output (or condition | action): what happened, then what the system does as it changes state. A question gives a table of current state, input, output, next state and asks for the diagram, or the reverse — every row of the table is exactly one arrow. Check that every state has an arrow leaving it for every input that can occur, including the ones that leave the state unchanged (an arrow that loops back to the same state).

Worked example. A pump controller has states pump off and pump on. In pump off, the input low level detected produces the output activate pump and moves to pump on; in pump on, normal level detected produces deactivate pump and moves to pump off. Any other input leaves the state unchanged. Draw the table.

Current state Input Output Next state
pump off low level detected activate pump pump on
pump off normal level detected — pump off
pump on normal level detected deactivate pump pump off
pump on low level detected — pump on

The two "no change" rows become loop arrows on the diagram; leaving them out loses the mark for completeness.

探索

软件过程实验

根据阶段或所属工具对开发示例进行分类。

词汇 训练
English 中文 拼音
structure chart/ˈstrʌktʃə tʃɑːt/ 结构图 jié gòu tú
parameters/pəˈræmɪtəz/ 参数 cān shù
pseudocode/ˈsuːdəʊkəʊd/ 伪代码 wěi dài mǎ
hierarchical decomposition/haɪəˈrɑːkɪkl ˌdiːkɒmpəˈzɪʃn/ 分解 fēn jiě
decomposition/ˌdiːkɒmpəˈzɪʃn/ 分解 fēn jiě
subroutines/ˈsʌbruːtiːnz/ 子程序 zi chéng xù
state-transition diagram/steɪt trænˈsɪʃn ˈdaɪəɡræm/ 状态转换图 zhuàng tài zhuǎn huàn tú
states/steɪts/ 状态 zhuàng tài
12.3

程序测试与维护

教学大纲
考生应能够: 注释与指导
展示对暴露和避免程序中故障的方法的理解
定位并识别不同类型的错误 • 语法错误 • 逻辑错误 • 运行时错误
修正已识别的错误
展示对可用测试方法的理解,并为给定方法选择适当的数据 包括 干运行、走查、白盒测试、黑盒测试、集成测试、Alpha测试、Beta测试、验收测试、桩模块
展示对制定测试策略和测试计划的必要性及其可能内容的理解
为测试计划选择合适的测试数据 包括 正常、异常 以及 极端/边界
展示对系统持续维护的必要性及每种类型维护之间差异的理解 包括 完善性维护、适应性维护、改正性维护
分析现有程序并进行修改以增强功能

来源:Cambridge International 教学大纲

English
  • syntax error 语法错误 — breaks the language's grammar (missing bracket, misspelled keyword). Caught at translation time; the program won't run until fixed.
  • run-time error 运行时错误 — happens while running (divide by zero, file not found, array index out of range). The program crashes or raises an exception; fix by adding checks.
  • logic error 逻辑错误 — the program runs but gives wrong results (using + for -, an off-by-one loop, conditions in the wrong order). The hardest to find; it can cause wrong output or prevent the program from terminating, so use careful testing and tracing.
A pipeline from write code to translate to run to output: a syntax error stops it at translation, a run-time error crashes during the run, and a logic error runs fine but gives the wrong output
When each error shows up: syntax at translation, run-time during the run, logic in the output

Exposing and avoiding faults. Faults are exposed by testing against a test plan, by a dry run or trace table, by a walkthrough with colleagues, and by the IDE's debugger (breakpoints, single stepping, watching variables). They are avoided by designing before coding (structure chart, pseudocode), by modular code with meaningful identifiers and comments, by validation of every input, by handling exceptions rather than letting a run-time error crash the program, and by the IDE's dynamic syntax checks as you type.

Worked example. State the type of error in each case and how it shows itself. (a) Result <- STR_TO_NUM(x) / STR_TO_NUM(y) is run with y = "0". (b) The same line is run with x = "12a". (c) A loop written as FOR i <- 1 TO 9 processes a ten-element array. (d) OUTPUT "Total: " Total is missing a comma.

(a) Run-time error — division by zero; the program crashes when this line is executed with that data. (b) Run-time error — the string cannot be converted to a number. (c) Logic error — the program runs but the tenth element is never processed, so the output is wrong. (d) Syntax error — the statement breaks the language's rules and is reported by the translator before the program runs.

Worked example. Correct the errors in this pseudocode, which should output the average of ten marks.

Total <- 0
FOR i <- 1 TO 10
    INPUT Mark
    Total <- Total + Mark
NEXT i
Average <- Total / 9
OUTPUT "Average" Average

The division should be by 10, not 9 (a logic error); the output line needs a comma or an & between the string and the value (a syntax error); and Average is never declared as REAL (a syntax or run-time error, depending on the language). Say which line and what the corrected line is: Average <- Total / 10.

词汇 训练
English 中文 拼音
syntax error/ˈsɪntæks ˈerə/ 语法错误 yǔ fǎ cuò wù
run-time error/rʌn taɪm ˈerə/ 运行时错误 yùn xíng shí cuò wù
logic error/ˈlɒdʒɪk ˈerə/ 逻辑错误 luó jí cuò wù
12.3

测试方法

English
  • dry run 手工跟踪 — trace the code on paper, writing each variable's value in a table.
  • walkthrough 走查 — a team review of the code.
  • white-box testing 白盒测试 — designed from the code's internal structure, covering every statement, branch and loop.
  • black-box testing 黑盒测试 — designed from the specification only: feed inputs, check outputs.
  • integration testing 集成测试 — combine modules and test the interfaces between them.
  • alpha testing α测试 — by the developers/in-house before release; beta testing β测试 — by a limited group of real users in their own environment.
  • acceptance testing 验收测试 — by the customer, to decide if the product is fit for purpose.
  • stub 桩 — a placeholder for a module that does not exist yet, so the structure can be tested top-down.
Black-box testing works from the specification; white-box tests the code's internal paths
Black-box tests the specification; white-box tests the code paths

Which method, when. A dry run and a walkthrough need no computer — the dry run is you, tracing the algorithm with a trace table 跟踪表; the walkthrough is a meeting in which the author explains the code line by line and colleagues look for faults, so it also spreads knowledge of the code through the team and checks it against the design. White-box tests are written by someone who can see the code and aims to exercise every path; black-box tests are written from the specification and check only inputs against expected outputs, so a user or a separate tester can do them. Integration testing follows module testing: modules that pass alone can still fail when the data passed between them is the wrong type or in the wrong order. Alpha testing is in-house; beta testing gives a release candidate to a sample of real users, who report faults from real use; acceptance testing is the customer checking the finished product against the requirements before paying for it. A stub lets top-down testing start before every module exists.

Stub testing: the main program under test calls a finished Module A and a stub standing in for the unwritten Module B, which has the real header but simply returns a fixed value
A stub stands in for a module that is not written yet, so the modules above it can be tested now

Worked example. After the program passed its in-house tests it was given to a group of users to try before release. Name this type of testing, and state what happens next.

Beta testing — real users in their own environment, reporting faults the developers did not find. The faults are corrected, then the customer carries out acceptance testing against the requirements and the program is released; faults found in live use are then handled by corrective maintenance.

Worked example. Give three benefits of testing a program by walkthrough.

Errors are found by people who did not write the code and so read it without assumptions; the logic is checked against the design and specification, not only against test data; several people learn how the code works, which helps later maintenance; and no test data or working computer is needed, so it can be done early.

词汇 训练
English 中文 拼音
acceptance testing/əkˈseptəns ˈtestɪŋ/ 验收测试 yàn shōu cè shì
dry run/draɪ rʌn/ 手工跟踪 shǒu gōng gēn zōng
trace table/treɪs ˈteɪbl/ 跟踪表 gēn zōng biǎo
walkthrough/ˈwɔːkθruː/ 走查 zǒu chá
white-box testing/waɪt bɒks ˈtestɪŋ/ 白盒测试 bái hé cè shì
black-box testing/blæk bɒks ˈtestɪŋ/ 黑盒测试 hēi hé cè shì
integration testing/ˌɪntɪˈɡreɪʃn ˈtestɪŋ/ 集成测试 jí chéng cè shì
alpha testing/ˈælfə ˈtestɪŋ/ α测试 α cè shì
beta testing/ˈbiːtə ˈtestɪŋ/ β测试 β cè shì
stub/stʌb/ 桩 zhuāng
12.3

测试策略与测试计划

English

A test strategy 测试策略 is the high-level approach — which kinds of testing, who does them, when, and the criteria to move on. A test plan 测试计划 is the detailed list of tests — each with input data, expected output, and a column for the actual output.

What each contains. A test strategy states which testing methods will be used at which stage (module testing by the programmer, then integration, alpha, beta, acceptance), who is responsible for each, what test data is required, and the criteria for passing to the next stage. A test plan lists the individual tests: for each, the module or feature under test, the input data, the reason the data was chosen (normal, abnormal, extreme, boundary), the expected result, a space for the actual result, and what to do if they differ. The plan is written at the design stage, from the specification, so that it tests what the program should do rather than what it happens to do.

Choosing test data

For each field or condition, include three kinds:

  • normal data 正常数据 — typical values inside the valid range (for marks 0–100: 50, 75).
  • abnormal data 异常数据 — values that should be rejected (-10, 200, "abc").
  • extreme data 极端数据 — the largest and smallest values still accepted (0 and 100).
  • boundary data 边界数据 — values at the edges, where off-by-one errors hide (each accepted extreme and the rejected value just outside it: 0/-1, 100/101).
A number line for a mark field 0 to 100: normal values 50 and 75 inside, the extremes 0 and 100 at the accepted boundaries, and abnormal values -1, 101, -10 and 200 rejected outside
Test data for a 0–100 field: normal inside, extremes at the boundaries, abnormal outside

Worked example. A field accepts an exam mark from 0 to 100. Give test data of each kind with its expected result. Normal: 50 - accepted, a typical value inside the range. Abnormal: -10, 200, "abc" - all rejected, being out of range or the wrong data type. Extreme: 0 and 100 - the largest and smallest values that are still accepted. Boundary: the pairs straddling each edge - -1 rejected alongside 0 accepted, and 100 accepted alongside 101 rejected. Every value must carry its expected result, or the test plan proves nothing. Extreme and boundary are the pair most often confused: an extreme value is an accepted value at the edge of the valid range. Test values at and just outside each boundary to expose off-by-one errors.

Worked example. A component passes if its weight, measured to the nearest gram, is within 3 g of the target of 50 g, i.e. from 47 g to 53 g inclusive. Draw up the test-plan rows for the check.

Test data Type Reason Expected result
50 normal a typical value well inside the range accepted
47, 53 extreme (boundary) the smallest and largest values that must still be accepted accepted
46, 54 boundary the values just outside the range, where an off-by-one error would accept them rejected
20, 90 abnormal values far outside the range rejected
"abc", −5 abnormal the wrong type, a negative weight rejected

Each row must say why the value was chosen and what should happen; a bare list of numbers earns nothing.

词汇 训练
English 中文 拼音
test plan/test plæn/ 测试计划 cè shì jì huà
boundary data/ˈbaʊndəri ˈdeɪtə/ 边界数据 biān jiè shù jù
test strategy/test ˈstrætədʒi/ 测试策略 cè shì cè lüè
normal data/ˈnɔːml ˈdeɪtə/ 正常数据 zhèng cháng shù jù
abnormal data/əbˈnɔːml ˈdeɪtə/ 异常数据 yì cháng shù jù
extreme data/ekˈstriːm ˈdeɪtə/ 极端数据 jí duān shù jù
12.3

维护

English

Most of a program's lifetime cost is in maintenance. Three kinds:

The three kinds of maintenance: perfective, adaptive and corrective
Three kinds of maintenance: perfective, adaptive and corrective
  • perfective maintenance 完善性维护 — improving performance or features even though it works (a faster query, a new option).
  • adaptive maintenance 适应性维护 — keeping it working in a changing environment (a new OS, a new API, a legal change).
  • corrective maintenance 纠正性维护 — fixing bugs found in use.

A program may need all three throughout its life.

Why each is needed — the reasons the mark scheme lists. Corrective: a fault is reported by a user after release, or an incorrect output is noticed in particular circumstances that testing did not cover. Adaptive: the operating system, hardware or browser is upgraded; a law or company rule changes (tax rates, data-protection requirements); the program must work with a new external system or file format. Perfective: users ask for extra features or a better interface; the program is made faster or made to use less memory; the code is tidied to make future changes easier.

Worked example. (a) A released program outputs a wrong value under certain circumstances. (b) The hardware that runs a program is replaced. (c) Customers ask for the coffee-shop loyalty program to send a message on a customer's birthday. Name the maintenance type in each case.

(a) Corrective — a fault in the delivered program is being fixed. (b) Adaptive — the program is changed to run in its new environment. (c) Perfective — a feature is added to a program that already works.

词汇 训练
English 中文 拼音
corrective maintenance/kəˈrektɪv ˈmeɪntənəns/ 纠正性维护 jiū zhèng xìng wéi hù
perfective maintenance/pəˈfektɪv ˈmeɪntənəns/ 完善性维护 wán shàn xìng wéi hù
adaptive maintenance/əˈdæptɪv ˈmeɪntənəns/ 适应性维护 shì yìng xìng wéi hù
12.3

修改现有程序

English

When asked to add a feature or fix a bug:

Six steps: read the code, find where, make the smallest change, update callers, test new and old behaviour, document; the testing step is regression testing
Test the old behaviour as well as the new.
  1. read the existing code until you understand the algorithm and data flow.
  2. find where the change goes — which subroutine, which lines.
  3. make the change as small as possible — don't rewrite working code.
  4. update related parts — every caller of a changed parameter list, every routine using a changed data structure.
  5. test the new behaviour and the old (regression testing 回归测试 — check you broke nothing).
  6. document the change.

Clear comments, meaningful names, decomposed subroutines and a structure chart make a program much easier to amend — which is why the design tools matter even after the first release.

Analysing a program you did not write. Start from the identifier table and the module headers: they tell you what each module receives and returns before you read a line of its body. Then trace the algorithm with a trace table for one small input, noting where each output value comes from. Only then decide where the enhancement goes — usually a new module called from the existing one, so the working code is disturbed as little as possible — and write the pseudocode for the change and the test data that proves it.

词汇 训练
English 中文 拼音
regression testing/rɪˈɡreʃn ˈtestɪŋ/ 回归测试 huí guī cè shì
12.3

考官认可的定义

English

A definition question is marked against fixed wording. Learn these exactly, and give one answer only.

Term Definition
development life cycle the sequence of stages, from analysis to maintenance, followed to produce and support a program
waterfall model a life cycle in which the stages are carried out in a fixed order, each completed before the next begins
iterative model a life cycle in which a working version is produced and then repeatedly refined until it is complete
rapid application development a life cycle that builds prototypes quickly, refining them with user feedback until they are accepted
structure chart a diagram that shows how a program is decomposed into modules, the order in which they are called and the parameters passed between them
state-transition diagram a diagram that shows the states a system can be in and the inputs that cause it to move between them
syntax error an error in the way a statement is written, so it breaks the rules of the language and cannot be translated
logic error an error in the algorithm, so the program runs but produces the wrong result
run-time error an error that occurs while the program is running, such as division by zero, and stops it
dry run working through the algorithm by hand, recording the values of the variables in a trace table
walkthrough a review in which the author steps through the code with colleagues who look for errors
stub a placeholder module with the correct header that returns a fixed value, used so the modules that call it can be tested
test plan a list of the tests to be carried out, each with its test data, the reason for the data and the expected result
boundary data values at each edge of the valid range, both the last value accepted and the first value rejected
corrective / adaptive / perfective maintenance fixing faults found in use / changing the program to suit a changed environment / improving a program that already works
12.3

考试技巧

English
  • Compare development models (waterfall, iterative, RAD) by principle, benefit, drawback, and know the five stages of the program development life cycle and what each produces.
  • Distinguish syntax, logic and run-time errors by when each shows itself: at translation, in the output, during the run.
  • Choose test data of every kind — normal, abnormal, extreme and boundary — and give each value with its reason and expected result.
  • Distinguish the types of maintenance (corrective, adaptive, perfective) by why the change is being made.
  • On a structure chart, name every symbol: box, calling line, data couple, control couple, selection diamond, iteration arrow. Reading module headers off a chart, remember a function has RETURNS.

Common mistakes

  • Describing a life cycle stage by its name only ("in the design stage the program is designed"). Say what is produced: structure chart, pseudocode, test plan.
  • Calling a wrong output a "run-time error". If the program runs to the end, it is a logic error.
  • Giving boundary data as just the extremes. The mark needs the values on both sides of the edge.
  • Treating alpha and beta testing as the same. Alpha is in-house by the developers; beta is by real users outside.
  • Confusing adaptive and perfective maintenance. Adaptive responds to a change outside the program; perfective improves a program nobody had to change.
  • Drawing a structure chart with the modules in any order. They read left to right in the order they are called, and each parameter needs its arrow.

该知识点的互动课程

逐步完成,配合即时检查练习。

历年真题

更多 A-Level 计算机科学 知识点

IGCSE, A-Level & AP