3. Software Engineering - software configuration-management

55
Software Configuration Management Source Control Repositories for Enabling Team Working Doncho Minkov Telerik Software Academy academy.telerik.com Technical Trainer http://minkov.it academy.telerik.com/.../software-engineering

description

Source Control SystemsTelerik Software Academy: http://academy.telerik.com/school-academy/meetings/details/2011/09/27/software-engineeringThe website and all video materials are in BulgarianSystems for Software Configuration Management (SCM); Version Control; Basic notions and principles; Versioning Models; Lock-Modify-Unlock; Copy-Modify-Merge; Tags and Branching

Transcript of 3. Software Engineering - software configuration-management

Page 1: 3. Software Engineering - software configuration-management

Software Configuration Management

Source Control Repositories for Enabling Team Working

Doncho Minkov

Telerik Software Academyacademy.telerik.com

Technical Trainerhttp://minkov.it

academy.telerik.com/.../software-engineering

Page 2: 3. Software Engineering - software configuration-management

Table of Contents1. Systems for Software

Configuration Management (SCM)

2. Version Control Basic notions and principles

3. Versioning Models Lock-Modify-Unlock Copy-Modify-Merge

4. Tags and Branching

Page 3: 3. Software Engineering - software configuration-management

Software Configuration Management (SCM)

Version control ≈ Software Configuration Management A discipline of the software

engineering Consists of techniques, practices

and tools for their application Mechanisms for management,

control and accounting of the changes.

Defines the process of change Keeps track of what is happening in

the project Solves conflicts in the changes

Page 4: 3. Software Engineering - software configuration-management

Why do We Need SCM?

To control the process of software development: Many people working on the same

source code or document Concurrent access management

Projects with many builds and releases

Tracking the evolution of the software throughout the project: Status, progress, defects,

functionality

Page 5: 3. Software Engineering - software configuration-management

Advantages of SCM Systems

Control of changes Control over the product

development and changes Indicating the progress

Tracking of the status of the separate components and

Review and audit Possibility of changes reviewing

Build control Track the builds and the info about

them

Page 6: 3. Software Engineering - software configuration-management

Advantages of SCM Systems (2)

Process control Track the development process

Team working Easier to cooperate with the other

team members

Page 7: 3. Software Engineering - software configuration-management

Source Code

Models

BuildScripts,

FinalProduct

Text Scripts

and Data

The Final Product

Requirements

Implementation

DesignRelease

Testing Analysis

Release

SCM

SCM and the Software Development Process

Page 8: 3. Software Engineering - software configuration-management

The Market of SCM

Products

Page 9: 3. Software Engineering - software configuration-management

The Market of SCM Products

Process-centric software configuration management

Software configurationmanagement (SCM)

Version control

Application life-cyclemanagement (ALM)

Page 10: 3. Software Engineering - software configuration-management

Version Control Systems

Functionality File versions control Simple merge and differences search Branching File locking Console and GUI clients

Well known products CVS, Subversion Git, Mercurial Perforce, TFS

Page 11: 3. Software Engineering - software configuration-management

SCM Systems Functionality

Groups of documents control Better merge and differences search Work space control Workflow control Build and release control

Well known products Borland StarTeam Standard IBM Rational ClearCase MKS Source Integrity Serena ChangeMan Professional

Page 12: 3. Software Engineering - software configuration-management

Process-Oriented SCM Systems

Functionality Process, Design and implementation

templates Requirements Control Issue tracking Tasks and task changes control Permission control (clients, groups, …) Analytical tools and progress reports

Well known products Borland StarTeam Standard IBM Rational ClearCase MKS Source Integrity

Page 13: 3. Software Engineering - software configuration-management

Application Lifecycle Management (ALM)

Systems Functionality Close integration of processes with the

tools for their usage Design tools Development tools Testing tools Project control tools

Better known products Microsoft Visual Studio Team System

Server Borland StarTeam Enterprise

Advantage Telelogic SYNERGY

Page 14: 3. Software Engineering - software configuration-management

Version ControlManaging Different Version

of the Same File (Document)

Page 15: 3. Software Engineering - software configuration-management

Version Control Constantly used in software engineering While working with documents During software development

Changes are identified with an increment of the serial number “version number”, for example 1.0,

2.0, 2.17 Version numbers are historically linked with the person who created them

Page 16: 3. Software Engineering - software configuration-management

Change Log

Systems for version control keep a complete change log The date and hour of every change

is stored The user who made the change is

stored Old versions can be retrieved, examined and compared

It is possible to return to an old version (revert)

Page 17: 3. Software Engineering - software configuration-management

Vocabulary Repository

A server that stores the files (documents)

Keeps a change log Revision, Version

Individual version (state) of a document that is a result of multiple changes

Check-out Retrieves a working copy of the

files from the repository into a local directory

It is possible to lock the files

Page 18: 3. Software Engineering - software configuration-management

Vocabulary (2) Change

A modification to a local file (document) that is under version control

Change List A set of changes to multiple files

that are going to be committed at the same time

