Java软件构造©Day1
Day1 26th, February
标签(空格分隔): Java程序构造
概况
基本信息
学期进程
第一章
1.1Multi-Dimensional Views of Software Construction
三个角度看待程序开发
- By phases: build-time run-time
- By dynamics: moment period
By level: code component
-
多维度软件看法
- build run-time
- 特定时刻和长周期
- 代码层次 结果
- 元素 关系 模式
- view的转变
Reading:《Code Complete》程序大全
Constitutes of a software system
| 软件构造 | 层次 |
|---|---|
| Programs | 主要 |
| Data | 主要 |
| Documents | 主要 |
| Users | |
| Business Obj | |
| Social Environment | |
| Tec Env | |
| Hardware/Network |
Build-time views of a software sys
Code level
- functions
- classes
- methods
- interfaces
Component level
Java程序的主要组成
- files
- directories
- packages
- libraries
Moment view
静态时刻的程序观点
Period view
时间段的程序观点
Build-time, moment and code-level view
Three inter-related forms:
源代码的层次隶属于物理逻辑层次 内部分为三个关联的层面
- 词汇层面
- 语法层面 例如AST抽象语法树
Hello World的AST树
- 语义层面
Build-time, period, and component-level view
- 软件实体随时间独立演化
- SCI(Software Configuration Item 软件配置项)
- 版本控制
Runtime views of a software system
运行时主要有两个
- Code-level view: 在内存中软件状态的更新
- Component-level view: 程序结构 程序怎样在自己的环境中展开的(系统环境 分布式 硬件)
Run-time, moment, and code-level view
- 快照 专注于在靶机上变量层次在内存中的状态
- Fine-grained states of a program
Memory dump 内存信息转储
把JVM某个时间点的内存快照转储为一个文件
Run-time, period and code-level view
Sequence diagram in UML
Execution tracing 执行踪迹
用日志的方式记录程序执行的调用过程
Run-time, moment, and component-level view
Deployment diagram in UML
Run-time, period, and component-level view
系统层次的事件日志
Software construction: transformation between views
-
∅⇒ Code- Programming / Coding(Chapter 3 ADT/OOP)
- Review, static analysis / Checking(Chapter 4 Understandability)
- Code
⇒ Component- Design(Chapter 3 ADT/OOP;Chapter 5 Reusability;Chapter 6 Maintainability)
- Build: compile, static link, package, install, clean (Chapter 2 Construction process)
- Build-time
⇒ Run-time- Install / deploy (Course in the 3rd year)
- Debug, unit/integration testing (Chapter 7 Robustness)
- Moment
⇒ Period- Refactoring (Chapter 9 Refactoring)
- Version control (Chapter 2 SCM)
- Loading, dynamic linking, interpreting, execution (dumping, profiling, logging) (Chapter 8 Performance)
1.2Quality Objectives of Software Construction
概述
Outline
- 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
Reading:代码大全第20章 软件工程:实践者的研究方法第14章 Object-Oriented Software Construction第1章
Quality properties of software systems
- 外部质量因素影响用户
- 内部质量因素影响软件和开发者
- 外部质量取决于内部质量
External quality factors
Extrenal 1 Correctness
程序的正确性是最高标准
- 测试 调试 发现不正确消除不正确
- 防御式编程 在开始编写时就是正确的
- 形式化方法 形式化验证
External 2 Robustness
- 程序的健壮性 针对异常情况的处理
- 健壮性是对正确性的补充
- 软件的行为要严格符合规约中指出的情况
- 对于规约之外的情况 要做出适当的反应
出现异常时不能够崩溃
针对健壮性中的异常定义:对于程序规约之外的任何情形均视为异常情况 均需要设置异常处理
External 3 Extendibility
可扩展性:对软件的规约进行修改 这种修改是否足够容易
External 4 Reusability
可复用性:一次开发 多次使用
External 5 Compatibility
兼容性:不同的软件系统之间相互可以容易集成 甚至是文件格式的兼容性
保持设计的同构性 标准化
External 6 Efficiency
性能毫无意义 除非有足够的正确性 对性能的关注要与其他质量因素进行折中
过度的优化会导致失去可扩展性和可复用性
过早的优化是万恶之源
External 7 Protability
可移植性:软件可方便的在不同的技术环境之间移植
External 8 Easy to use
易用性:易学 易安装 易操作 易监控 要给用户详细的使用文档
External 9 Functionality
实用性:程序可能会因为加入新的功能造成程序不易使用 极其复杂
要保证程序的实用性 保证其他因素的高水平
External 10 Timeliness
及时性:程序能够在用户需要的时间之前release 及时进行版本更新
External 11+ Other factors
- Verifiability 可验证性
- Integrity 完整性
- Repairability 可修复性
- Economy 经济性
稍后更新