软件构造的实质:Transformation between different views(不同视图之间的转换)
Multi-dimensional software views
按阶段分:build and run-time views
按动态性分:moment and period views
按构造对象的层次分:code and component views
Transformation between different views
Nothing -> Code
Code -> Component
Build-time -> Run-time
Moment -> Period
5个重要的质量目标
- 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
软件多视图的宏观视角

构建时期(Build-time views)
AST可以认为是代码的另一种等价视图,对AST进行修改就相当于对源代码进行修改,对源代码进行修改就相当于对AST进行修改。
Semantics-oriented program structure(语义导向的程序结构):用源代码对现实世界进行刻画,例如使用UML图描述接口、类、属性、方法及其关系。先用人类语言表达需求和设计思想,再转化成代码。
版本控制。
运行时期(Run-time views)
Executable programs:纯粹的机器语言
Cibrary:运行时库,需要链接
Configuration and data files:配置文件,提供程序运行必要的参数
Distributed programs:分布式程序,例如一台服务器+若干台客户机
两种可执行文件:编译成的机器码(Native Machine Code);完全解释运行(Fully Interpretation);解释型字节码(Interpreted Byte Code)
动态链接:库文件不会在build阶段被加入可执行文件,只做出标记,在程序运行时,库被按照标记装入内存。
Transformation between views
- Nothing => Code
Programming / Coding (ADT/OOP)
Review, static analysis/checking - Code => Component
Design (ADT/OOP;Reusability;Maintainability)
Build: compile, static link, package, install, etc - Build-time => Run-time
Install / deploy
Debug, unit testing (Robustness and Correctness) - Moment => Period
Verson control
Loading, dynamic linking, execution (dumping, profiling, logging)
Concurrent threads
Quality properties 质量指标
External quality factors: 外部质量因素,影响用户,如运行速度、易用性,包括correctness, robustness, extendibility, reusability, compatibility, efficiency, portability, ease of use, functionality, timeliness
Internal quality factors: 内部质量因素,影响软件本身和它的开发者,如模块化程度、代码可读性
对于发布后的软件而言,only external factors matter
且外部质量取决于内部质量,External quality results from internal quality.
External quality factors
- Correctness
Correctness is the ability of software products to perform their exact tasks, as defined by their specification.
Correctness is the prime quality.
设法保证正确性:Testing and debugging; Defensive programming such as typing and assertions(通过断言在写程序的时候就保证正确性而不是在调试时发现错误); 通过形式化验证发现问题 - Robustness
Robustness is the ability of software systems to react appropriately to abnormal conditions.
健壮性是对正确性的补充 - Extendibility
规模越大,扩展起来越困难 - Reusability
一次开发,多次使用。找到软件系统中共性的部分,将它们抽取出来。 - Compatibility(兼容性)
不同软件系统之间互相集成是否容易。软件系统都不是孤立存在的,需要和其他系统进行交互。难点:不同软件有不同的设定,例如,不同操作系统中有着互相不兼容的文件格式。解决方法:标准化。 - Efficiency
包括时间效率和空间效率。
Efficiency does not matter unless the software is correct.
正确性是性能的前提。
过度的优化可能导致软件不再适应变化和复用。 - Portability(可移植性)
软件可方便的在不同的技术环境间移植。 - Ease of use(易用性)
容易学、安装、操作、监控 - Functionality(功能性)
Functionality is the extent of possibilities provided by a system.
每增加一点点小功能,都要确保其他质量指标不受到损失。 - Timeliness(及时性)
Timeliness is the ability of a software system to be released when or before its users want it.
软件产品出现的太晚,可能会错过它的受众群体。 - Others: Verifiability(可验证性), Integrity(完整性), Repairability(可修复性), Economy(经济性)
Internal quality factors
- Readability
- Understandability
- Clearness
- Size
Trade off between quality properties (折中)
如果对efficiency有极致的要求,那么这将手具体机器型号的约束,软件的portability就会受影响。
经济性(economy)和reusability也有冲突。
timeliness和extendibility也有冲突。
正确性(Correctness) 绝不能与其他质量指标冲突。
Summary
描述软件系统的三个维度:
按阶段分:build-time & run-time views
按动态性分:moment & period views
按层次分:code & component views

软件构造的本质是视图之间的转化:
nothing => Code
Code => Component
Build-time => Run-time
Moment => Period
质量指标:
external & internal quality factors
important external quality factors
tradeoff
五个质量目标:
easy to understand
ready for change
cheap for develop
safe from bugs
efficient to run
606

被折叠的 条评论
为什么被折叠?



