1-1

Chapter 1: Views and Quality Objectives of Software Construction

1.1 Multi-Dimensional Views of Software Construction

Outline

Multi-dimensional software views

描述软件系统的三个维度

– By phases: build- and run-time views   

– By dynamics: moment and period views

– By levels: code and component views

– Elements, relations, and models of each view

阶段:build-time && run-time

动态:moment && period

级别:code && component

Software construction: transformation between views

元素、关系和各种视角的模式

– =>Code

– Code =>Component

– Build-time => Run-time

– Moment => Period

Summary

 

 

1 Multi-dimensional software views  多维度软件视图

 

(1) What is a Software? 什么是软件?

– System software vs. Application software

– Desktop/web/mobile/embedded software

– Business/personal-oriented software

– Open source vs. proprietary(专有的) software

 

(2)软件系统要素

Software = Program (codes)?

§ Software = Algorithms + Data Structure?

§ Software = Program + Data + Documents

§ Software = Modules (Components) + Data/Control Flows

 

(3)软件系统的组成

Software system =

 Programs(UI,算法,utilities(实用工具 function),APIs,test cases)
+ Data(files,database)

+ Documents(SRS(需求规格声明),SDD(设计规格声明),user manuals)

+ Users(谁来使用)

+ Business Objective(为什么使用它)

+ Social Environment(法规)

+ Technological Environement(如何部署)

+ Hardware / Network(硬件)

(前三个是主要)

 

(4)Multi-dimensional software views 多维度软件视图

1.阶段:构建 || 运行

2.动态:时刻 || 周期

3.级别:代码 || 组件

 

(5)Build-time Views

①Build-time views of a software system  软件系统的构建时间视图

想法 -> 需求 -> 设计 -> 代码 -> 可安装可执行的包

Code-level view: source code ---- how source code are logically organized by basic program blocks such as functions, classes, methods, interfaces,etc, and the dependencies among them

- 代码级视图:源代码----源代码是如何由基本程序块(如函数,类,方法,接口等)以及它们之间的依赖关系在逻辑上组织的。

 Component-level view: architecture ---- how source code are physically

organized by files, directories, packages, libraries, and the dependencies

among them

- 组件级视图:体系结构----源代码如何通过文件,目录,包,库以及它们之间的依赖关系进行物理组织

Moment view: what do source code and component look like in a specific time

- 时刻观点:特定时间内源代码和组件的外观

Period view: how do they evolve/change along with time

- 时期观点:他们如何随时间演变/变化

【②Build-time,moment,andcode-level view】

 

 

How source code are logically organized by basic program blocks such as functions, classes, methods, interfaces, etc, and the dependencies among them.

源代码如何通过基本程序块(如函数,类,方法,接口等)以及它们之间的依赖关系进行逻辑组织。

 Three inter-related forms:

– Lexical-oriented source code(面向词法)

– Syntax-oriented program structure: e.g., Abstract Syntax Tree (AST)(面向

语法)

– Semantics-oriented program structure: e.g., Class Diagram (面向语义)

A)Syntax-oriented program structure面向语法的程序结构

抽象语法树(AST)

将半结构化源代码表示为结构化树。

 

B)Semantics-oriented program structure面向语义的程序结构

例如,使用类图(UML)来描述接口,类,属性,方法以及它们之间的关系。

§基于图形或正式定义。

§通常在设计阶段进行建模,并转换为源代码。

§它是面向对象的分析和设计在用户需求方面的结果。

【③Build-time, period, and code-level view】

 

Views describing “changes” along with time.

Code churn: Lines added, modified or deleted to a file from one version to another.

代码流失:添加,修改或删除从一个版本到另一个版本的文件

【④Build-time, moment, and component-level view】

 

Source code are physically organized into files which further are organized by directories;

Files are encapsulated into packages and, logically, components and sub-systems.

Reusable modules are in the form of libraries.

源代码被物理地组织成文件,这些文件进一步由目录组织;

文件被封装成包,并在逻辑上封装组件和子系统。

可重用模块采用库的形式。

【Library库】

库被存储在自己的磁盘文件中,收集一组可以在各种程序中重复使用的代码函数。

- 开发人员并不总是构建单个可执行程序文件,而是将定制开发的软件和预先构建的库加入到单个程序中。

在构建时,库函数可以被看作是标准语言的扩展,并且以与开发人员编写的函数相同的方式使用。System.out.println(“Hello World” 的);

库的来源:

From OS pre-installed set of libraries for operations such as file and network I/O, GUI, mathematics, database assess;

- 从操作系统预装的一组库中进行文件和网络I / O,GUI,数学,数据库评估等操作;

From language SDK;

- 从语言SDK;

From third-party sources, such as downloading them from the Internet.

- 来自第三方来源,例如从互联网下载它们。

Developers can also publish their own libraries.

- 开发人员也可以发布他们自己的库。

【linking Library】

When a program is edited, built and installed, a list of libraries to search must be provided.

当节目进行编辑,建造和安装,必须提供的库搜索列表。

If a function is referenced in the source code but the developer didn’t explicitly write it, the list of libraries is searched to locate the required function.

如果源代码中引用了某个函数,但开发人员没有明确写入该函数,则会搜索库列表以查找所需的函数。

