Skip to Content
Python高级编程(第2版)
book

Python高级编程(第2版)

by Posts & Telecom Press, Michał Jaworski, Tarek Ziadé
February 2024
Intermediate to advanced
423 pages
6h 9m
Chinese
Packt Publishing
Content preview from Python高级编程(第2版)

第8章 管理代码

和多个人一起开发软件,是比较困难的。一切都变慢了,而且举步维艰。出现这种问题,原因有很多。本章将揭示这些原因,并将尝试提供一些方法来对抗它们。

本章分为两部分,分别解释:

  • 如何使用版本控制系统。
  • 如何建立持续的开发过程。

首先,因为代码库的规模急剧扩张,所以,跟踪所有的变化就显得非常重要,尤其是当许多开发人员使用它时。这就是版本控制系统的作用。

接下来,几个没有直接联系在一起的聪明人仍然可以在同一个项目上工作。他们有不同的角色并且做着不同方面的工作。然而,缺乏全局可见性可能会造成很多困惑,不知道将要做什么也不清楚别人在做什么。这是不可避免的,但是使用一些工具可以提供连续的可见性,并缓解这些问题。使用一些持续开发过程工具,诸如持续集成或持续交付,就可以完成。

现在我们将详细讨论这两个方面。

版本控制系统(Version Control System,VCS)提供了共享,同步和备份任何类型文件的方法,它们分为两类。

  • 集中式系统。
  • 分布式系统。

集中式版本控制系统基于保存文件的单个服务器,并允许人们签入和签出对这些文件所做的更改。原理很简单,每个人都可以得到他/她的系统上的文件的副本,然后对它们进行更改。从那里,每个用户可以向服务器提交(commit)他/她的更改。这些更改就会生效,修订版本(revision)号也随之增加。其他用户可以通过更新(update)同步他们仓库(repository)的副本来获取这些更改。

仓库贯穿所有的提交,系统将所有修订版本存档到数据库用以撤销任何更改,也可以提供已完成的操作的信息,如图8-1所示。

在集中式配置中的每个用户负责将他/她的本地仓库与主仓库同步以便获得其他用户的更改。这意味着当本地修改的文件被其他人更改和签入时,可能会发生一些冲突。在用户系统上,有一种冲突解决机制可以处理这种情况,如图8-2所示。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Hadoop实际解决方案手册

Hadoop实际解决方案手册

Posts & Telecom Press, JONATHAN OWENS, Lentz Jon, Femiano Brian
TensorFlow机器学习

TensorFlow机器学习

Posts & Telecom Press, Quan Hua, Shams Ul Azeem, Saif Ahmed
Python和NLTK实现自然语言处理

Python和NLTK实现自然语言处理

Posts & Telecom Press, Nitin Hardeniya
Kafka权威指南(第2版)

Kafka权威指南(第2版)

Gwen Shapira, Todd Palino, Rajini Sivaram, Krit Petty

Publisher Resources

ISBN: 9781835887745