当前位置:网站首页>Introduction to software engineering -- Chapter 4 -- formal description technology
Introduction to software engineering -- Chapter 4 -- formal description technology
2022-06-26 23:23:00 【Be humble】
Introduction to software engineering —— Chapter four —— Formal description technology
List of articles
1、 summary
According to the degree of formalization , The methods used in software engineering can be divided into Informal 、 Semi formal and formal Three types of . Describe the requirements specification naturally , It is a typical non formal method . Model with data flow diagram or entity relation diagram , It is a typical semi formal method . The so-called formal method , It is a mathematics based technology to describe the properties of the system , in other words , If a method has a solid mathematical foundation , Then it is formal .
2、 The disadvantages of non formal methods :
- contradiction : A set of conflicting statements .
- Two senses : A statement that the reader can understand in different ways .
- Ambiguity : A general statement that does not specify any Ou Yong information .
- Incompleteness : A statement that does not specify a specific function .
- Confusion of abstract levels : It means that the non abstract statement is mixed with some low-level statements about details .
3、 The advantages of formal methods :
- Be able to describe Physical phenomena 、 An object or action Result . Accurate to almost no ambiguity , And it can be verified mathematically , To discover existing contradictions and incompleteness , There is no ambiguity in such specifications .
- It can smoothly transition between different software engineering activities . Not only functional specifications , And the system design can also be expressed mathematically , Of course , Program code is also a mathematical symbol .
- Provides a means of high-level confirmation , It can be proved mathematically , The design complies with the specifications , The program code correctly realizes the design result .
4、 Apply formal guidelines
- Appropriate representation should be chosen .
- It should be formalized , But don't over formalize
- The cost should be estimated
- There should be a formal method consultant to provide advice at any time
- Traditional development methods should not be abandoned
- Detailed documentation should be established
- Quality standards should not be abandoned
- We should not blindly rely on formal methods
- It should be tested 、 Test and retest
- Should reuse : Even if the formal method is adopted , Software reuse is still the only reasonable way to reduce software cost and improve software quality , Moreover, the software components described by formal methods have clearly defined functions and interfaces , Make them more reusable .
5、 Finite state machines
Finite state machine is a formal method to express specification
A finite state machine consists of the following five parts : State set J, Input set K, The next state is determined by the current state and the current input ( Substate ) The conversion function of T, The initial state S And the final state set F. A finite state machine can be expressed as a 5 Tuples (J、K、T、S、F)
give an example :
In the above example :
State set J:{ The safe is locked ,A,B, Safe unlocking , Call the police }
Input set K:{1L,1R,2L,2R,3L,3R}
Conversion function T:
Initial state S: The safe is locked .
The final set F:{ Safe unlocking , Call the police }
among :J Is a finite set of nonempty states ,K Is a finite nonempty input set ;T It is a slave. (J-F)* K To J The conversion function of ;S∈J, Is an initial state ,F Included in J, Is the final state set .
State transition
Each transition of state has the following form :
current state [ menu ] + Time [ Selected The item ] =》 Next state
Expand
Make an extension to the finite state machine , That is, in the above 5 Add the... To the tuple 6 A component —— Predicate set P, Thus, the finite state machine is extended to a 6 Tuples , Each of these predicates is a global state Y Function of , Conversion function T Now it is a time from (J-F)* K * P To J Function of .
The current conversion rule is in the form of :
current state [ menu ] + event [ Selected items ] + The predicate =》 Next state
advantage
- The finite state machine method manages a simple format to describe specifications : current state + event + The predicate =》 Next state . This form of specification is easy to write 、 Easy to verify , And it can be easily transformed into design or program code .
- Finite state machine method is more accurate than data flow graph , And it's easy to understand .
shortcoming
- When developing large systems , A triple ( I.e. status 、 event 、 The predicate ) The number of will increase rapidly .
- The formal finite state machine method does not deal with timing requirements .
6、Petri network
(1) function
A major problem encountered in concurrent systems is Timing issues . Timing problems are usually caused by poor design or incorrect implementation . And such design or implementation is caused by poor specifications , If the specifications are not appropriate , There is a risk of incomplete design or implementation ,Petri A great advantage of net technology is that it can be used in design
(2) constitute
General composition :
Petri The net contains 4 Elements : A set of positions P、 A set of transformations T、 Input function I、 Output function O. Examples are as follows :
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-NkvlFDBM-1656168358803)(C:\Users\W\AppData\Roaming\Typora\typora-user-images\image-20220625220451552.png)]](/img/d6/99c48ef728550304536210846f44f7.png)
A set of positions P by {P1,p2,p3,p4}, Use a circle to represent the position in the figure .
A set of transformations T by {T1,T2} Use a short line to represent the transformation in the figure
Two input functions for conversion , Indicate by an arrow pointing to the transition for the chairman , They are I(t1) = {P2, P4}
I(t2) = {P2}
Two output functions for conversion , It is indicated by the arrow pointing to the position light from the conversion , They are :O(t1) = {P1}
O(t2) = {P3, P4}
among ,P = {P1,……Pn} Is a finite location set
T = {t1,……,tm} Is a finite transformation set ,m>=0
(3) Assign token
① Marked Petri network
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-gamheAgT-1656168358803)(C:\Users\W\AppData\Roaming\Typora\typora-user-images\image-20220625221707658.png)]](/img/07/a3a69b9ec78dae26acab4abbe76e50.png)
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-iDPtLoPl-1656168358804)(C:\Users\W\AppData\Roaming\Typora\typora-user-images\image-20220625221734929.png)]](/img/0c/0d514f9108dbdd8be97684fee7c2e3.png)
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-uBgPYylo-1656168358804)(C:\Users\W\AppData\Roaming\Typora\typora-user-images\image-20220625221801564.png)]](/img/15/8ed6c6e0f349648bca5d765626047e.png)
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-fn6AYYCA-1656168358805)(C:\Users\W\AppData\Roaming\Typora\typora-user-images\image-20220625221813498.png)]](/img/c5/b9ea926ec3448b68aae601fbcfc041.png)
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-TIumZhWu-1656168358806)(C:\Users\W\AppData\Roaming\Typora\typora-user-images\image-20220625221908283.png)]](/img/37/ecfbda58d7d50be89236c1c7024e57.png)
7、Z Language
use Z In words 、 The cheapest formal specification has the following four parts :
(1) Given set
One Z The specification starts with a given set of initializations , An initialized set is a set that does not need to be defined in detail , This set is expressed in square brackets .
(2) State definition
One Z The specification consists of several “ grid ” form , Each lattice contains a set of variable descriptions and a series of predicates that limit the range of variable values .
(3) The initial state
The abstract initial state refers to the state when the system is first turned on .
(4) operation :
- When one cell is used in another cell , To prefix it with a triangle symbol 、 question mark ”?“ Represents the input variable , And exclamation marks ”!“ Represents the output variable
- Predicate part , Contains a set of preconditions for invoking operations , And the post condition after the operation is completed , If the precondition holds , Then the post condition can be obtained after the operation is completed , however , If the operation is called when the precondition is not true , You cannot get the specified result .
Z The main reasons for the success of language are :
- It can be found easily Z Error in writing specifications , Especially when reviewing specifications , And review the design and code according to the formal specification , This is even more true .
- Require very precise use of Z Specifiers write specifications . Reduced ambiguity 、 Inconsistencies and omissions .
- Z Just a formal language , Developers can strictly verify the correctness of specifications when necessary .
- Developers can learn to write in a relatively short time Z description
- Use Z Language reduces the cost of software development by reducing the total time required for the development process
- Users can base on Z The specification rewritten in natural language is clearer and more accurate than the informal specification written directly in natural language .
Is a formal language , Developers can strictly verify the correctness of specifications when necessary .
4. Developers can learn to write in a relatively short time Z description
5. Use Z Language reduces the cost of software development by reducing the total time required for the development process
6. Users can base on Z The specification rewritten in natural language is clearer and more accurate than the informal specification written directly in natural language .
边栏推荐
- 【界面】pyqt5和Swin Transformer对人脸进行识别
- Smartbi gives you a piece to play with Boston matrix
- 电子协会 C语言 1级 31 、 计算线段长度
- VB. Net class library (advanced version - 1)
- 客户端实现client.go客户端类型定义连接
- Electronic Society C language level 1 31. Calculate line segment length
- [710. random numbers in the blacklist]
- Why don't I recommend going to sap training institution for training?
- Three solutions for improving embedded software development environment
- Wechat applet automatically generates punch in Poster
猜你喜欢

