Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Development Tools

Development Tools

A lecture given to 2nd year Computing students at the University of Lincoln, covering topics of source control and continuous integration.

Nick Jackson

November 20, 2012
Tweet

More Decks by Nick Jackson

Other Decks in Technology

Transcript

  1. SOURCE CONTROL It’s like a time machine for your source

    code. Also, it stops people overwriting your stuff.
  2. SOURCE CONTROL • Also known as “revision control” or “version

    control”. • Key part of Software Configuration Management.
  3. A QUICK HISTORY • Originated with blueprints and legal documents.

    • Return to any previous version. • Visibility of changes. • Improved accountability.
  4. CODE REVISION • Exactly the same. • Return to any

    point in time. • See all changes between any two versions. • See exactly who made which change.
  5. WITH EXTRA GOODNESS • Branching allows different versions to be

    developed side by side, eg development, production and feature. • Tagging specific points in the history, eg previous versions. • Merging different revisions (eg on branches) is possible. • Computers don’t (generally) muck up revisions.
  6. YOU MAY ENCOUNTER... • Microsoft Visual SourceSafe (Discontinued) • CVS

    (Concurrent Versions System) • SVN (Apache Subversion) • GNU Bazaar • Mercurial • Git
  7. DISTRIBUTED • All clients hold complete copy. • No definitive

    version (by default). • More resilient to failure. • Eg Mercurial, Git, Bazaar.
  8. AT LINCOLN • Increasing use of source control in ICT,

    CS, Library. • Majority of teams use Git.
  9. ALL ABOUT GIT • Open source. • Distributed source control.

    • Heavy encouragement of branching and merging.
  10. A QUICK HISTORY OF GIT • Developed by Linux kernel

    developers when they fell out with their proprietary provider. • Wanted distributed, fast source control which stopped corruption of code. • Been developed since 2005.
  11. BRANCHING • Different development paths. • Branch per feature. •

    Branch per developer. • Branch per version.
  12. MERGING • Take changes from one bit of the tree

    (like a branch). • Put them into another bit of the tree.
  13. BRANCHING MODELS • Common set of rules followed by team.

    • We use Git Flow, but others exist. • Clear lines between development, production, bugfixes, features and releases.
  14. Time release branches master develop hot xes feature branches Author:

    Vincent Driessen Original blog post: http://nvie.com/archives/323 License: Creative Commons BY-SA
  15. FOR YOURSELF • Rewind time when you totally break things.

    • Try different approaches without altering your working code. • Really easy documentation of changes.
  16. FOR GROUP WORK • All the individual benefits, plus: •

    No more overwriting each others work. • One central ‘definitive’ copy (if you work that way). • Easily break down contributions by person. • Awesome visualisation to see when all your work is done.
  17. ALRIGHT. HOW? • Download Git (it’s free): http://git-scm.com/. • Windows,

    OS X and Linux. • GUIs are available (but command line is more powerful).
  18. ON A BRANCH... • Add files (git add) and commit

    (git commit) as normal. • Changes are only made to the specific branch.
  19. MERGING IT BACK TOGETHER • When changes are ready, merge!

    • Compares two points, finds changes, and mixes together. • Usually automatic, may need manual resolution.
  20. HOW ABOUT FOR GROUPS? • Git is distributed, so no

    central server by default, but; • External repositories are available.
  21. SOME GIT HOSTS • Beanstalk (beanstalkapp.com) • GitHub (github.com) •

    Gitorious (gitorious.org) • Bitbucket (bitbucket.org)
  22. HOSTING CAVEATS • All have a free tier. • Some

    only allow single users in free tier. • Some give unlimited public repos, but not private. • Some don’t have private repos.
  23. WE USE... • GitHub (for most of our Open Source

    stuff) • Bitbucket (for most of our internal stuff)
  24. WHY? • Both have good access control. • Both have

    powerful collaboration tools (issue trackers, wikis). • GitHub has free public repositories for Open Source, so we can involve the community in our work. • Bitbucket has a free academic tier (use lincoln.ac.uk email) which gives us private repositories.
  25. GO TRY • You’ll need a Bitbucket account for the

    workshop. • http://bitbucket.org • It’s totally free. • Use your lincoln.ac.uk email address.
  26. POWER OF REMOTES • Copy of the repository kept somewhere

    else. • Can be anywhere accessible by you. • Common places are network shares and remote servers. • Most common access is using SSH.
  27. PUSHING AND PULLING • Push moves code from local to

    remote. • Pull does the opposite.
  28. SOURCE CONTROL • Code is neatly managed. • Releases are

    regularly tagged. • A single branch holds your ‘definitive’ code.
  29. UNIT TESTING • Bunch of tests which ensure your code

    works. • Run manually when you think they’re needed. • May need reconfiguring for test environments. • This takes time.
  30. ENTER CI • Provide automated testing (and other stuff) of

    your code. • Wraps tasks up in a ‘build’. • Runs on a schedule, or on code change. • Not uncommon to run several times a day.
  31. KEY BENEFITS • Clean build environment(s). • No “it won’t

    matter” mentality. • Always have ‘latest build’ ready to go.
  32. A FEW EXAMPLES • Apache Continuum • Bamboo • Buildbot

    • Cruise Control • Jenkins • Travis
  33. BUT... • We’re not expecting you to use one. •

    Take days to set up and get working properly. • You need to be aware of them (and what they do).
  34. LIGHT IT UP • A single ‘go/no-go’ indicator. • Clear

    visual sign of if things are ready to go.
  35. ALL THE FEEDBACK • Continuous Integration gives you loads of

    indicators. • Learn things about your code you didn’t know.
  36. ONE OF OURS... • Gets code from repository. • Runs

    a series of tests. • Compiles scripts. • Compresses content. • Performs analysis to find which files to deploy. • Deploys to server. • Cleans up after itself.
  37. BEGINNING TO END • Write code. • Check in to

    repository. • Continuous Integration runs. • Working application, or error report.