Download presentation
Presentation is loading. Please wait.
Published byPierce Newton Modified over 8 years ago
1
4. The process specification (プロセス仕様) You will learn: (次の内容を学び) The concept of process specification (プロセス 仕様の概念) Notations for process specification (プロセス 仕様記法)
2
4.1 What is process specification? (プロセス仕様とは) (1) The problem: (問題点) Processes in a DFD are not defined in detail. Therefore, it is almost impossible to understand the meaning of the DFD precisely and accurately. ( DFD では、プロセス の機能を定義していない) (2) The definition of process specification: (プロセス仕 様の定義) Description: a process specification is a document for the process that specifies what to do in transforming its inputs to outputs. (プロセス仕様とは、入力データ フローを出力データフローへの変換に何をすると いうことを明確に定義する文書である)
3
(3) What kinds of processes need to be specified? (どんな プロセスに仕様を書く必要があるか) Only the lowest level processes that do not have decompositions in a hierarchy of DFDs need to be specified, because they have no definitions in the DFD hierarchy at all. (階層的 DFD のなかで分解されていな いプロセスだけに仕様を書く必要がある) Processes that are decomposed into lower level DFDs do not need to be specified, because they are actually defined by their decompositions. (分解されたプロセスに対し て、分解された DFD によるそのプロセスを定義され ているので、仕様を書く必要がない) For example, in the following DFD hierarchy, processes 2 and 3 do not need a specification, whereas processes 3.1, 2.2.1, 2.2.2, 2.2.3, and so on need to be defined.
5
4.2 Notations for process specification (プロセス仕様記法) We introduce the following most commonly used notations: (次の三つの仕様記法を紹介する) Pre and post-condition notation (事前条件と事 後条件の記法) Structured English (構造化英語) Decision table (意思決定表)
6
4.2.1 Pre and post-condition notation (事前条件と事後条件の記法) The primary idea of writing process specification using pre and post- condition notation: (事前条件と事後条件の記法の基本的な考 えかた) A process can be defined by giving a pre-condition and post-condition. The pre-condition describes a constraint on the input data flows before the execution of the process, while the post-condition provides a constraint on the output data flows after the execution. (プロセスの機能を事前条 件 と事後条件により定義できる。事前条件は、プロセス の入 力に対しての制限であり、事後条件は、プロセスの出 力に 対しての制限である)
7
Syntax for a process specification: this notation is a simplified version of process specification notation used in the SOFL specification language. (プロセス 仕様の文法。 SOFL 仕様言語のプロセス仕様記法を使 う) SOFL stands for Structured Object-oriented Formal Language. ( SOFL は、 Structured Object-oriented Formal Language と意味する) process processName(input data flows) output data flows ext stores pre condition1 post condition2 end_process
8
For example, let’s take the three processes in the following DFD as an example to show how the pre and post-condition notation is used to define processes: (次の DFD のプロセス仕様を考え よ)
9
process Provide-Month() month pre true post month = a month number obtained from the input device. end_process; process Find-All-Related-Items(total-exp, month) items-list ext expenses-file pre total-exp command is available and 1 <= month <= 12 post items-list = all of the items that are purchased within the requested month, obtained from the expenses-file. end_process;
10
process Calculate-Total-Expense(items-list) total-amount pre true post total-amount = add up all of the prices for all of the items recorded in items-list. end_process;
11
4.2.2 Structured English (構造化英語) Structured English is English with structure. That is, it is basically English, but there are restrictions on the structure of sentences. The goal of applying such restrictions is to achieve a reasonable balance between the precision of formal programming languages and the casual informality and readability of the English texts. (構造化英語は、構造が明確である英語の表現であ る) Structured English includes two kinds of sentences: (構 造化英語は、次の二つの語句を含む) Basic sentences (基本語句) Compound sentences (複合語句)
12
Basic sentences (基本語句) A basic sentence may be one of the following three kinds: (基本語句 は、次の三つの種類の語句を含む) An algebraic equation. (代数方程式) For example, x = (y * z) / (q + 4) a = b ** 2 + d/2 A simple imperative sentence consisting of a verb and object. There is no restriction on verbs and objects. (動詞と目的語から形成さ れた命令語句) For example, Calculate total-amount Input x A mixture of the both. (以上の二種類の語句の組合せ) For example, Compute total-amount = item1.price + itme2.price + item3.price
13
A list of verbs that are often used in Structured English: (次の動詞は、構造化英語に良く使われる) Get (or Accept or Read) Put (or Display or Write) Find (or Search or Locate) Add Subtract Multiply Divide Compute Delete Validate Move Replace, Set, Sort
14
Compound sentences ( 複合な語句) A compound sentence is one of the following: (複 合な語句は、次の種類を含む) Sequence of sentences (順序語句) Block sentence (ブロック 語句) Conditional sentences (条件語句) Multiple choice sentence (多数選択語句) Iteration sentences (反復語句)
15
(1) Sequence of sentences (順序語 句) Syntax: (文法) S1; S2; S3; Example: a function to register an item data in the expenses-file: ( expenses-file に一つの データ項目を登録する構造化英語) Get item-d; Register item-d in expenses-file; Add item-d.price to total-expense;
16
(2) Block sentence (ブロック 語 句) Block sentence is used to group a sequence of sentences into a single sentence. Syntax: (文法) begin sentence-1; sentence-2; sentence-3 end; Example, (例え) begin Get item-d; Register item-d in expenses-file; Add item-d.price to total-expense; end;
17
(3) Conditional sentences (条件語句) Conditional sentences include if-then and if-then-else sentences: Syntax: (文法) if condition then sentence; end-if; or if condition then sentence-1 else sentence-2 end-if;
18
Example: (例え) (1) if 1<= month <= 12 then Display items-d purchased in this month end-if; (2) if 1<= month <= 12 then Display items-d purchased in this month else Display warning message end-if;
19
(4) Multiple choice sentence (多数選択語句) Syntax: (文法) do case variable value-1, value-2: sentence-1; value-3, value-4: sentence-2; …… value-9, value-10: sentence-10; otherwise: sentence; end-case;
20
Example: (例え) do case input /* to the Personal Expenses Management System */ item-reg: Register item-d; single-item-d: Display all of the items of this kind; total-exp: Output the total expense; all-item-d: Display all of the items data in expenses-file; otherwise: Give warning message; end-case;
21
(5) Iteration sentences (反復語 句) Iteration sentences include while-do and do-while sentences. Syntax: (文法) while condition do do sentence-1 sentence-1 end-while; while condition end-while; In both while-do and do-while sentences, sentence-1 is executed until the condition becomes false. The only difference between them is that sentence-1 is firstly executed after evaluating the condition as true in while-do sentence, whereas the first execution of sentence-1 in do-while sentence is done before evaluating the condition.
22
Examples: (例え) while items-list <> empty do begin Get next item-d; Display item-d end end-while; do begin Read item-d; Register item-d in expenses-file end while item-d.name <> “end” end-while;
23
4.2.3 Decision table Decision table describes that actions are taken based on a combination of certain conditions or values. Decision table is in particular effective in defining processes that produce some output or take actions based on complex conditions. General format of a decision table:
24
Each column shows a rule, indicating what actions are taken under what conditions.
25
Example of decision table
26
This decision table can be translated into the equivalent Structured English: if Presence >= 10 and Exam-grade = C and Project-grade >= 60 then Get credit else if Presence >= 10 and Exam-grade = B and Project-grade < 60 then Get credit else if Presence = 60 then Get no credit else if Presence >= 10 and Exam-grade = A and Project-grade >= 60 then begin Get credit; Recommend award end end-if;
27
Advantages of decision table The designer can concentrate on one rule at a time. The decision table does not imply any particular form of implementation. This will give the programmer freedom in choosing most efficient implementation strategy. The decision table can be automatically transformed into a program structure. However, whether the program is executable or not depends on if all of the involved conditions can be evaluated and all of the actions can be executed automatically.
28
Exercise 4 1.Write the process specifications for the processes Receive-Request, Check-Password, Withdraw, and Show-Balance given in Exercise 2.1, using the following three notations, respectively. (1) Pre and post-condition notation (2) Structured English (3) Decision table 2. Use structured English to describe the following decision table.
30
3. Translate the following Structured English expression into a decision table. if x > 5 and y > x + 1 and z > x + y then begin Compute sum = x + y + z; Output sum; end else begin Compute sum = x * y * z; Output sum; end;
31
Small project 1.3 Use Structured English to write process specifications for all the three processes involved in the hierarchical DFDs resulted from small project 1.1.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.