When the function is found, the appropriate object file is copied into the executable program.

Two different approaches of integrating a library into an executable program:

– Static linking

– Dynamic linking

将库整合到可执行程序中的两种不同方法:

- 静态链接

- 动态链接

【Static linking静态链接】

In static linking, a library is a collection of individual object files.

在静态链接中,库是个别对象文件的集合。

During the build process, when the linker tool determines that a function is required, it extracts the appropriate object file from the library and copies it into the executable program.

在构建过程中,当链接器工具确定需要某个函数时,它从库中提取适当的目标文件并将其复制到可执行程序中。

– The library’s object file appears identical to any of the object files the developer created on his or her own.库的目标文件看起来与开发者自己创建的任何目标文件完全相同。

§ Static linking happens in build time ---The act of linking a library with the developer’s own software happens during the build process.

– End up with a single executable program to be loaded onto the target machine.

– After the final executable program has been created, it’s impossible to separate the program from its libraries.

静态链接在构建时发生---在构建过程中会发生链接库与开发人员自己的软件的行为。

- 最终将一个可执行程序加载到目标机器上。

- 最终的可执行程序创建完成后,无法将程序与其库相分离。

【⑤Build-time, period, and component-level view】

 

Version Control System (VCS)版本控制系统(VCS)

 

Evolution Graph (of a SCI or a Software)演化图(SCI或软件的演变图)

 

Versioning版本

软件版本控制是将唯一版本名称或唯一版本号分配给计算机软件的独特状态的过程。

- 在给定的版本号类别(主要,次要)中,这些数字通常按递增顺序进行分配,并与软件中的新发展相对应。

- 在细粒度的层次上,修订控制通常用于追踪不同版本的电子信息,不管这些信息是否为计算机软件。

Software Evolution软件进化

软件进化是软件维护中使用的一个术语,指的是最初开发软件的过程,然后由于各种原因不断更新它。

- 典型系统的90%以上的成本出现在维护阶段,任何成功的软件都将不可避免地得到维护。

(6)Runtime Views运行时视图

 

【①Runtime views of a software system 软件系统的运行时视图】

 Runtime: what does a program look like when it runs inside the target machine, and what are all the disk files that the target machine needs to load into memory?§运行时:程序在目标机器内部运行时的外观是什么,目标机器需要加载到内存中的所有磁盘文件是什么?

– Code-level view: source code ---- what do the in-memory states of an executable program look like and how do program units (objects, functions, etc) interact with each other?

代码级视图:源代码----可执行程序的内存状态是什么样的,程序单元(对象,函数等)如何相互交互?

– Component-level view: architecture ---- how are software packages deployed into physical environment (OS, network, hardware, etc) and how do they interact?

组件级视图:体系结构----如何将软件包部署到物理环境(操作系统,网络,硬件等)以及它们如何进行交互?

– Moment view: how do programs behave in a specific time

- 时刻观点:程序如何在特定时间内运行

– Period view: how do they behave along with time

- 周期视图:他们如何随着时间而行动

【②High-level concepts of run-time software运行时软件的高级概念】

可执行程序:CPU执行的机器可读指令序列,以及相关的数据值。

- 这是完全编译的程序,可以加载到计算机的内存中并执行。

库:可以被不同程序重用的常用目标代码的集合。

- 大多数操作系统包含一组标准库,开发人员可以重复使用,而不是要求每个程序都提供自己的。

- 库不能直接加载并在目标机器上执行; 它必须首先与一个可执行程序链接。

配置和数据文件:这些不是可执行文件; 它们提供程序可以从磁盘加载的有用数据和配置信息。

-分布式程序:这种类型的软件由多个可执行程序组成,这些程序通过网络彼此通信,或简单地称为在同一台计算机上运行的多个进程。

- 这与具有单个单片程序映像的更传统的软件形成鲜明对比。

【③Run-time, moment, and code-level view】

 

Snapshot diagram快照图:着眼于目标计算机内存中的变量级执行状态,体现某时刻内存中变量的情况。

Memory dump

内存转储:硬盘上的一个文件,其中包含进程内存的副本,当进程因特定类型的内部错误或信号而中止时产生内存。(常发生在异常退出时,把内存中信息写到文件中(常用来调试))

- 调试器可以加载转储文件并显示它包含的有关正在运行的程序状态的信息。

- 信息包括寄存器,调用堆栈和所有其他程序数据(计数器,变量,开关,标志等)的内容。

- 这是为了分析程序的状态,程序员查看内存缓冲区以查看哪些数据项在失败时正在处理。

【④Run-time, period and code-level view】

UML时序图/UML部署图:程序中的各个模块在物理上如何分布;表明客户端、服务器之间的关系。

 

执行跟踪:跟踪涉及专门使用日志记录关于程序执行的信息。

此信息通常由程序员用于调试目的,另外还取决于跟踪日志中包含的信息的类型和详细信息,由有经验的系统管理员或技术支持人员以及软件监控工具来诊断软件的常见问题。

【⑤Run-time, moment, and component-level view】

 

【⑥Run-time, period, and component-level view】

posted @ 2018-06-20 15:41  HIT王新宇  阅读(265)  评论(0编辑  收藏  举报