Objectives of this lecture
§ To know the general process of software development 软件开发的
基本过程
§ To understand the philosophy of traditional software process models including linear and iterative models (waterfall,incremental, prototyping, spiral, and V-model) 传统的软件开过程模型
§ To know and make practice of Agile development 敏捷开发
§ To understand Software Configuration Management (SCM) 软件配置管理
§ To learn how to use Git for daily SCM tasks (basic commands for personal dev., advanced commands for collaborative dev) Git作为配置管理工具
§ Get to know the general process of software construction (Design->Programming-> Debug -> Testing -> Build ->Release) 广义的软件构造过程
§ Use Eclipse IDE as Java construction environment and tools Eclipse作为Java构造工具
§ Get to know typical tools for review and static analysis, debug(dumping, logging) and testing, and dynamic analysis / profiling软件构造各阶段的常见工具
§ Learn the narrow-sense process of software construction (Build:Validate-> Compile -> Link ->Test->Package->Install->Deploy) 狭义的软件构造:build
§ Use one of build tools (make, Ant, Maven, Gradle, Eclipse IDE) tobuild your own Java projects 常见的build工具
Outline
§ Software Development Lifecycle (SDLC)软件开发生命周期
§ Traditional software process models (waterfall, incremental, Vmodel,prototyping, spiral)传统的软件过程模型
§ Agile development and eXtreme Programming (XP)敏捷开发和极限编程
§ Software Configuration Management (SCM)软件配置管理
§ Git as a SCM tool Git是一个配置管理工具
§ Summary
1.Software Development Lifecycle(SDLC)
2.Traditional Software Process Models
·Two basic types:
– Linear 线性过程
– Iterative 迭代过程
·Existing models:
– Waterfall (Linear, non-iterative) 瀑布过程:线性推进,阶段划分清楚,整体推进,无迭代,管理简单,无法适应需求增加/变化
– Incremental (non-iterative) 增量过程:线性推进,增量式(多个瀑布的串行),无迭代,比较容易适应需求的增加
– V-Model (for verification and validation) V字模型:非线性
– Prototyping (iterative) 原型过程:在原型上持续不断的迭代发现用户变化的需求,时间代价高,但开发质量也高。
– Spiral (iterative) 螺旋模型:多轮迭代基本遵循瀑布模式,每轮迭代有明确的目标,遵循“原型”过程,进行严格的风险分析方可进入下一轮迭代
3.Agile Development
·敏捷开发:通过快速迭代和小规模的持续改进,以快速适应变化。
4.Software Configuration Management (SCM) and Version Control System (VCS)
·软件配置项:软件中发生变化的基本单元(例如:文件)
·Version control terminology
§ Repository: a local or remote store of the versions in a project仓库:即于SCM中的CMDB
§ Working copy: a local, editable copy of a project that we can work on工作拷贝:在开发者本地机器上的一份项目拷贝
§ File: a single file in the project 文件:一个独立的配置项
§ Version or revision: a record of the contents of the project at a point
in time 版本:在某个特定时间点的所有文件的共同状态
§ Change or diff: the difference between two versions 变化:即code churn,两个版本之间的差异
§ Head: the current version HEAD:程序员正在其上工作的版本
·VCS:
§ Local VCS:本地版本控制系统:仓库存储于开发者本地机器无法共享和协作
§ Centralized VCS:集中式版本控制系统:仓库存储于独立的服务器,支持多开发者之间的协作
§ Distributed VCS:分布式版本控制系统:仓库存储于独立的服务器+每个开发者的本地机器
5.Git as an example of SCM tool
·Managing changes in software evolution process
·Git repository:
A Git repository has three parts:
– .git directory (a repository storing all version control data) 本地的CMDB
– Working directory (local file system) 工作目录:本地文件系统
– Staging area (in memory) 暂存区:隔离工作目录和Git仓库
每个文件属于以下三种状态之一:
-修改(工作目录下的文件与git repository中的不同,但不是在暂存区域)已修改
-分阶段(文件被修改和已经被修改添加到暂存区域)已暂存
-提交(文件保持相同的工作目录和git目录)已提交
·Commits: nodes in Object Graph
图中的每一个节点都是一次提交
每个commit指向一个父亲
多个commit指向同一个父亲:分支
一个commit指向同一个父亲:合并
HEAD指向当前提交------头指向当前分支,该分支指向当前提交。
$:存储了指向具体文件存储的指针,与之前commit中未发生变化的文件,无需重复储存
·Managing changes in Git
§ Traditional VCS:存储版本之间的变化(行)
§ In Git:存储发生变化的文件(而非代码行),不变化的文件不重复存储
文件未发生变化,则后续多个版本始终指向同一个文件
文件发生变化了,存储两份不同的文件,两个版本指向不同的文件
·Creating and merging branches in Git:
·Git supports collaboration:
6.General process of software construction
(1) Programming
(2) Review and static code analysis
(3) Dynamic code analysis / profiling
(4) Debugging and Testing
(5) Refactoring重构:在不改变功能的前提下优化代码