Commit, Check-in Applying the changes made on the

work copy to the files in the repository

Automatically creates a new version

Conflicts may occur!

Page 19: 3. Software Engineering - software configuration-management

Vocabulary (3) Conflict

The simultaneous change to a file by multiple users

Automatic and manual solving Update, Get Latest Version

Checking-out the changed files from the repository to a local directory

Undo Check-out Cancels the changes to a group of

files Restores their state from the

repository

Page 20: 3. Software Engineering - software configuration-management

Vocabulary (4) Merge

Combining the changes to a file simultaneously made by different users

Can be automated in most cases Label, Tag

Labels mark with a name a group of files in a given version

For example a release Branching

Division of the repositories in a number of separate work flows

Page 21: 3. Software Engineering - software configuration-management

Version Control: Typical Scenario

Users RepositoryMain developmentline

User A

User B

Version B Branch

Version A Branch

Version A.1 BranchCheck Out

A

Check Out

B

Merge

D

Check In

C

Check InE

Page 22: 3. Software Engineering - software configuration-management

Versioning Models

Lock-Modify-Unlock andCopy-Modify-Merge

Page 23: 3. Software Engineering - software configuration-management

Versioning Models Lock-Modify-Unlock:

Only one user works on a given file at a time no conflicts

Example: Visual SourceSafe Copy-Modify-Merge:

Users make parallel changes to their own working copies

The parallel changes are merged and the final version emerges

Examples: CVS, Subversion

Page 24: 3. Software Engineering - software configuration-management

Locking Problems Administrative problems:

Someone locks a given file and forgets about it

Time is lost while waiting for someone to release a file

Unneeded locking of the whole time Different changes are not necessary

in conflict Example: Andy works on the

begging of the file and Bobby works on the end

Page 25: 3. Software Engineering - software configuration-management

Merging Problems If a given file is concurrently modified it is necessary to merge the changes Merging is hard!

It is not always possible to do it automatically

Responsibility and coordination between the developers is needed Commit as fast as you can Do not commit code that does not

compile or blocks the work of the others

Add comments on commit

Page 26: 3. Software Engineering - software configuration-management

File Comparison / Merge

During manual merge use file comparison

There are visual comparison / merge tools: TortoiseMerge WinDiff AraxisMerge BeyondCompare CompareIt …

Page 27: 3. Software Engineering - software configuration-management

File Comparison – Example

Page 28: 3. Software Engineering - software configuration-management

The"Lock-Modify-Unlock" Model

Page 29: 3. Software Engineering - software configuration-management

The Lock-Modify-Unlock model (1)

Repository

A

A

Andy and Bobby check-out file A.

The check-out is done without locking. They just get a local copy.

UpdateA

Update

AndyBobby

Page 30: 3. Software Engineering - software configuration-management

The Lock-Modify-Unlock model (2)

Repository

A

Аndy

Andy locks file A and begins modifying it.

LockA

AndyBobby(Local Edit)

Page 31: 3. Software Engineering - software configuration-management

The Lock-Modify-Unlock model (3)

Repository

A

Andy

Bobby tries to lock the file too, but she can’t.

Bobby waits for Andy to finish and unlock the file.

A

Wait

AndyBobby

Page 32: 3. Software Engineering - software configuration-management

The Lock-Modify-Unlock model (4)

Repository

Andy

Andy commits the changes and unlocks the file.

Commit

Andy

Andy

AndyBobby

Page 33: 3. Software Engineering - software configuration-management

The Lock-Modify-Unlock model (5)

Repository

Andy

Now Bobby can take the modified file and lock it.

Bobby edits her local copy of the file. Lock

Andy

Andy

AndyBobby

(Local Edit)

Page 34: 3. Software Engineering - software configuration-management

The Lock-Modify-Unlock model (6)

Repository

Andy

Bobby finishes, commits her changes and unlocks the file.

Commit

AndyBobby

AndyBobby

AndyBobby

Page 35: 3. Software Engineering - software configuration-management

The Lock-Modify-Unlock model (7)

Repository

AndyBobby

Andy updates the changes from the repository.

AndyBobby

AndyBobby

Update

AndyBobby

Page 36: 3. Software Engineering - software configuration-management

The"Copy-Modify-Merge" Model

Page 37: 3. Software Engineering - software configuration-management

The Copy-Modify-Merge Model (1)

Repository

A

A

Andy and Bobby check-out the file A.

The check-out is done without locking.

ACheck-out

Check-out

AndyBobby

Page 38: 3. Software Engineering - software configuration-management

The Copy-Modify-Merge Model (2)

Both of them edit the local copies of the file (in the same time).

Repository

A

Andy

Bobby

Andy

Bobby(Local Edit)

(Local Edit)

Page 39: 3. Software Engineering - software configuration-management

The Copy-Modify-Merge Model (3)

Repository

Bobby

Andy

Bobby

Bobby commits her changes to the repository.

Commit

Andy

Bobby

Page 40: 3. Software Engineering - software configuration-management

