Locking that is.
I had a funny situation recently. The funny situation being: moving document from the document management system to the source control system. Nothing special and I understand the reasons. But it got me thinking… Some time ago I would have opted to keep everything in source control. And getting a little maturer I changed this opinion.
Today my opinion is that document should be kept in a document management system and source code in a source control system. Sounds logical. But did you ever ask yourself why this is so? I have today and after thinking about it for some time came to the conclusion that the main difference is the concurrency control.
If you want to read more about concurrency control you can find better sources on the internet. What I would like to stress here is:
- Source control system use optimistic locking
- Document management systems use pessimistic locking
Working with source code you do not want to acquire exclusive edit tokens for every file you touch. This would basically make normal work impossible. You want to do your work and after you are done you take care of all the conflicts.
On the other hand if you are working on a document (word, writer, …), the last thing you want is to find out that someone beat you to the punch and checked in a newer version of the same document. Resolving the merge conflicts is quite a challenge. In this situation you want to acquire a exclusive edit token for your document.
So why is resolving merge conflicts in document hard and the same thing with source code easy? Thinking about it I come to a weary simple conclusion: Source code is nothing more than text file; documents are big binary files that need special applications to make sense of the zeros and ones.
Taking this into account we have to change our initial categorization of source code and documents to text files and binary files. Going along this line of thought we can put up the following finding:
- Optimistic locking with text files
- Pessimistic locking with binary files
This way you can edit all your images, documents and presentations without fear, and the developers can do their stuff efficiently.