On cap theorem in distributed system development technology
![Selenium电脑上怎么下载-Selenium下载和安装图文教程[超详细]](/img/ec/1c324dcf38d07742a139aac2bab02e.png)
Selenium电脑上怎么下载-Selenium下载和安装图文教程[超详细]

Briefly describe the model animation function of unity

Openpyxl module

Typera set title auto numbering

Three solutions for improving embedded software development environment

通过两个stack来实现Queue

Unityeditor Editor Extension - table function

Leetcode (763) -- dividing letter ranges

UnityEditor編輯器擴展-錶格功能
随机推荐
leetcode 1143. Longest Commom Subsequence 最长公共子序列(中等)
WP collection plug-in tutorial no thanks for WordPress collection of rules
Wechat applet automatically generates punch in Poster
入侵痕迹清理
數據清洗工具flashtext,效率直接提昇了幾十倍數
浅谈分布式系统开发技术中的CAP定理
Simple test lightweight expression calculator fly
C language: a simple calculator is implemented by using code many times
ASP. Net core create MVC project upload file (buffer mode)
电子协会 C语言 1级 29 、 对齐输出
【界面】pyqt5和Swin Transformer对人脸进行识别
Flashtext, a data cleaning tool, has directly increased the efficiency by dozens of times
美术向的Unity动画知识
Operator介紹
Different subsequence problems I
The sharp sword of API management -- eolink
Unity布料系统_Cloth组件(包含动态调用相关)
Unity3d plug-in anyportrait 2D bone animation
[Old Wei makes machines] issue 090: keyboard? host? Full function keyboard host!
Electronic Society C language level 1 30, calculation of last term of arithmetic sequence