HIT-软件构造知识概要一—软件构造的多维度视图和质量目标

Views and Quality Objectives of Software Construction

软件构造的多维度视图和质量目标

Objective of this lecture

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

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

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

4.软件构造过程中应考虑的重要质量指标

5.如果达不到期望的质量目标,会有什么后果

6.有哪些面向质量指标的软件构造技术

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

Software construction: transformation between views

– 空集 -> Code

– Code -> Component

– Build-time -> Run-time

– Moment -> Period

Quality properties of software systems

– External vs. internal quality factors

– Important external quality factors

– Tradeoff between quality factors

Five key quality objectives of software construction

– Easy to understand: elegant and beautiful code / understandability

– Ready for change: maintainability and adaptability

– Cheap for develop: design for/with reuse: reusability

– Safe from bugs: robustness

– Efficient to run: performance

Summary

1.Multi-dimensional software views软件的多视维角度

  1. Software = Modules (Components) + Data/Control Flows

时刻

时刻

时期

时期

代码级

构件级

代码级

构件级

构建时

源码、抽象语法树、接口类-属性-方法(类图)

包、文件、静态链接、库、测试用例、构建脚本(构件图)

代码变化

配置项、版本

运行时

Code Snapshot(引用)、抓取内存dump文件

包、库、动态链接、配置、数据库、中间件、网络

执行堆栈跟踪、多线程并发

事件日志、多进程、分布式处理

  

1>Build-time Views

Build-time (构造阶段): idea -> requirement -> design -> code ->

installable / executable package

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 软件形态随时间

的变化

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

Syntax-oriented program structure

Abstract Syntax Tree (AST):To represent semi-structuredsource code as a structured tree.

Example:

Processing Java Source Files by AST:彻底结构化,将源代码变为一棵树,对数做各种操作==对源代码的修改

Semantics-oriented program structure

使用UML图:用于表达“需求”和“设计”思想,再转化成code

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

看随着时间代码的变化

(3) 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.

ADD:

Library:

①Libraries are stored in disk files of their own, collect a set of code

functions that can be reused across a variety of programs.

– Developers aren’t always building a single executable program file, but join

custom-developed software and prebuilt libraries into a single program.

②In build-time, a library function can be viewed as an extension to the

standard language and is used in the same way as functions written

by the developers. 开发者像使用编程语言指令一样使用库中的功能

③Sources of libraries:

– From OS pre-installed set of libraries for operations such as file and

network I/O, GUI, mathematics, database assess; 操作系统提供的库

– From language SDK; 编程语言提供的库

– From third-party sources; 第三方公司提供的库

– Developers can also publish their own libraries. 你自己积累的库

Maven Repository仓库地址

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

– 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.

静态链接发生在构造阶段

Component diagram in UML组图

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

①How do all files/packages/components/libraries change in a software system along with time? 各项软件实体随时间如何变化?

②Software Configuration Item (SCI,配置项)

③Version (版本)

(2) Runtime Views

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 逻辑/物理实体在内存/

硬件环境中的形态随时间如何变化?

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

-这是完全编译的程序,准备载入到计算机的内存和执行。

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

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

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

配置和数据文件(Configuration and data files):这些不是可执行文件;他们提供有用的数据和配置信息说明程序,可以从磁盘加载。

分布式程序(Distributed programs):这种类型的软件包含多个可执行程序,之间通过网络或简单地将多个进程运行在同一个机器上。

Dynamic linking(动态链接)

库文件不会在build阶段被加入可执行软件,仅仅做出标记

程序运行时,根据标记装载库至内存

发布软件时,记得将程序所依赖的所有动态库都复制给用户

优点:

-可以升级到一个新的版本的库(添加功能或修复bug),而不需要重新创建可执行程序。

-许多操作系统可以优化其内存使用,只将库的单个副本加载到内存中,但仍然进行共享它与其他需要相同库的程序一起使用。

Execution tracing 执行跟踪

Tracing involves a specialized use of logging to record information

about a program‘s execution. 用日志方式记录程序执行的调用次序

这通常被程序员用于调试目的,并且根据跟踪日志中包含的信息的类型和细节,由经验丰富的管理人员或技术支持人员和用于诊断软件常见问题的软件监控工具。

2 Quality properties of software systems

外部质量因素影响用户

内部质量因素影响软件本身和它的开发者

外部质量取决于内部质量

3本章重点知识

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值