Collaborative Development & Source Code Versioning Huge thanks - - PowerPoint PPT Presentation

collaborative development source code versioning
SMART_READER_LITE
LIVE PREVIEW

Collaborative Development & Source Code Versioning Huge thanks - - PowerPoint PPT Presentation

CPSC 310 Software Engineering Lecture 5 Collaborative Development & Source Code Versioning Huge thanks to Sebastien Mosser (sebastien.mosser@unice.fr) for the slides works on piece of developer software 2 Collaborative


slide-1
SLIDE 1

CPSC 310 – Software Engineering

Lecture 5

Collaborative Development & Source Code Versioning

Huge thanks to Sebastien Mosser (sebastien.mosser@unice.fr) for the slides
slide-2
SLIDE 2

developer piece of software works on

2
slide-3
SLIDE 3

Collaborative

Development

3
slide-4
SLIDE 4 4
slide-5
SLIDE 5

Email? USB Key? Shared directory?

4
slide-6
SLIDE 6

????

5
slide-7
SLIDE 7 7
slide-8
SLIDE 8

«Why do we version source code?»

Motivations (among others)

windchime(c)
slide-9
SLIDE 9

Before

9
slide-10
SLIDE 10

After

10
slide-11
SLIDE 11 11
slide-12
SLIDE 12 11
slide-13
SLIDE 13

BUG!

11
slide-14
SLIDE 14

«not me!» «not me!» «not me!» «not me!»

BUG!

11
slide-15
SLIDE 15

To trace changes!

«Why do we version source code?»

12
slide-16
SLIDE 16 13
slide-17
SLIDE 17 13
slide-18
SLIDE 18

BUG!

13
slide-19
SLIDE 19

BUG!

13
slide-20
SLIDE 20

BUG!

13
slide-21
SLIDE 21

...

BUG!

13
slide-22
SLIDE 22

Here is the new release!

14
slide-23
SLIDE 23

BUG!

Here is the new release! ???

14
slide-24
SLIDE 24

BUG!

Here is the new release! ??? It was working 
 2 days ago...

14
slide-25
SLIDE 25

BUG!

Here is the new release! ??? It was working 
 2 days ago... Can I see it?

14
slide-26
SLIDE 26

To rollback changes!

«Why do we version source code?»

15
slide-27
SLIDE 27 16
slide-28
SLIDE 28

rollback

16
slide-29
SLIDE 29 17
slide-30
SLIDE 30 17
slide-31
SLIDE 31

??? ???

17
slide-32
SLIDE 32

??? ???

17
slide-33
SLIDE 33

To share changes!

«Why do we version source code?»

18
slide-34
SLIDE 34 19
slide-35
SLIDE 35 19
slide-36
SLIDE 36 19
slide-37
SLIDE 37

Centralized Model

(e.g., CVS, Subversion)

20
slide-38
SLIDE 38

Shared Repository create

21
slide-39
SLIDE 39

checkout export

Shared Repository

22
slide-40
SLIDE 40

Shared Repository

23
slide-41
SLIDE 41

Shared Repository

23
slide-42
SLIDE 42

commit

Shared Repository

23
slide-43
SLIDE 43

commit update

Shared Repository

23
slide-44
SLIDE 44

Shared Repository

24
slide-45
SLIDE 45

Shared Repository

24
slide-46
SLIDE 46

commit

Shared Repository

24
slide-47
SLIDE 47

commit

Shared Repository

24
slide-48
SLIDE 48

commit commit

????

Shared Repository

24
slide-49
SLIDE 49

#1: different files Atomic operations. No problem at all!

25
slide-50
SLIDE 50

#2: different part of the same file File Locking (old school)

26
slide-51
SLIDE 51

#2: different part of the same file File Locking (old school)

  • 1. lock
26
slide-52
SLIDE 52

#2: different part of the same file File Locking (old school)

  • 1. lock

X

reject!

26
slide-53
SLIDE 53

#2: different part of the same file File Locking (old school)

  • 1. lock

