HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

第二章  软件构造的过程和工具

 

2.1 软件生命周期和配置管理

 

1.软件开发生命周期(SDLC)

 

一个软件系统的组成部分:

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

软件的生命周期:

(1)软件开发生命周期(SDLC):From zero to one,从零到一

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

规划 → 分析 → 设计 → 执行 → 测试&集成 → 维护

(2)软件生命周期中的多个版本:From 1 to n,从一到n

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

例子:Microsoft Windows(1985-2016)

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

软件是否是活着的?

(1)当然啦!任何软件都有自己的生命

软件的“年龄”:它被生产和使用了多久

软件的“活力”:在特定时间内,它受到市场和用户的欢迎程度

(2)期望:

在任何时间都持久且充满活力

(3)然而:

i.软件开发失败(从0开始,未到1)

ii.执行期间满是故障/错误

iii.软件老化/衰退(有效性较低)

iiii.软件的死亡

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

软件的生命模式

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

软件开发生命周期(SDLC)

这将在“软件过程和工具”(软件工程第3年的课程)中进行研究

 

2.传统的软件过程模型

 

传统的软件过程模型

 

(1)两种基本类型

线性、迭代

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

(2)现有的模型

瀑布模型、增量模型、V模型、原型法、螺旋模型

(3)关键质量考虑

用户参与(适应变化)、开发效率、项目管理复杂性、软件质量

 

瀑布(顺序,非迭代)

(1)在构思,启动,分析,设计,施工,测试,实施和维护阶段,进展被视为稳定下行(如瀑布)。

(2)易于使用,但事后更改的代价更高

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

增量(非迭代)

(1)该产品被增量性的设计、实施、测试(每次增加一点点),直到项目完成

(2)它逐渐的应用瀑布模型

i.系统被分解成许多迷你的开发项目

ii.部分系统被用于生成最终系统

iii.首先处理最高优先级的要求

iiii.增量部分开发后,要求被冻结

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

V模型(用于证明和确认)

(1)V模型代表了可以被认为是瀑布模型的扩展的开发过程

i.代替以线性方式向下移动,处理步骤在编码阶段之后向上弯曲,以形成典型的V

ii.演示开发生命周期的每个阶段与其相关测试阶段之间的关系

iii.水平轴和垂直轴代表时间或项目的完整性(从左到右)和抽象水平(最粗颗粒抽象最高)

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

原型(迭代)

(1)软件原型设计是创建软件应用程序原型的活动,即正在开发的软件程序的不完整版本。

i.原型通常模拟最终产品的几个方面,并且可能完全不同于最终产品

(2)过程:

i.确定基本要求:包括所需的输入和输出信息。通常可以忽略细节。

ii.开发初始原型:开发的初始原型仅包含用户界面

iii.审查:客户(包括最终用户)检察原型并提供有关添加或变更的反馈

iiii.修改和增强原型:使用反馈可以改进规格和原型。如果引入了更改,则可能需要重复步骤3和4

优点:

i.软件设计者和实施者可以在项目早期从用户那里获得有价值的反馈

ii.根据被建立的软件系统,客户可以比较制作的软件是否符合软件规范

iii.它还使软件工程师能够对初始项目估算的准确性以及提出的最后期限和里程碑是否能够成功实现有所了解。

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

螺旋(迭代)

螺旋模型是软件项目的风险驱动过程模型生成器基于给定项目的独特风险模式,螺旋模型可以指导团队采用一个或多个过程模型的元素,如增量式,瀑布式或演化原型。

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

3.敏捷开发

 

敏捷开发

(1)它倡导适应性规划,演化发展,早期交付和持续改进,并鼓励对变化做出快速灵活的反应

i.“人”以及“人与人的互动”胜过“过程”和“工具”。自我组织和动机非常重要。

ii.“可运行的软件”胜过“面面俱到的文档”。工作软件比在会议中向客户呈现文档更有用,也更受欢迎。

iii.“客户合作”胜于“合同谈判”。在软件开发周期开始时,不能完全收集需求,因此持续的客户或利益相关者的参与是非常重要的

iiii.“相应变化”胜于“遵循计划”。敏捷方法专注于快速响应变化和持续发展

 

敏捷开发:交货迅速

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

瀑布vs敏捷

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

极限编程(XP)

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

结对编程

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

任务板和进度监控

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

4.协作软件开发

 

开源

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

开源开发模式

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

模式细节

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

5.软件配置管理(SCM)和版本控制系统(VCS)

 

软件配置管理(SCM)

(1)SCM是追踪和控制软件变化的活动

(2)供应链管理实践包括修订控制和基线的建立

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

一个配置项目的生命周期(CI)

(1)软件的任何组成部分(源代码,数据,文档,硬件,各种环境)可随着软件生命周期中的时间一起更新

(2)软件配置项目(SCI):SCM的基本结构单元

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

配置项目(SCI)和基线

(1)基线是在某个时间点上对产品属性的商定描述,该描述是定义变化的基础

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

CMDB和签入/签出审核

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

版本

(1)软件版本控制是将唯一版本名称或唯一版本号分配给计算机软件的独特状态的过程

i.在给定的版本号类别(主要,次要)中,这些数字通常按照递增顺序进行分配,并与软件中的新发展相对应

