软件工程第12讲
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
4.2.1.2 Some Concepts
1.Depth: represents the number of levels of control;
2.Width:represents the number of overall span of control;
3.Fan-in:indicates how many modules directly control a given module;
4.Fan-out:represents the number of modules that are directly controlled by another module;
5.Superordinate and subordinate: (p166).
A module that controls another module is said to be superordinate to it; conversely, a module controlled by another is said to be subordinate to the controller .
e.g.
4.2.2 Software procedure description General detailed design tools:
Graphic tools:procedure details represent the part of graphics;
Design language(language tool):using pseudo code represents procedural details;
T a b u l a r t o o l:u s i n g t a b l e r e p r e s e n t s procedural details.
4.2.2.1 Graphic tools
1. Structured Flowcharts pp.216
Sequence If-then-else
or
Do-while
Structured Flowcharts (cont.)
Repeat-until
Selection
e.g. pp.218
2. N-S charts (Box diagram) pp.218
e.g. pp.218
3. Problem Analysis Diagram (PAD)
PAD constructs
e.g.
4.2.2.2 Language tool
e.g. pp.222
PROCEDURE security.monitor;INTERFACE RETURNS system.status;TYPE signal IS STRUCTURE DEFINED name IS STRING LENGTH VAR;
address IS HEX device location;
bound.value IS upper bound SCALAR:
message IS STRING LENGTH VAR:END signal TYPE;
TYPE system.status IS BIT(4);
TYPE alarm.type DEFINED
smoke.alarm IS INSTANCE OF signal;
fire.alarm IS INSTANCE OF signal;
water.alarm IS INSTANCE OF signal;
temp.alarm IS INSTANCE OF signal:
burglar.alarm IS INSTANCE OF signal;
TYPE phone.number IS area code+7-digit number;
…
initialize all system ports and reset all hardware;CASE OF control.panel.switches(cps):
WHEN cps=“test”SELECT
CALL alarm PROCEDURE WITH
“on” for test.time in seconds;
WHEN cps=“alarm-off” SELECT
CALL alarm PROCEDURE WITH
“off”;
WHEN cps=“new.bound.temp”SELECT
CALL keypad.input PROCEDURE;
WHEN cps=“burglar.alarm.off” SELECT
deactivate signal[burglar.alarm];
…
DEFAULT none;
ENDCASE
REPEAT UNTIL activate.switch is turned off
reset all signal.values and switches;
DO FOR alarm.type=smoke,fire,water,temp,burglar;
READ address[alarm.type] signal.value;
IF signal.value>bound[alarm.type]
THEN phone.message=message[alarm.type];
set alarm.bell to“on”for alarm.time in seconds;
PARBEGIN
CALL alarm PROCEDURE WITH “on”,alarm.time in seconds
CALL phone PROCEDURE WITH message[alarm.type],phone.number;
ENDPAR
ELSE skip
ENDIF
ENDFOR
ENDREP
END security.monitor