X

reject!

26
slide-54
SLIDE 54

#2: different part of the same file File Locking (old school)

  • 1. lock

X

reject!

  • 2. unlock
26
slide-55
SLIDE 55

Automatic merge #2: different part of the same file

27
slide-56
SLIDE 56 28
slide-57
SLIDE 57

#3: same part of the same file Conflict!

29
slide-58
SLIDE 58 http://geekandpoke.typepad.com/geekandpoke/2010/10/being-a-code-made-easy-chapter-1.html 30
slide-59
SLIDE 59 http://geekandpoke.typepad.com/geekandpoke/2010/10/being-a-code-made-easy-chapter-1.html 31
slide-60
SLIDE 60

commit

X

Shared Repository

32
slide-61
SLIDE 61

update

Shared Repository

33
slide-62
SLIDE 62

update

Conflict! Shared Repository

33
slide-63
SLIDE 63

Conflict! Shared Repository

34
slide-64
SLIDE 64

Conflict! Shared Repository

34
slide-65
SLIDE 65

Resolved! Shared Repository

34
slide-66
SLIDE 66

commit

Resolved! Shared Repository

34
slide-67
SLIDE 67

commit

Resolved!

update

Shared Repository

34
slide-68
SLIDE 68

Distributed Model

(e.g., Bazaar, Git)

35
slide-69
SLIDE 69

Centralized = 1 repository Distributed = N repository

36
slide-70
SLIDE 70

He who can do more can do less

when N = 1, Centralized = Distributed

37
slide-71
SLIDE 71

repository

clone clone

38
slide-72
SLIDE 72

add commit

completely offline!

39
slide-73
SLIDE 73

untracked

artefacts lifecycle

[Pro Git, #2.2] 40

slide-74
SLIDE 74

untracked unmodified

add

artefacts lifecycle

[Pro Git, #2.2] 40

slide-75
SLIDE 75

untracked unmodified modified

add

artefacts lifecycle

[Pro Git, #2.2] 40

slide-76
SLIDE 76

untracked unmodified modified staged

add stage

artefacts lifecycle

[Pro Git, #2.2] 40

slide-77
SLIDE 77

untracked unmodified modified staged

add stage commit

artefacts lifecycle

[Pro Git, #2.2] 40

slide-78
SLIDE 78

untracked unmodified modified staged

add rm stage commit

artefacts lifecycle

[Pro Git, #2.2] 40

slide-79
SLIDE 79

add commit push pull

41
slide-80
SLIDE 80

commit add commit push

Centralized Distributed

42
slide-81
SLIDE 81

Seriously?

43
slide-82
SLIDE 82

push push push pull

Distribution!

44
slide-83
SLIDE 83

Spiderman’s Theorem «With great power comes great responsibility»

45
slide-84
SLIDE 84

Best Practices

A commit should be a logical unit and have a descriptive message (avoid http://whatthecommit.com/ ) Commit/Update frequently Inspect your changes before committing Don't break the build (unit tests) if not expected by the others

slide-85
SLIDE 85

DO VERSION

Source code of any sort (Java, HTML,CSS, etc.) Images Configuration files Documentation (related to process and product) Automated Tests Files related to the project

slide-86
SLIDE 86

DO NOT VERSION

Generated Artifacts | compiled code, documentation, etc. Local build environment information Secured information

Use ignore mechanism provided by VCS For Git see: https://github.com/github/gitignore
slide-87
SLIDE 87

Version control strategy for your team

?

slide-88
SLIDE 88

Conclusions

46
slide-89
SLIDE 89

Why do we version code?

47

To trace changes! To rollback changes! To share changes!

(among others)
slide-90
SLIDE 90

Why do we version code?

48

To trace changes! To rollback changes! To share changes!

(among others)
slide-91
SLIDE 91

Different models for code versioning

49

Centralized

versus

Distributed

slide-92
SLIDE 92

He who can do more can do less

when N = 1, Centralized = Distributed

(also works for P = NP)

50