Chapter 2: Process and Tools of Software Construction
2.1 Software Lifecycle and Configuration Management
第一章讲述了软件构造的结果
第二章介绍具体流程,版本控制,重点介绍了git 和 github 的原理
Traditional Software process models (传统设计模型)
软件设计的一般流程有以下几类:
linear :
Iterative:
– Waterfall (Linear, non-iterative) 瀑布过程
– Incremental (non-iterative) 增量过程
– V-Model (for verification and validation) V字模型
– Prototyping (iterative) 原型过程
– Spiral (iterative) 螺旋模型
其实上述设计流程总的归结起来就是线性模式和迭代模式的综合引用,迭代模式能够使得程序能够更好的适应用户需求变化,但是消耗成本也较大,线性模式是按照计划,一步步进行,思路清晰简单,但是适应性较差。
Agile development(敏捷开发)
通过持续迭代和小规模改进,达到快速开发的目的
(其实没太看懂)
Software Configuration Management (SCM) and Version Control System (VCS)(版本控制)
首先给出版本控制的术语,有助于我们理解Git 的原理
曾经程序员编程是通过copy+rename的方式来达到版本控制,但是随着程序规模的扩大,这种方式显然阻碍了效率的提升。同时对于组队编程十分不友好,对于大型项目,多人组队,我们需要一种更加有效的版本控制工具。
这里就推出Git+github 组合配套工具
在讲述git之前我们需要先了解版本控制系统的演化进程:
上述三张图片清晰地反映了版本控制系统从单人到多人协作的演化历史。到现在分布式版本控制系统就是Git的处理方式,分为本地库和远程库两个仓库,本地库中保存着个人的文档,远程库中保存着小组(个人)的代码。
首先看一下使用Git进行版本控制的基本流程:
对于需要的文件夹使用命令:
git init
即可创建将当前文件夹初始化为本地库,注意到文件夹中多出了.git文件夹(一般是隐藏的):
一般来说git repository中包含:
– .git directory(.git文件夹) (a repository storing all version control data) 本地的CMDB
– Working directory (local file system) 工作目录:本地文件系统
– Staging area (in memory) 暂存区:隔离工作目录和Git仓库
而文件夹中的每一个file都处于以下三种状态:
– Modified (the file in working directory is different from the one in git repository, but is not in staging area) 已修改
– Staged (the file is modified and has been added into the staging area) 已暂存
– Committed (the file keeps same in working directory and git directory) 已提交
正好对应了以下操作:
git add .
git commit -m "first commit"
同时.git 文件夹中还会包含Git object graph,在git上的所有操作(add commit rm push log merge)都是对object graph 这个数据结构的操作。每一个commit会被当成graph中的节点,它表示软件版本演化的关系:
通过以下命令在我的本地库中查看版本演化的object graph
git log --oneline --decorate --color --graph
Git 管理分支合并:
注意:Git 为了不浪费储存空间给,只会记录变化的文件,未变化的文件会用使用指针共用。
Github作为remote repository:
2.2 Process, Systems, and Tools of Software Construction
这一小节相对于2.1介绍的更加具体:即我们在实际开发软件的时候IDE,分析工具,build工具的选择,软件从设计到打包发布的过程。
广义软件构造过程:
Design – Programming – Debug – Testing – Build – Release
狭义软件构造过程:
Build: Validate – Compile – Link – Test – Package – Install --Deploy
IDE(集成开发环境):
– Source code editor with intelligent code completion, code refactoring tool 源代码编辑器、智能代码补全工具、代码重构工具
– File management tool 文件管理
– Library management tool 库管理
– Class browser, object browser, class hierarchy diagram 软件逻辑实体可视化
– Graphical User Interface (GUI) builder 图形化用户界面构造器
– Compiler, interpreter 编译器、解释器 – Build automation tools 自动化build工具
– Version control system 版本控制系统
– Extensible by more external third-party tools 外部的第三方工具
java IDE:
- IDEA
- Eclipse