ii.在细粒度级别,版本控制通常用于跟踪不同版本的电子信息增量,无论这些信息是否属于计算机软件

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

为什么需要版本控制——对于个人

(1)恢复到最后的版本

(2)比较两个不同的版本

(3)推送完整的历史版本到另一个位置

(4)从那个位置拉回历史

(5)合并早期版本的衍生版本

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)


 

为什么需要版本控制——对于团队合作

(1)多个开发者之间交流,分享,合并工作成果

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

(2)记录不同开发人员的个人工作成果以进行审核

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

分支和进化图(SCI或系统的)

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

分支

(1)对于一部分开发人员来说,有时候开发人员在不同分支上工作是有意义的,这是一个并行的代码体系,例如试验一个新功能

(2)其他开发人员不想在新功能完成之前插入新功能,即是在此之间创建了多个协调版本

(3)即使是单个开发人员,也可能发现创建分支是很有用的

(4)一般来说,交换项目状态时有很多共享位置是有用的。可能有多个分支位置,每个分支位置由几个程序员共享。通过正确的设置,任何程序员都可以从任何位置拉出或推送到任何位置,从而在合作模式中创造出极大的灵活性

 

版本控制系统(VCS)

(1)本地VCS

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

2)集中式VCS(例如CVSSVN

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

3)分布式VCS(例如git

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

版本控制术语

(1)仓库:本地或远程存储项目中的版本

(2)工作副本:我们可以使用的项目的本地可编辑副本

(3)文件:我们项目中的单个文件

(4)版本或修订:在某个时间点记录我们项目的内容

(5)更改或差异:两个版本之间的不同

(6)当前状态下的最后一次提交(Head):当前版本

 

版本控制系统的特点

(1)可靠:只要我们需要,就可以保存版本;允许备份

(2)多个文件:跟踪项目的版本,而不是单个文件

(3)有意义的版本:有什么变化?为什么被制作?

(4)还原:恢复全部或部分旧版本

(5)版本比较

(6)审查历史:对于整个项目或个别文件

(7)不只是代码:文章,图像……

 

版本控制系统的特点

允许多个人一起工作

(1)分治:合并偏离当前通用版本的版本

(2)跟踪责任:谁做出了这样的改变?谁碰了这段代码?

(3)并行工作:允许一个程序员独立工作(在不需要放弃版本控制的情况下)

(4)工作正在进行:允许多个程序员共享未完成的工作(不中断别人,不放弃版本控制)

 

6.SCM工具的一个例子——git

 

什么是git?

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

管理软件演变过程中的变化

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

Git仓库

(1)一个Git仓库有三个部分

i..git目录(存储所有版本控制数据的存储库)

ii.工作目录(本地文件系统)

iii.暂存区(在内存中)

(2)每个文件都从属于以下三种状态之一

i.Modified:文件目录中的文件与Git存储库中的文件不同,但不在临时区域中

ii.Staged:文件已修改并已添加到暂存区

iii.Commited:该文件在工作目录中和在Git目录中保持相同

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

Git中的对象图

(1)我们使用git进行的所有操作——克隆,添加,提交,推送,记录,合并,是对图数据结构进行的操作,该结构存储项目中文件的所有版本以及描述这些更改的所有日志条目

(2)Git对象图存储在存储库的.git目录中

(3)从另一台机器/服务器复制git项目意味着复制整个对象图

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

Git对象图是什么样的?

对象图是Git项目的历史,是一个有向无环图(DAG)

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

提交:对象图中的结点

(1)每个提交都是我们整个项目的快照,Git用树节点表示。对于任何合理大小的项目,大多数文件在任何给定修订中都不会改变。存储冗余的文件副本将是浪费的,所以Git不这样做。(不重复保存各种本本没有发生变化的文件)

(2)相反,Git对象图存储了单个文件的每个版本,并且允许多次提交一份副本(每个文件的每个版本只保存一次,多个提交可共享副本)

(3)每个提交还包含日志数据——谁,何时,短日志消息等。

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

管理Git中的更改

(1)传统的VCS

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

2)在Git

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

提交:对象图中的结点

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

使用git commit添加到对象图中

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

使用git push和git pull发送和接收对象图

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

Git支持分支和合并

(1)分支是在版本控制下复制对象,以便修改可以沿着两个分支同时进行

(2)将两个分支合并在一起

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

在Git中创建和合并分支

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)       HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

Git支持协作

(1)本地存储库和远程存储库

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

Github

(1)Github:一个基于网络的Git服务器和互联网托管服务

i.它提供了Git的所有分布式版本控制和SCM功能以及添加了属于自己的功能

ii.它为每个项目提供访问控制和多种协作功能,例如错误跟踪,功能请求,任务管理和wikis(维基)

iii.私人和免费的存储库(对于开源项目)

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

Github工作流程

(1)基本流程:提交,分支和合并

(2)协作流程:fork and pull request

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

问题跟踪和拉取请求

HIT Software Construction Review Notes(2-1 Software Lifecycle and Configuration Management)

 

 

总结:

(1)一般软件开发生命周期(SDLC)

(2)传统的软件过程模型:瀑布,增量,原型,迭代

(3)敏捷开发

(4)协作软件开发

(5)软件配置管理(SCM)

(6)SCM工具——Git


参考资料:HIT软件构造课程,MIT软件构造课程