views:

1366

answers:

26

I have the opportunity to give a formal presentation to my boss about anything that benefits the company. My idea is to adopt source control in my workplace. I have been using Mercurial to manage my own project at work, but the rest of the team does not have a formal source control system in place. Unfortunately, I'm not very good at presenting ideas.

So, can you guys tell me why developers MUST use source control? Additionally, why would you choose any tool except Visual SourceSafe? I don't have experience using VSS, but he is likely to ask why we wouldn't just use Microsoft's tools.

I want to hear opinions from the many smart programmers here! My preferred options are SVN or mercurial. Both seem to have good support for their Windows versions, and both are less archaic than CVS. Also, as a self-declared open source disciple, I would prefer to suggest an open-source tool. :)

Thank you!

Edit: To make it short, generally, current practice for other developers is copying folder, tag with date and maybe record on their own. You get the picture. What if my boss says "if it works, why fix it?"

+15  A: 

Simply - so you have a true history of the code - to investigate changes (reasons for bugs), revert to versions, audit, etc. Backup isn't enough - you simply have a copy of the current picture. Ever change a file and wish you could remember what you did?

Marc Gravell
+22  A: 

Use source control because neither you nor your team are perfect. The primary function of source control is to ensure that you have a complete historical record of your development process. Having this record, you have the ability to confidently branch out with "experimental" versions, knowing that if the experiment fails, you can back up to an earlier version.

In addition, a good source control system like svn will permit multiple developers to work on the same file and provide powerful tools for reconciling the differences that each introduces.

Mark Brittingham
If you clone your project you can 'accidentally' delete your working version but you still can revert back to repository. If you don't hv repository and you've just deleted 10 months of your work then good luck.
stefanB
+7  A: 

Microsoft (MSDN) has a good article on the benefits of source control.
http://msdn.microsoft.com/en-us/library/ms173539.aspx

There are also lots of good questions here on SO as to the pros and cons.
http://stackoverflow.com/questions/343675/what-are-your-pros-and-cons-of-git-after-having-used-it

Subversion is very popular, but Git is going to be the "next big thing" in the source control world.

JMs
I wanna up vote this one more than once ;^)
Ric Tokyo
+3  A: 

Simple: If the code is not in source safe, it doesn't exist

Subversion is free and better than VSS but VSS is definitely better then nothing.

nzpcmad
+4  A: 

I suggest using SVN, because:

  1. Source control gives you excellent history. You can see where what changes have been made, thus providing a great way to see what's changed over time (even better if you fill out the submit summary each time)
  2. To the developer, it provides an excellent fallback if something goes horribly wrong. You can revert changes to a file back to any point in its history, so you can try out that mod you wanted to make, and if it doesn't work, roll it right back easily.
  3. It provides a central repository that is much easier to back up than running around to different developers' computers.
  4. It allows you to branch a project off in a different direction - useful for specializations and customizations.
  5. It enables more than one developer to work together on the same project, and the same source, by letting you merge and otherwise manipulate changes to one central copy.

I suggest NOT using VSS - see this page for reasons: http://www.highprogrammer.com/alan/windev/sourcesafe.html for more reasons.

Fritz H
+1 for the great list of reasons why VSS is a horrible source control system.
scunliffe
+12  A: 

You have to use Source Control for these reasons

1) You can rollback to any version

2) Different developers can work on the same files

3) All developers, will have access to the same code base

4) You can track changes

5) You can rollback changes that don't work

6) Source control is the basis of continuous integration and helps massively with TDD

7) If you don't use source control, you will slowly go mad as files get lost/overwritten and nothing works as it should

VSS is not the worst SCC application, I used it for years and grew to hate it, but it does work, is simple, and many people know it.

MrTelly
+1  A: 

Why do a formal presentation?

Assuming the team size is at least two, do a real-world example: Let two (or more, the more the better) people get the code, make their changes and show what it takes to integrate all those changes using whatever non source control means you use.

Then do the same scenario using the source control.

The amount of time and pain you save by using source control will speak for itself.

Bogdan
Or just ssh into a cow-orkers computer after an all nighter, copy their code off and delete it (or just move it to another location), then watch what happens. This only has to happen to any programmer once. The poster must be on a team of amazingly inexperienced programmers.
Bill K
+1  A: 

Stick to the bottom line, explain how it relates to money and your boss will probably listen.

If you are only one programmer, I'd say the main argument is the reduced chance that you will waste time (and therefore money) fixing simple mistakes, trying to rollback code that turned to be the wrong idea etc.

