Code Management

6,364 views
6,268 views

Published on

Code Management Workshop Presentation at SummerofCode.co.nz 2009

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,364
On SlideShare
0
From Embeds
0
Number of Embeds
169
Actions
Shares
0
Downloads
44
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Code Management

  1. 1. Code Management
  2. 2. About me Thong Kuah ProjectX Technology <thong@projectx.co.nz>
  3. 3. Change Change
  4. 4. Change Change
  5. 5. Murphy's Law
  6. 6. What just broke ?
  7. 7. Where is that file? Needle in a Haystack
  8. 8. Joe added this. Change it.
  9. 9. <!doctype html><html><head><meta http-equiv="content-type" content="text/html; charset=UTF- 8"><title>Google</title><script>window.google={kEI:"ODpsStiwMonStgOZ6KTTDw",kEXPI:"17259,17311,20760,21078",kCSIE:"17259,17311,207 60,21078",kCSI:{e:"17259,17311,20760,21078",ei:"ODpsStiwMonStgOZ6KTTDw"},kHL:"en"}; window.google.sn="webhp";window.google.timers={load:{t:{start:(new Date).getTime()}}};try{window.google.pt=window.gtbExternal&&window.gtbExternal.pageT()||window.external&&window.external.pageT}catch(b){} window.google.jsrt_kill=1; var _gjwl=location;function _gjuc(){var e=_gjwl.href.indexOf("#");if(e>=0){var a=_gjwl.href.substring(e);if(a.indexOf("&q=")>0||a.indexOf("#q=")>=0) {a=a.substring(1);if(a.indexOf("#")==-1){for(var c=0;c<a.length;){var d=c;if(a.charAt(d)=="&")++d;var b=a.indexOf("&",d);if(b==-1)b=a.length;var f=a.substring(d,b);if(f.indexOf("fp=")==0){a=a.substring(0,c)+a.substring(b,a.length);b=c}else if(f=="cad=h")return 0;c=b}_gjwl.href="/search?"+a+"&cad=h";return 1}}}return 0}function _gjp(){!(window._gjwl.hash&& window._gjuc())&&setTimeout(_gjp,500)}; window._gjp && _gjp()</script><style>td{line-height:.8em;}.gac_m td{line-height:17px;}form{margin-bottom:20px;}body,td,a,p,.h{font- family:arial,sans-serif}.h{color:#36c}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}#gbar{height:22px}.gbh,.gbd{border-top:1px solid #c9d7f1;font- size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}#gbi,#gbs{background:#fff;left:0;position:absolute;top:24px;visibility:hidden;z- index:1000}#gbi{border:1px solid;border-color:#c9d7f1 #36c #36c #a2bae7;z-index:1001}#guser{padding-bottom:7px !important;text- align:right}#gbar,#guser{font-size:13px;padding-top:1px !important}@media all{.gb1,.gb3{height:22px;margin-right:.5em;vertical- align:top}#gbar{float:left}}.gb2{display:block;padding:.2em .5em}a.gb1,a.gb2,a.gb3{color:#00c !important}.gb2,.gb3{text- decoration:none}a.gb2:hover{background:#36c;color:#fff !important}</style><script>google.y={};google.x=function(e,g){google.y[e.id]=[e,g];return false};window.gbar={qs:function(){},tg:function(e){var o={id:'gbar'};for(i in e)o[i]=e[i];google.x(o,function(){gbar.tg(o)})}};</script></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="document.f.q.focus();if(document.images)new Image().src='/images/nav_logo6.png'" topmargin=3 marginheight=3><textarea id=csi style=display:none></textarea><iframe name=wgjf style=display:none></iframe><div id=gbar><nobr><b class=gb1>Web</b> <a href="http://images.google.com/imghp?hl=en&tab=wi" onclick=gbar.qs(this) class=gb1>Images</a> <a href="http://video.google.com/?hl=en&tab=wv" onclick=gbar.qs(this) class=gb1>Videos</a> <a href="http://maps.google.com/maps?hl=en&tab=wl" onclick=gbar.qs(this) class=gb1>Maps</a> <a href="http://news.google.com/nwshp? hl=en&tab=wn" onclick=gbar.qs(this) class=gb1>News</a> <a href="http://www.google.com/prdhp?hl=en&tab=wf" onclick=gbar.qs(this) class=gb1>Shopping</a> <a href="http://mail.google.com/mail/?hl=en&tab=wm" class=gb1>Gmail</a> <a href="http://www.google.com/intl/en/options/" onclick="this.blur();gbar.tg(event);return !1" aria-haspopup=true class=gb3><u>more</u> <small>▼</small></a><div id=gbi><a href="http://groups.google.com/grphp?hl=en&tab=wg" onclick=gbar.qs(this) class=gb2>Groups</a> <a href="http://books.google.com/bkshp?hl=en&tab=wp" onclick=gbar.qs(this) class=gb2>Books</a> <a href="http://scholar.google.com/schhp? hl=en&tab=ws" onclick=gbar.qs(this) class=gb2>Scholar</a> <a href="http://www.google.com/finance?hl=en&tab=we" onclick=gbar.qs(this) class=gb2>Finance</a> <a href="http://blogsearch.google.com/?hl=en&tab=wb" onclick=gbar.qs(this) class=gb2>Blogs</a> <div class=gb2><div class=gbd></div></div><a href="http://www.youtube.com/?hl=en&tab=w1" onclick=gbar.qs(this) class=gb2>YouTube</a> <a href="http://www.google.com/calendar/render?hl=en&tab=wc" class=gb2>Calendar</a> <a href="http://picasaweb.google.com/home? hl=en&tab=wq" onclick=gbar.qs(this) class=gb2>Photos</a> <a href="http://docs.google.com/?hl=en&tab=wo" class=gb2>Documents</a> <a href="http://www.google.com/reader/view/?hl=en&tab=wy" class=gb2>Reader</a> <a href="http://sites.google.com/?hl=en&tab=w3" class=gb2>Sites</a> <div class=gb2><div class=gbd></div></div><a href="http://www.google.com/intl/en/options/" class=gb2>even more &raquo;</a> </div></nobr></div><div id=guser width=100%><nobr><a href="/url?sa=p&pref=ig&pval=3&q=http://www.google.com/ig%3Fhl %3Den%26source%3Diglk&usg=AFQjCNFA18XPfgb7dKnXfKz7x7g1GDH1tg">iGoogle</a> | <a href="https://www.google.com/accounts/Login? hl=en&continue=http://www.google.com/webhp">Sign in</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div><center><br clear=all id=lgpd><img alt="Google" height=110 src="/intl/en_ALL/images/logo.gif" width=276 id=logo onload="window.lol&&lol()"><br><br><form action="/search" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%>&nbsp;</td><td align=center nowrap><input name=hl type=hidden value=en><input autocomplete="off" maxlength=2048 name=q size=55 title="Google Search" value="">
  10. 10. <br><input name=btnG type=submit value="Google Search"><input name=btnI type=submit value="I'm Feeling Lucky"></td><td nowrap width=25% align=left><font size=-2>&nbsp;&nbsp;<a href=/advanced_search?hl=en>Advanced Search</a><br>&nbsp;&nbsp;<a href=/preferences?hl=en>Preferences</a><br>&nbsp;&nbsp;<a href=/language_tools?hl=en>Language Tools</a></font></td></tr></table></form><br><font size=-1><font color=red>New!</font> <a href="/aclk? sa=L&ai=CY8kE9DVsSuHyOpCyoQSw_pEEr42rhgHhn63XDMHZnNkTEAEgwVRQ76H57Pr_____AWCfAaoECU_QfNGYqctb3w&num=1&sig=A GiWqtwagQcpKjIjS3hvb1Muos4ZsmUeUw&q=http://www.google.com/help/ig/comicsthemes/">Get Comics Themes</a> from Superman, The Hulk, Peanuts, and more.</font><br><br><br><font size=-1><a href="/intl/en/ads/">Advertising&nbsp;Programs</a> - <a href="/services/">Business Solutions</a> - <a href="/intl/en/about.html">About Google</a> - <b><a href=http://www.google.co.nz/>Go to Google New Zealand</a></b></font><p><font size=-2>&copy;2009 - <a href="/intl/en/privacy.html">Privacy</a></font></p></center><div id=xjsd></div><div id=xjsi><script>if(google.y)google.y.first=[];if(google.y)google.y.first=[];google.dstr=[];google.rein=[];window.setTimeout(function(){var a=document.createElement("script");a.src="/extern_js/f/CgJlbiswCjgiQAgsKzAOOAUsKzAWOA4sKzAXOAMsKzAYOAQsKzAZOAQsKzAlOMmIA SwrMCY4BSwrMCc4Aiw/5J4j8bwbSpw.js";(document.getElementById("xjsd")||document.body).appendChild(a)},0); ;google.y.first.push(function() {google.ac.m=0;google.ac.i(document.f,document.f.q,'','')});google.xjs&&google.j&&google.j.xi&&google.j.xi()</script></div><script>(function(){ function a(){google.timers.load.t.ol=(new Date).getTime();google.report&&google.report(google.timers.load,google.kCSI)}if(window.addEventListener)window.addEventListener("load",a,fals e);else if(window.attachEvent)window.attachEvent("onload",a);google.timers.load.t.prt=(new Date).getTime(); })(); </script>
  11. 11. Change What line?
  12. 12. Who dunnit?
  13. 13. I'm sure nothing's changed
  14. 14. I'm sure nothing's changed
  15. 15. Code Management Change Fix it now
  16. 16. Change ● Who last changed this file? ● Who made that change, when and why? ● Where is that bug? ● Has the code changed or not? ● How is it different? ● Can you put your fixes into my files? ● Messy fixes ● ...
  17. 17. Change How to manage changes to code?
  18. 18. Change How to manage changes to code?
  19. 19. Alice → Bob VERSION 1
  20. 20. Bob → Alice VERSION 2
  21. 21. Alice → Bob VERSION 3
  22. 22. Bob → Alice VERSION 2.1 Oops
  23. 23. Alice → Bob Please choose: VERSION 4a: Based on V3 + 2.1 VERSION 4b: Based on V3.1 + 2.1 Version 4c: Rewrite
  24. 24. Change How to manage changes to code?
  25. 25. How? Tools & Practices
  26. 26. Practices is up to you & team
  27. 27. Tools
  28. 28. Version Control Tools ●SVN ●Git
  29. 29. Version Control Tools Mercurial SVN ● ● ● Bazaar CVS ●Git ● ● Visual SourceSafe ● GNU arch ● Darcs ● Perforce ● ....
  30. 30. Version Control ● Stores code
  31. 31. Version Control ● Stores code ● Does versioning for you
  32. 32. Versioning
  33. 33. Version Control ● Stores code ● Does versioning for you ● Records changes from multiple sources
  34. 34. Recording change
  35. 35. Version Control ● Stores code ● Does versioning for you ● Handles changes from multiple sources ● Merges them nicely
  36. 36. Merging
  37. 37. Version Control ● Stores code ● Does versioning for you ● Handles changes from multiple sources ● Merges them nicely
  38. 38. Basics
  39. 39. Basics ●You get code ●You change code ●You share your changes
  40. 40. Get Code
  41. 41. Change code
  42. 42. Share
  43. 43. Basics (II) ●Others get code ●Others change code ●Others share
  44. 44. Get Code
  45. 45. Change code
  46. 46. Share
  47. 47. Basics (II) ●Others get code ●Others change code ●Others share ●You get more code
  48. 48. Basics (II) ●Others get code ●Others change code ●Others share ●You get more code ●And around it goes
  49. 49. Sharing is good
  50. 50. Summary ●Change happens ●Use best practice ●Use tools ●Source control basics – workshop later
  51. 51. Further Information ● gittutorial(7) ● SVN Red Book ● http://betterexplained.com/articles/a-visual- guide-to-version-control/ ● http://www.swc.scipy.org/lec/version.html
  52. 52. Credits, Attribution ● http://www.flickr.com/photos/vespa_gt/373805114/sizes/m/ ● http://www.flickr.com/photos/ezu/277341190/sizes/o/ ● http://www.flickr.com/photos/addedentry/2222911325/ ● http://www.flickr.com/photos/charlieferrari/49323751/sizes/o/ ● http://www.flickr.com/photos/aliciayeah/262229883/sizes/l/ ● http://www.flickr.com/photos/nickwheeleroz/2475011402/sizes/l/ ● http://www.flickr.com/photos/herzogbr/2123789106/sizes/l/ ● http://www.flickr.com/photos/sgt_spanky/2470700936/ ● http://www.flickr.com/photos/striatic/340190783/ ● http://www.flickr.com/photos/7506006@N07/513417996/in/set-72157600264508078/ ● http://www.flickr.com/photos/7506006@N07/513453021/ ● http://www.flickr.com/photos/mattwright/1787856/sizes/l/ ● http://www.flickr.com/photos/ryanr/142455033/sizes/o/ ● http://www.flickr.com/photos/tjflex/233574885/sizes/l/ ● http://www.flickr.com/photos/mrtea/1278546801/sizes/l/ ● http://www.flickr.com/photos/rachelrusinski/533767098/sizes/o/ ● http://www.cs.utk.edu/dilab/SDR_robots.jpg ● http://www.mat.uc.pt/~emsa/Historia2007/Imagens/Black_Hole_Milkyway.jpg
  53. 53. Credits, Attribution ● http://commons.wikimedia.org ● http://www.flickr.com/photos/missmirr/529688823/sizes/o/ ● http://www.flickr.com/photos/jan_isaac/383512885/sizes/o/ ● http://upload.wikimedia.org/wikipedia/commons/c/ce/Mail-envelope.png ● http://commons.wikimedia.org/wiki/File:Wellington_weta_female.jpg ● http://commons.wikimedia.org/wiki/File:Darcs-ag-merge-symmetry.png
  54. 54. Questions?

×