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 Development � 3
� 4
USB Key? Email? Shared directory? � 4
???? � 5
� 7
windchime(c) « Why do we version source code?» Motivations (among others)
Before � 9
After � 10
� 11
� 11
BUG! � 11
«not me!» «not me!» «not me!» «not me!» BUG! � 11
« Why do we version source code?» To trace changes! � 12
� 13
� 13
BUG! � 13
BUG! � 13
BUG! � 13
... BUG! � 13
Here is the new release! � 14
??? Here is the new release! BUG! � 14
??? Here is the new release! BUG! It was working 2 days ago... � 14
??? Here is the new release! BUG! It was working 2 days ago... Can I see it? � 14
« Why do we version source code?» To rollback changes! � 15
� 16
rollback � 16
� 17
� 17
??? ??? � 17
??? ??? � 17
« Why do we version source code?» To share changes! � 18
� 19
� 19
� 19
Centralized Model (e.g., CVS, Subversion) � 20
Shared Repository create � 21
Shared Repository checkout export � 22
Shared Repository � 23
Shared Repository � 23
Shared Repository commit � 23
Shared Repository commit update � 23
Shared Repository � 24
Shared Repository � 24
Shared Repository commit � 24
Shared Repository commit � 24
Shared Repository commit commit ???? � 24
#1: different files Atomic operations. No problem at all! � 25
#2: different part of the same file File Locking (old school) � 26
#2: different part of the same file 1. lock File Locking (old school) � 26
#2: different part of the same file 1. lock X reject! File Locking (old school) � 26
#2: different part of the same file 1. lock X reject! File Locking (old school) � 26
#2: different part of the same file 1. lock X reject! 2. unlock File Locking (old school) � 26
#2: different part of the same file Automatic merge � 27
� 28
#3: same part of the same file Conflict! � 29
� 30 http://geekandpoke.typepad.com/geekandpoke/2010/10/being-a-code-made-easy-chapter-1.html
� 31 http://geekandpoke.typepad.com/geekandpoke/2010/10/being-a-code-made-easy-chapter-1.html
Shared Repository commit X � 32
Shared Repository update � 33
Shared Repository update Conflict! � 33
Shared Repository Conflict! � 34
Shared Repository Conflict! � 34
Shared Repository Resolved! � 34
Shared Repository commit Resolved! � 34
Shared Repository commit update Resolved! � 34
Distributed Model (e.g., Bazaar, Git) � 35
Centralized = 1 repository Distributed = N repository � 36
when N = 1 , Centralized = Distributed He who can do more can do less � 37
repository clone clone � 38
completely offline! commit add � 39
artefacts untracked lifecycle [Pro Git, #2.2] � 40
artefacts unmodified untracked lifecycle add [Pro Git, #2.2] � 40
artefacts unmodified untracked lifecycle modified add [Pro Git, #2.2] � 40
artefacts unmodified untracked lifecycle modified add staged stage [Pro Git, #2.2] � 40
artefacts unmodified untracked lifecycle modified add staged stage commit [Pro Git, #2.2] � 40
artefacts unmodified untracked lifecycle modified add staged stage rm commit [Pro Git, #2.2] � 40
push pull add commit � 41
commit Centralized Distributed add commit push � 42
Seriously? � 43
Distribution! push push push pull � 44
Spiderman’s Theorem «With great power comes great responsibility» � 45
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
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
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
Version control strategy for your team ?
Conclusions � 46
Why do we version code? To trace changes! To rollback changes! To share changes! � 47 (among others)
Why do we version code? To trace changes ! To rollback changes ! To share changes ! � 48 (among others)
Different models for code versioning Centralized versus Distributed � 49
when N = 1 , Centralized = Distributed He who can do more can do less � 50 (also works for P = NP)
Recommend
More recommend