If you are more than one programmer then the above goes twice plus it's the only sane way to be able to work together on the same codebase without wasting even more time waiting for eachother,

Visual Source safe is better than nothing but there are free options that are better in almost every respect. If your boss needs a presentation to understand why source control is essential he might not care what tool you use once he has been enlightened. That you have experience with other tools and not vss again relates to the bottom line so that might suffice.

Console
+59  A: 

Let's compare two examples, one development environment that uses source control, and one that doesn't.

  • A: Does Use
  • B: Does not Use

Scenario 1: A project is requested, completed, and rolled out

A + B) Programmers develop the project internally, when it's completed, push it out to testing, and then deliver to the client (whoever that may be)

Not much difference, in the big picture

Scenario 2: After a project is released, the client decides that they don't want feature X

A + B) Developers remove the code that the client doesn't want, test, and deliver.

Again, not much difference.

Scenario 3: Two weeks later, the client decides that they actually DO want feature X

A) Developers reintegrate the code they took out in 2 back into the normal development tree, test, and deliver.

B) The developers search for the old code on their personal machines, the file server, and backups. If they find the code, they must manually reinsert each file. If they do not, they probably have to recode that entire feature.

It's easy to get old code that you took out for one reason or another

Scenario 4: There's a strange bug in the system where a function is supposed to return a boolean result, but always returns false. It wasn't like that two weeks ago.

A) Developers examine all the old versions of the software, and figure out that a return false directive isn't in the proper scope - it's executing inside a loop instead of outside.

B) Developers spend weeks trying to figure out what the problem is. Eventually, they notice the return on the wrong line, and fix it. Not having source control means they had to examine each and every file that was executed, rather than finding the differences from when it was working and now.

Scenario 5: Someone breaks the build. It gets past testing and is only noticed weeks later.

A) The team examines the commit history, finds out who broke the build, makes that person fix it and buy the team dinner.

B) The team has to go back through the entire project to find the error, but can't figure out who put that code in. Developers blame each other, and the team dynamic fails.

It's easy to see who committed what, when, and why.

davethegr8
+1, Loved how you present examples.
David Segonds
+1 but I disagree with scenario 2 - the Users can roll back with a click of a button, the Non-users have to manually undo everything.
annakata
@annakata - true that. Although when development doesn't necessarily follow a logical path and features are all mixed up between revisions it might be more similiar for both A and B
davethegr8
nah, I'd say that was a failure to grok source control which is a whole different problem :)
annakata
**Scenario 4** A) Developers do 'diff debugging', searching history for a comit which introduced error, probably using automated or semi-automated tools (usually called 'bisect')
Jakub Narębski
Very nicely presented argument! I'll have to remember these examples next time, god forbid, I must convince somebody to use SCM.
Nik Reiman
Nice examples, though no mention of branching (which is one of the most powerful parts of source control). Not sure if you could create a nice simple example for it though.
Herms
yes you could - one of your clients asks for bespoke work on a standard product. other clients arent interested these enhancements. you create a substream for any new bespoke development with core development being in the parent stream. any bugs in the core product get fixed once for all clients...
flesh
without source control, you take a full copy of the product and make the changes. now if you find bugs in the core product you have two codebases to maintain.
flesh
+3  A: 

Take it from me, VSS blows. It's basic file storage w/ history. Anything is better than VSS and VSS is better than nothing :)

dotjoe
+4  A: 

Before you say anything, find out why your company is not using source control.

Once you know why, it is easy to come up with scenarios where source control can help.

BenB
My spv and the lead developer worked in the same company before current. Previous company implement svn in the middle. Screwed up.More harm than good. Bad experience using svn-> not implementing any vcs in current place.
mhd
That is understandable, but it's not enough detail. "Screwed up" means what exactly? You have to find out the details!
BenB
In which case you might want to avoid recommending svn, and go for a more modern solution. You also probably want to find out why it went wrong, so you can point out how to avoid that.
David Thornley
+6  A: 

It seems to me that most people have covered the major feature of source control but one of the biggest positives is skipped over. These are:

Branches

Without a source code repository it is impossible to create branches (or copies/stream/etc.) of your code for particular purposes. Not being able to create and merge branches is one of the biggest things that disqualifies VSS from being a real source code control system. Some of the purposes of a branch include:

Bug Fix

Sometimes you need to resolve a bug and do it in a place away form the mainline or trunk version of your code. This may be to resolve a problem in the testing environment or any number of reasons. If you have a version control tool you should be able to easily make a new branch (something VSS sucks at) to fix the bug and be able to merge it back into the mainline code if necessary

Maintenance Release