The Copy-Modify-Merge Model (4)

Andy tries to commit his changes.

A version conflict occurs. Commi

t

Repository

Bobby

Bobby

Andy

Andy

Bobby(Local Conflict)

Page 41: 3. Software Engineering - software configuration-management

The Copy-Modify-Merge Model (5)

Andy updates his changes with the ones from the repository.

The changes merge into his local copy.

A merge conflict can occur.

Update

(with merge)

Repository

Bobby

Bobby

Andy&

Bobby

Andy

Bobby(Local Merge)

Page 42: 3. Software Engineering - software configuration-management

The Copy-Modify-Merge Model (6)

Repository

Andy commits the changes to the repository.

A common version with the changes of Andy and Bobby is inserted.

Commit

Bobby

Andy&

Bobby

Andy&

Bobby

Andy

Bobby

Page 43: 3. Software Engineering - software configuration-management

The Copy-Modify-Merge Model (7)

Bobby updates the changes from the repository.

She gets the common version with the changes of Andy and Bobby.

Update

Repository

Andy&

Bobby

Andy&

Bobby

Andy&

Bobby

Andy

Bobby

Page 44: 3. Software Engineering - software configuration-management

Tags and Branching

Page 45: 3. Software Engineering - software configuration-management

Tags Tags enable the naming of a group of files in different versions

Main.cs

Test.cs

1.1 1.3 1.4

1.2

Prog.cs 1.1 1.2

Tag "Beta 2"

1.1

1.3

1.2

Page 46: 3. Software Engineering - software configuration-management

Branching

Branching enables a group of changes to be separated in a different development line

Branching is suitable for: Development of additions for a

version of the product (for example version 2.0) The additions are independent from

the main development line

Saves the possibility of making changes to the old version (for example version 1.0.1)

Page 47: 3. Software Engineering - software configuration-management

Branching – Example

Main.h

1.1 1.2 1.3 1.4

1.2.2.1 1.2.2.2

1.2.4.1 1.2.4.2 1.2.4.3

1.2.2.2.2.1 1.2.2.2.2.2Branch 1.2.2.2.2 ->

Branch 1.2.2. ->

Branch 1.2.4. ->

Main Trunk

Page 48: 3. Software Engineering - software configuration-management

SubversionUsing Subversion and TortoiseSVN

Page 49: 3. Software Engineering - software configuration-management

Subversion Subversion (SVN)

Open source SCM repository http://subversion.tigris.org/ Runs on UNIX, Linux, Windows

Console client svn

GUI client TortoiseSVN –

http://tortoisesvn.tigris.org/

Visual Studio plug-in client (AnkhSVN)

Page 50: 3. Software Engineering - software configuration-management

Subversion – Features

Versioning of the directory structure Complete change log

Deletion of files and directories

Renaming of files and directories

Saving of files or directories Can work on it’s own or integrated

with Apache as a module Works effectively with tags and

branching

Page 51: 3. Software Engineering - software configuration-management

TortoiseSVN

TortoiseSVN Open source

GUI client for Subversion

Integrated in Windows Explorer

http://tortoisesvn.tigris.org/

Page 52: 3. Software Engineering - software configuration-management

AnkhSVN Visual Studio plug-in for accessing

SVN repositories – http://ankhsvn.open.collab.net

Page 53: 3. Software Engineering - software configuration-management

Subversion & TortoiseSVN

Live Demo

Page 54: 3. Software Engineering - software configuration-management

форум програмиране, форум уеб дизайнкурсове и уроци по програмиране, уеб дизайн – безплатно

програмиране за деца – безплатни курсове и уроцибезплатен SEO курс - оптимизация за търсачки

уроци по уеб дизайн, HTML, CSS, JavaScript, Photoshop

уроци по програмиране и уеб дизайн за ученициASP.NET MVC курс – HTML, SQL, C#, .NET, ASP.NET MVC

безплатен курс "Разработка на софтуер в cloud среда"

BG Coder - онлайн състезателна система - online judge

курсове и уроци по програмиране, книги – безплатно от Наков

безплатен курс "Качествен програмен код"

алго академия – състезателно програмиране, състезания

ASP.NET курс - уеб програмиране, бази данни, C#, .NET, ASP.NETкурсове и уроци по програмиране – Телерик академия

курс мобилни приложения с iPhone, Android, WP7, PhoneGap

free C# book, безплатна книга C#, книга Java, книга C#Дончо Минков - сайт за програмиранеНиколай Костов - блог за програмиранеC# курс, програмиране, безплатно

?

? ? ??

?? ?

?

?

?

??

?

?

? ?

Questions?

?

Software Configuration Management

http://academy.telerik.com

Page 55: 3. Software Engineering - software configuration-management

Free Trainings @ Telerik Academy

“Software Engineering" course @ Telerik Academy academy.telerik.com/.../software-engin

eering

Telerik Software Academy academy.telerik.com

Telerik Academy @ Facebook facebook.com/TelerikAcademy

Telerik Software Academy Forums forums.academy.telerik.com