首页 > 技术文章 > 1.1软件构造的多维度视图

qq1076150459 2020-07-11 19:16 原文


1. 从三个维度看软件系统的构成

2. 用什么样的模型/视图描述软件系统

3. 将“软件构造”看作“不同视图之间的转换”

不同维度下的软件视角(十分重要)

 

 

 

一.

§ Multi-dimensional software views

- By phases: build- and run-time views 按阶段划分:构造时/运行时视图

– By phases: build- and run-time views 按阶段划分:构造时/运行时视图

– By levels: code and component views按构造对象的层次划分:代码/构件视图

 

 

 

二.

 

1.构造阶段Build-time:

思想idea->要求requirement->设计design->代码code->installable/executable package可运行包

-Code-level view:  source code 源码的逻辑组织(功能、方法、类、接口)

-component-level view: architecture代码的物理组织(文件、目录、包、库)

-Moment view:特定时刻软件形态

-Period View:软件形态随时间的变化

 

(1)Build-time, moment, and code-level view

词汇层面:Lexical-oriented source code面向词汇的源代码

语法层面:Syntax-oriented program structure 面向语法的软件结构: e.g., Abstract Syntax Tree(AST)抽象语法树

语义层面: Semantics-oriented program structure面向语义的软件结构: e.g., Class Diagram(类图--UML)

 

(2)Build-time,period,and code-level view

运行时,时期,代码逻辑组织视图

Code churn代码变化(行的变化,文件的改变)

 

(3)Build-time,moment,and component-level view

源码根据目录,物理组织为不同文件,文件被装入不同的包(组件和子系统),可复用模块变为库的形式

 

操作系统提供的库,编程语言提供的库,第三方公司提供的库,自己积累的库

库的链接:静态链接和动态链接

静态链接发生在构造阶段(build time),需要的时候库被拷贝进代码形成整体,执行的时候无需提供库文件

 

(4) Build-time,period,and component-level view

各项软件实体随时间如何变化

Software Configuration Item(SCI,配置项)

Version(Version Control System-- VCS 版本控制系统, Evolution Graph )

 

2.Runtime Views

运行时:程序被载入目标机器,开始执行

-Code-level view:source code--代码层面,逻辑实体在内存中如何呈现

-Component-level view:architecture---构件层面:物理实体在物理硬件环境中如何呈现?

-Moment view:逻辑/物理实体在内存/硬件中特定时刻形态

-Period view:~~~形态随时间如何变化

 

Executable programs:可执行项目

{

Native Machine Code原生机器码:最符合CPU的机器码

Full Program Interpretation程序完全解释执行:整个源码放入内存中解释

Interpreted Byte Codes 解释型字节码(通过虚拟机解释给机器,用的是字节码)

}

Libraries:库(Dynamic linking动态链接,编译阶段仅做标记,运行时装载至内存,

Configuration and data files:提供数据和配置信息(外部要求的文件)

Distributed programs:分布式程序,运行多个程序,部署于多个计算机

(5)Run-time,moment,and code-level view

Snapshot diagram 代码快照图,描述程序运行时内存变量层面的状态

Memory dump(内存信息转储,包含一个进程的信息的拷贝)

(6)Run-time,period and code-level view

UML中的一系列图,不同单元间的交互

Execution tracing 执行跟踪(用日志方式记录程序的调用次序)

(7) Run-time, moment, and component-level view

 Deployment diagram in UML

(8) Run-time, period, and component-level view

事件日志(系统层面)

系统层面和事件层面的log日志区别

 

 

 

三.

不同视角间的转换

 

 

 



推荐阅读