This could be much the same as a bug fix but done after code has been released to production. Examples would be for fix packs, service releases, etc. Again, you want to be able to merge the changes back into the trunk if necessary

New Feature

Sometimes you need to start development of a new version while maintaining your current code. For example you release and maintain v1.0 but need to start work on v2.0 while maintaining v1.0. Branches help resolve this situation

Tagging/Labeling

Another thing source code control systems do is make snapshots of the source code at a particular point in time. These are called labels in VSS, tags in subversion, etc. By creating these on a regular basis and linking them to some substantial milestone in your project it then becomes possible to determine what exactly has changed in your code between releases. This can be important for auditors but also in tracking down the source/scope of an issue. VSS also gets a fail here because VSS only versions the files, not directories. This means it is impossible to re-create a previous version of the system if you rename/move/delete files or directories in the repository (something that happens a lot if you refactor). Good source code control systems like Subversion do just this.

Jeffrey Cameron
+3  A: 

Long discussion on why you should absolutely have source control:

http://stackoverflow.com/questions/52608/is-subversion-version-control-necessary-for-a-small-development-group-1-2-prog/52624#52624

My comments from that thread:

You always, always want to have some sort of Source Control even if you are working on a project by yourself.

Having a history of changes is vital to being able to see the state of a codebase at any given time. There are a variety of reasons for looking back in a project history which range from just being able to rollback a bad change to providing support for an old release when the customer just wants a patch to fix a bug rather than upgrading to a newer version of the software.

Not having some sort of source control is pure insanity.

As far as VSS goes - it's certainly better than nothing. It's definitely not the best source control and it's very dated, but the fact it that it continues to do the job for an awful lot of companies out there.

If your boss is determined to stick with Microsoft tools, go for Team Foundation Server instead of VSS. It's a much better system than VSS and it has nice features like integrated bug tracking.

17 of 26
+1  A: 

I'm really sorry but if you actually have to argue for [the formalization of] source control in a development environment, you're in a hopeless situation. If your boss actually needs to be convinced that source control is a worthwhile endeavor, your boss is simply not suitable to be a manager of a group of software developers. In order for someone to effectively manage, they really need at the very least a basic understanding of the landscape. I can't even imagine what's going to happen when you actually need to argue for something that's worth having an argument and doing a presentation over.

Developing without source control is like driving a car without breaks. You lose the ability to do seamless concurrent development, you lose your code getting backed up in working copies, you lose the ability to do historic research via code annotations, you lose the benefit of seeing the context and comments that accompany discrete changes, you just lose, period. Using source control is so obvious and has so many benefits, it's shocking that you'd have to justify it.

At work, we use subversion, but some developers (myself included) use Git locally via the git-svn bridge. For personal work, I use Git.

Fhoxh
+1  A: 

Why shouldn't your team adopt source control?

Even as a solo developer, I use source control. In a modern software development environment, I can think of few if any reasons why you would not use source control. It is more surprising that you don't already have it. The question strikes me as something like house painters asking "Why should we adopt the use of ladders. You know, ladders don't get the house painted - brushes do."

Elijah
That's a perfectly valid sentiment, but I don't think your answer is helpful to someone about to give a presentation regarding the subject. Going in and saying, "You all tell me why we shouldn't do it," is not likely to get very far. FWIW, though, I totally agree with your opinion. :)
Adam Bellaire
+1  A: 

The main reason we use version control is consistentency.

If the projects are not consistent then problems are going to occur and code is going to be lost.

Berek Bryan
+1  A: 

Make sure you have buy in for the rest of the team. Maybe you can test your presentation on them? Hopefully, they see the need as well.

Nice to see good practices being initiated from the bottom up. Maybe everyone will be more likely to adopt the practice if it comes from one of their own instead of some management mandate.

Jeff O
+7  A: 

Here's a simple real-life example.

A few years ago, my boss says, "Feature XYZ used to work, and now it doesn't. No one knows what happened. Can you fix it?"

Now I've never worked with feature XYZ before. So fixing it would involve a lot of flailing around trying to figure out what it does.

But we have source control! So I do this:

  • Create a test script to test feature XYZ: "Click here, type this, click there, etc."
  • Get current version. Build. Test. Feature XYZ is broken.
  • Get version from a week ago. Build. Test. Feature XYZ works.
  • Get version halfway between those two. Build. Test. Feature XYZ works.
  • Get version halfway between previous one, and current one. Build. Test. Feature XYZ is broken.

