Chapter1
1.1 Multi-Dimensional Views
从三个维度看软件系统的构成
用模型/视图描述软件系统
将软件构造看做不同视图之间的转换
1.1.1 Three dimensions
|
|
|
By phares: |
build-time(构造阶段) |
run-time(运行阶段) |
By dynamics: |
moment(特定时刻的软件形态) |
period(软件形态随时间点的变化) |
By levels: |
code(代码的逻辑组织, functions, classes, methods, interfaces) |
component(代码的物理组织, files, directories, packages, libraries) |
1.1.2 Eight views
|
Moment(特定时刻的软件状态) |
Period(软件形态随时间的变化) |
|
Code-level |
Component-level |
Code-level |
Component-level |
Build-time |
Source code(词汇层面,半结构化), AST(语法层面,语法树,结构化), Interface-Class-Attribute-Method(Class Diagram)(语义层面,类图,表达”需求”和”设计”思想,再转化成code)(代码的逻辑组织,function,classes,methods,interfaces) |
Packge, Sorurce, File, Static Linking(静态链接发生在构造阶段), Library, Test Case(Component Diagram,UML图) Build Script(代码的物理组织,files,directories,packages,libraries) |
Code Churn(代码变化,增加,修改,删除,版本变更; eg. Git的commit显示修改) |
Software Configuration Item(SCI 配置项),Version(版本V 1.6.1.5,1.6为major,1为minor,5为patch;Verion Control System(VCS);baseline,稳定版本) |
Run-time |
Code Snapshot(快照图,程序运行时内存里变
量层面的状态),Memory dump(内存信息转储) |
Package, Library, Dynamic linking(动态链接), Configuration, Database, Middleware, Network, Hardware(Deployment Diagram) |
Execution trace(执行追踪,log记录程序执行的调用次序,考虑jstack的使用) |
Event log(系统层面的事件日志) |
Procedure Call Graph, Message Graph (Sequence Diagram) Parallel and multithreads/processes Distributed processes |

Null ->Code |
Code->Component |
Build-time->Run-time |
Moment->Period |
Programming/Coding (ADT / OOP) |
Design (ADT / OOP, Reusability(可重用性), Maintainability(可维护性)) |
Install/deploy |
Refactoring(重构) |
Review, static analysis/checking(静态类型检查) |
Build : compile, static link, package, install, clean (Construction process) |
Debug, unit/integration testin (Robustness, 稳健性) |
Version control (SCM), Loading, dynamic linking, interpreting, execution (dumping, profiling, logging) |
1.2 Quality Objectives
软件构造过程中需要考虑的重要质量指标
面向质量指标的软件构造技术
1.2.1 Quality properties
External quality factors
Correctness(正确性) |
Robustness(健壮性) |
Extendibility(可拓展性) |
Reusability(可复用性) |
Compatibility(兼容性)) |
Efficiency(有效性) |
Portability(可移植性)- |
Ease of use(简约性) |
Functionality(功能性) |
Timeliness(及时性) |
Conditional(分层,每一层保证自己的正确性,同时假设其下层是正确的), Testing and dubugging(测试和调试,消除不正确), Defensive programming(防御式编程,确保正确性), Formal approach(形式化方法,check,guarantee,ensure,形式化验证发现问题-自圆其说)(按照预先定义的”规约”执行,至高无上的质量指标) |
react appropriately to abnornal conditions(针对异常情况的处理,对规约定义之外的情形做出恰当反应), Exception handling(出现异常时不能崩溃,未被specification覆盖的情况即为exception) |
Design simplicity(简约主义), Decentralization(分离主义)(对规约进行修改,是否能够容易应对) |
Don’t Re-invent the Wheel(一次开发,多次使用,发现共性) |
Homogeneity of design(保持设计的同构性, standardized) |
balanced(折中优化, 保证正确性,过度优化导致软件不再适应变化和复用) |
various in hardware and software environments(方便在不同技术环境/硬件/操作系统之间移植) |
Structural simplicity, Know the user(容易学,安装,操作,监控,提供详细使用指南) |
Featurism(适当的功能,功能太多极为复杂,不灵活, Agile, SCM) |
In time(及时性,及时发布新版本) |
Tradeoffs
正确的软件开发过程中,开发者应该将不同质量因素之间如何做出折中的设计决策和标准明确的写下来
虽然需要折中,但“正确性”绝不能与其他质量因素折中
1.2.2 Five key quality objectives
Understandability-Elegant and beautiful code(优雅性代码,可理解性) |
Reusability-Design for/with reuse(可复用) |
Maintainability and Adaptability
-Low complexity(低复杂性,可维护性) |
Robustness-Robustness and correctness(健壮性, 正确性) |
Performance-Pertomance and efficiency(效率性) |
|
代码的可理解性(命名,布局,注释,复杂度)(Code Review, Walkthrough-人工走查, Static Code Analysis)(ADT、函数规约),软件、项目的可理解性(包组织,文件组织,命令空间),(其他包括,重构,版本控制,日志trace) |
cheap for develop(开发成本低);ADT/OOP,接口与实现分离;继承、重载、重写;组合,委派;多态;子类型和泛型;OO设计模式;API设计,库,框架 |
ready for changes;模块化设计;聚合度、耦合度;SOLID,GRASP;OO设计模式;基于表格(switch,if表格)、状态(State设计模式)、语法(正则表达式);SCM,version control |
safe from bug;异常、错误处理;断言(Assertion);防御式编程;持续化集成;日志、内存转储分析;Debug测试 |
efficient to run;代码调优(使用设计模式);空间复杂性分析(内存管理);时间复杂度(I/O性能);内存转储分析;GC垃圾回收;分布式系统;使用多线程,并行;代码的性能分析调整 |
|