---
title: "【管理规范】软件配置管理（SCM）的一些琐碎概念【TOPOST】"
author: "Perrin Yong"
author_profile: https://www.pystone.net/profile/
published_by: "Perrin Yong"
canonical: https://www.pystone.net/notes/software-configuration-management-concepts/
type: note
content_role: unspecified
visibility: public
id_stability: rename-stable
source_path: "10-计算机、信息技术与工程/03-软件工程与质量保障/CI-CD与质量保障/CI-CD工具链/【管理规范】软件配置管理（SCM）的一些琐碎概念【TOPOST】.md"
content_hash: a8fb370482c44ff917b533bc9b71071146f6fc69a9a3d78f314e0a3bbb7b0a06
knowledge_version: 224c990773de.5fa8af6e39fa
site_commit: 224c990773de166d23a886306577dd90379529ce
notes_commit: 5fa8af6e39fa3891d1b9b4832bfa6c4e0ecaaf0a
---
# 【管理规范】软件配置管理（SCM）的一些琐碎概念【TOPOST】

﻿# 【管理规范】软件配置管理（SCM）的一些琐碎概念【TOPOST】


> 创建时间：2020/4/30 15:32

**说明：可以完善我们在软件开发中的一些管理规范**

## SCM
软件配置管理 （Software Configuration Management, SCM）
参考[立师兄Linty的博文](https://www.jianshu.com/p/f8d81680a7cf)

### 定义

> **IEEE定义** A discipline applying technical and administrative direction and surveillance to identify and document the functional and physical characteristics of a configuration item, control changes to those characteristics, record and report change processing and implementation status, and verify compliance with specified requirements.
>
> 软件配置管理，是关于软件资产的管理。
>  软件 = 源代码 + 文档。
>  源代码、设计文档、可以运行的程序等在软件研发过程中产生的有价值的东西，都是软件资产。

是一种应用于整个软件工程过程的标识、组织和控制修改的围绕软件资产的管理技术。

软件配置管理，又称软件形态管理、或软件建构管理，简称软件形管。界定软件的组成项目，对每个项目的变更进行管控（版本控制），并维护不同项目之间的版本关联，以使软件在开发过程中任一时间的内容都可以被追溯，包括某几个具有重要意义的数个组合。

### 原因

在软件建立时变更是不可避免的，而变更加剧了项目中软件开发者之间的混乱。SCM活动的目标就是为了标识变更、控制变更、确保变更正确实现并向其他有关人员报告变更。从某种角度讲，SCM是一种标识、组织和控制修改的技术，目的是使错误降为最小并最有效地提高生产效率。

从流程角度看，软件配置管理是整个软件开发生命周期中一个非常核心的管理过程。配置管理实际贯穿了从 **需求分析、架构设计、项目管理、开发、集成构建、测试以及上线** 的全过程。这一过程不仅涉及 **宏观** 的项目进度控制、配置管理规范及计划、多地点开发规划等，也包括更细粒度的分支模型、构建及集成方式、变更处理流程，还包括 **微观** 的与开发人员直接相关的版本控制、差异比较和归并等。

> 软件资源管理的特点：
>
>   * 软件也是配置起来的。各个源文件、源代码和正确的文档搭配起来，编译产生正确的可以运行的程序。
>   * 软件更容易发生变化，是向前演进的。
>   * 软件的相关性（耦合）更高，一旦需要改动，通常不是只更改一个文件。

> 关键词
>  Version Control - 版本控制
>  Change Control - 变更控制
>  Process Support - 过程支持

### 术语

> 版本是表示一个配置项具有一组定义的功能的一种标识。随着功能的增加，修改或删除，配置项的版本随之演变。

版本以版本号进行标识。

**版本号 Version Number** ：为简略的表达特定版本的目的和意义，为方便区分不同的版本，我们需要版本号这个概念。又称作版本标识。
**版本库** ：也叫 **存储库** ， **Repository** 。在版本库里，存储源代码的各个版本。当然存储的是不同版本见有差异的部分，增量存储。
**检入，check in** 代码修改完了以后，需要告知版本控制工具，将新的代码保存到版本库中。
**检出，chekc out** 代码修改前，需要先告知版本控制工具，讲版本库中的代码复制到本地。

### 软件配置管理的组织

项目经理 PM: Project Manager
变更控制委员会 CCB: Change Control Board
软件配置工程师 CMO: Configuration Management Officer
系统集成工程师 SIO: System Integration Engineer
软件开发工程师 DEV: Software Engineer
软件测试工程师 QA: QA Engineer / Tester

### 实践要点

版本控制
代码构建
持续集成
并行开发
管理文档
跟踪缺陷
管理变更

### 主流工具

Borland StarTeam
IBM Rational ClearCase
VSS (Microsoft Visual SourceSafe)
TFS (Microsoft Team Foundation Server)
CVS (Concurrent Versions System)
SVN (Subversion)
Git

## 版本管理规范

### Semantic Versioning (SemVer)版本规范

**MAJOR.MINOR.PATCH**

  * **MAJOR** introduces one or more breaking changes(incompatible API changes)

  * **MINOR** introduces one or more backward-compatible API changes(add functionality)

  * **PATCH** only introduces bug fixes with no API changes at all.

### Alpha、Beta、RC、GA、Release

  * Alpha - 内部测试版。α是希腊字母的第一个，表示最早的版本，一般用户不要下载这个版本，这个版本包含很多BUG，功能也不全，主要是给开发人员和 测试人员测试和找BUG用的。

  * Beta - 公开测试版。β是希腊字母的第二个，顾名思义，这个版本比alpha版发布得晚一些，主要是给“部落”用户和忠实用户测试用的，该版本任然存 在很多BUG，但是相对alpha版要稳定一些。这个阶段版本的软件还会不断增加新功能。如果你是发烧友，可以下载这个版本。

  * RC - Release Candidate（发行候选版本）该版本又较beta版更进一步了，该版本功能不再增加，和最终发布版功能一样。这个版本有点像最终发行版之前的一个类似 预览版，这个的发布就标明离最终发行版不远了。作为普通用户，如果你很急着用这个软件的话，也可以下载这个版本。

  * GA(general availability) - 首次发行稳定的版本，GA意味着General Availability，也就是官方开始推荐广泛使用了

  * R(Release) - 最终交付用户使用的一个版本。该版本有时也称为标准版。

  * stable版：稳定版。在开源软件中，都有stable版，这个就是开源软件的最终发行版，用户可以放心大胆的用了。

## 版本控制方案

### 本地版本控制系统（文件夹）

将文件复制到另一个目录(可能是一个时间标记的目录,如果他们是聪明的)。
简单
很容易出错，可能会丢失，毕竟是本地的。

### 集中式版本控制(CVCS, Centrailized Version Control System)

![@图片来源: faun.pub/centralized-vs-distributed-version-control-systems-a135091299f0](/media/6a6c84262654072fe654.png)

图片来源: faun.pub/centralized-vs-distributed-version-control-systems-a135091299f0

There is a single “central” copy of your project somewhere (probably on a server), and programmers will “commit” their changes to this central copy.
“Committing” a change simply means recording the change in the central system. Other programmers can then see this change. They can also pull down the change, and the version control tool will automatically update the contents of any files that were changed.

Tools：Subversion (or SVN)，Perforce

benefits

  * easier to understand and use

  * can grant access level control on directory level

  * performs better with binary files

### 分布式版本控制(DVCS, Distributed Version Control Systems)

![@faun.pub/centralized-vs-distributed-version-control-systems-a135091299f0](/media/f6246bda80971a580d6c.png)

faun.pub/centralized-vs-distributed-version-control-systems-a135091299f0

In distributed version control, every developer **“clones” a copy of a repository and has the full history of the project on their own hard drive**. This copy (or “clone”) has all of the metadata of the original.

分布式版本控制系统也有中心库：in most cases you have one central server which is an authoritative one.

> since Git is a DVCS, there is no such thing as a central repo at a technical level.
>  origin is only considered to be the central one.

![Alt text](/media/a31b6283b8e44d54aba3.png)

适用于大多数文件是 plain text files 的情况。

Tools: Git

benefits:

  * Performance of distributed systems is better

  * Branching and merging is much easier

  * With a distributed system, you don’t need to be connected to the network all the time (complete code repository is stored locally on PC)

客户端不只是检查出文件的最新快照：他们是完全镜像的存储库（本地有仓库，这就是分布式的意义）。因此，如果出现上述问题，任何客户机库的可复制备份到服务器，以恢复它。
每一个克隆确实是所有数据的完整备份(除了没有push的代码，这个也是理所当然的)。

> 外类似git这样的分布式版本管理系统,能更好的去处理你在多个远程仓库上的工作。这样是你可以同时去和多个团队去写作开发。这允许您设置几种类型的工作流。

## Git vs. SVN

![@www.tabnine.com/blog/svn-vs-git/](/media/e947866e17d97f4ffc7a.png)

www.tabnine.com/blog/svn-vs-git/

![@www.tabnine.com/blog/svn-vs-git/](/media/cefc8783d16694811577.png)

www.tabnine.com/blog/svn-vs-git/

### SVN

Subversion是一个自由，开源的版本控制系统。SVN has a separate server and client. Only the files a developer is working on are kept on the local machine, and the developer must be online, working with the server. Users check out files and commit changes back to the server.

Advantages:
**Its performance with large files won’t be satisfied with Git.**
it is efficient in handling network traffic
assuring synchronization between teams and developers
much faster than with Git
Better handling of binary files - **Lock-Modify-Unlock model**
Access control
SVN repositories can handle large binary files, in addition to code.

> binary files are unmergeable. By allowing a user to programmatically claim the exclusive right to change a file in the repository, that user can be reasonably confident that any energy he invests on unmergeable changes won’t be wasted—his commit of those changes will succeed.
>  Lock-Modify-Unlock model: <https://svnbook.red-bean.com/en/1.8/svn.advanced.locking.html>

### Git

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git software is installed on a workstation and acts as a client and a server. Every developer has a local copy of the full version history of the project on their individual machine. Git changes happen locally. So, the developer doesn’t have to be connected all the time. Once all the files are downloaded to the developer’s workstation, local operations are faster.

git可离线完成大部分操作,svn则不能。
git有着更优雅的分支和合并实现。
git有着更强的撤销修改和修改历史版本的能力

Disadvantages:
Slower than svn - Due to it being distributed, you have to download all changes, even if those changes add gigabytes of useless assets that have since been deleted from the branch.
Git repositories can’t handle large binary files.

### About branches

**SVN branches** are created as directories inside a repository. This directory structure is the core pain point with SVN branching. When the branch is ready, you commit back to the trunk.

**Git branches** are only **references to a certain commit**. They are lightweight — yet powerful. You can create, delete, and change a branch at any time, without affecting the commits.

## Ref

<https://faun.pub/centralized-vs-distributed-version-control-systems-a135091299f0>
<https://www.perforce.com/blog/vcs/git-vs-svn-what-difference>
<https://www.jianshu.com/p/f8d81680a7cf>
<https://zhuanlan.zhihu.com/p/164513884>
<https://blog.51cto.com/13178102/2358114>
<https://semver.org/>