I kept doing this binary search until eventually I hit the point of change: version 145 (we'll say) had the feature working, but version 146 had it broken. Then I just did a compare between those two versions to see what changed. Turns out our technical lead (sigh) had checked in code that changed functionality, but also introduced a side effect that broke feature XYZ.

So I removed the side effect, tested...and lo and behold, feature XYZ worked again.

Without source control, you can never do this. You'll have to flail around, changing one thing or another, hoping to magically hit on the thing that makes feature XYZ work again.

With source control, you just test your way through the versions, pinpoint the exact code that caused the problem, and fix it.

Kyralessa
You might be interested in the "git bisect" command, which helps automate a lot of this for you.
Greg Hewgill
or, if possible, "git bisect run" which automates it even further... ;-)
Jakub Narębski
Or even better: use continuous integration, run the tests after every build and then check if the feature is broken as soon as its built ...
Jeffrey Cameron
Probably that command will only work if we're using git.
Kyralessa
+3  A: 

If the current process is copying a folder and giving it a date, isn't that so that you get some sort of development history, so isn't that basically a simple form of source control?

So to answer any criticisms about source control, you're already doing it. Now you just need to point out the weaknesses in the current system and suggest a better one. Why do you need to re-invent the wheel when people have really thought about a lot of the complex scenarios which can occur during development and developed the tools which let them handle them.

What you're currently doing is very fragile and will fall over if any sort of complex scenario comes up, at which point you'll have to expend a lot of energy working out how to do something that the tools already do. VSS is better than what you're doing, but doesn't have the very useful conventions that SVN, git or mercurial has which allows multiple projects to live together in a well organised manner - I'm talking branches, tags and merging, both of which are fragile and basically a nightmare under vss.

SVN does have plugins for visual studio. Some are free. But I find that tortoise-svn just eclipses anything else. The only benefit I find with a plugin is that new files get added to svn automatically.

So, weaknesses of your current system:

  • If you have to make a change to a file, you are likely to overwrite or be overwritten by the other dev's changes. You may not even notice this.
  • If you have to remember which files you've changed to copy them over some 'master' copy, you're likely to miss one at some point.
  • Good luck ever finding any documentation about when you made a change and why.
  • How could you ever build a stable automated build system on your current system? Cruise control and hudson work really well, you're hobbling yourself
  • VSS doesn't group changes to multiple files together very well. Everything modern does this extremely well and with atomic consistency.
  • VSS branch and merge support is awful. When we used it we ended up bracketing every change with comments in source code and manually copying code around rather than relying on VSS merge.
  • It's going to be very hard, near impossible in your current system, to have some version of the code in live maintenance and some other, later version, in heavy development. Think about what's needed to keep two projects in sync like this, you'll need a good tool. SVN can do it, git can do it really well.

That might be enough to go on with, can do more.

Jim T
+1  A: 

Print out this whole SO page, and toss it to your boss. ;)

yogman
+5  A: 

Having some version control system helps in any, many cases:

Single developer, single branch

  • The most basic task that each version control system has to perform perfectly if it wants to call itself version control is to be able to go back to specified version of a project. If you made mess of things, you can got to previous version. You can examine some previous version to check how it was done then (for example how it was before refactoring, or before removing some code/file).

    Version control systems take much less disk space compared to simply saving backup copies with specified date, because they use deltaification (storing only differences from previous version) and compression. Usually backup systems are means to store last N versions of a project, sometimes with N=1 (only previous version) while version control systems (VCS) store all the history of a project. Knowing Murphy a while after deleting Nth last version you would realize that was the version you want to examine.

    Additionally going back to some last version is easy and automated. You can also examine how single file looked like at some past version, and you can get differences (in diff format) between current state and some past version. You can also tag (or 'label') versions, so you can refer to past version not only by date, or by being nth version from current one, but also by symbolic name, for example v1.2 or v1.2-rc0.

  • With version control system you can examine history to remind you why (and how) some piece of code (some part of a given file) arrived at current state. Most VCS allow to examine line-wise history of a file, i.e. annotating each line of a file when it was changed, in what commit, and by whom (the command is named annotate, blame or praise depending on VCS). In some VCS you can search history for a version (revision) which introduced given fragment of code (e.g. called 'pickaxe search' in Git, one of VCS).

    For this feature to be really useful you have to maintain some discipline: you should describe each new version (each new revision / each new commit) writing down why the change was made. Such description (commit message) is very useful, but it doesn't have natural place in backup system.

    This feature of course is even more useful if you are not the only developer...

  • Using version control system allows for alternate way to find bugs in the code, namely by searching history to find version which introduced bug: bisectiong history. When you find revision which introduced bug, you would have limited (in best case: very limited) area to search for bug, because bug has to be in the difference betwen last working version and first version with a bug. Also you would have description of a change (a commit message) to remind you what you wanted to do. This feature is also called sometimes diff debugging. Modern version control systems (VCS) have support for automated (or semi-automated) searching the history by bisecting it (dividing history in half, finding which part contains bug, repeat until single responsible version is found), in the form of bisect (or similar) command.

    For this feature to be really useful you have to maintain some discipline: you should commit (save changes / put given state in version control system to remember) single change, dealing with only one feature, with only small difference from the previous version; i.e. commit often.

  • Most version control systems offer various hooks which allow for example for automated testing, or automated building of a product... or simply reminding you that you do not follow coding standard (coding guidelines).

Single developer, multiple branches

  • Version control systems allow to create multiple alternate parallel lines of development, called branches (or streams, or views). Common case is having development branches, i.e. having separate branch for unstable development (to test new features), separate branch for stable (main, trunk) version which is (or should be) current working version, and one on more separate maintenance (fixup) branches.

    Having maintenance branches allow you to do bugfixes and generate service packs / minor version with corrections to some released version, without need to worry about interference from the new development. Later you can merge maintenace branch into stable, or pick bigfix from maintenance branch into stable and development branches (if further/other development didn't fix bug independently).

  • Modern VCS (here modern means that both branching and merging branches is easy) allow to go a bit further, i.e. generate separate branch for working on a separate feature (so called topic branches). This allow you to switch between working one one feature to working on other feature (and not only switch from eveloping new feature to working on urgent requested bugfix).

  • If you are developing your product based on source of some other (usually third party) product, you really should use vendor branches to be able to easy integrate new version of a product from vendor with the changes you made. Admittedly this is no longer purely "single developer" case.

Multiple developers

  • Using version control systems brings even further advantages if there are more than one developer working on the same project. VCS allow for concurent (parallel) development without worrying that somebody would overwrite your changes, or does not take your changes into account. Of course using version control system is no substitute for communication.

  • All of the above features are even more important in the multiple-developer case: examining who generated given change, who last changed the code (aka. who broke the build), finding a bug in code not written only by you.

Jakub Narębski
+1  A: 

So, can you guys tell me why developers MUST use source control?

  • It provides one method for an entire team to use; everybody operates under the same 'ground rules'.
  • Changes are orderly vs. chaotic, saving development time.
  • The ability to track changes promotes accountability and makes it easier to find the right persom to solve problems in the materials maintained.
  • A list of exact changes made can be generated quickly and easily, making it easier to advise users of the information on how it has changed from version to version.
  • It is easy to 'roll back' to an earlier version of the information, if a serious mistake was made during a change.

Source Control is like insurance! You hope you never need it, but are glad you have it when you do!

Gary Willoughby
A: 

To avoid things like

     "Hey! What happens ? It worked yesterday."
Luc M
You hit the nail on the head! :)
Gary Willoughby
A: 

Because:

  1. It will reduce costs - Developers will have to spend less time checking an item in/out of a real VCS than their current ad-hoc approach.

  2. It will protect the organization's intellectual property - this should be the most important consideration for any software company (other than data...). You are payed to create software - shouldn't it be accessible in its entirety?

  3. It will provide quicker, more reliable and straightforward backup mechanisms - all VCSs have built in dumping capabilities. These tend to be more mature than a simple file copy.

  4. It will act as a communication mechanism between developers - depending on the version control system you may use comments/labels/checkout status to determine if someone else has worked on a file, if it has been promoted to production, if it has a corresponding support ticket number etc.

  5. It streamlines development - the ability to compare versions of files as well as the other mechanisms will be beneficial to your company period.

Jason Irwin
A: 

The easiest way to convince management to invest Time in a SCCS is focus on backup and archival. By utilizing something like Subversion (SVN), you can restore any project to any point in time instantly. There is no need to have someone look through backup tapes or worry about tracking multiple versions in an obtuse directory structure.

There are obviously many other advantages (i.e. 2 people working on the same file at the same time), but backups are what quickly sold my company many years ago.

Jess
A: 

Others have mentioned the specific benefits of source control elsewhere, but I wanted to explicitly address the "VSS" portion of the question.

If your boss wants to use a Microsoft tool, Team Foundation Server with Team Suite is a very nice combination. It also has other tools included, such as bug tracking, documents, and reporting capabilities, which makes a nice platform on which to later improve your process. We are quite happy with it where I work, and my coworkers have told me horror stories about VSS.

Keep TFS in mind as a response to the 'Microsoft Tools' question.

Colin Dabritz