When a programmer joins a team, he is at least expected to have a basic understanding of the process of handling code within a team. And the following questions have been taken from real world interviews and groups discussions
Q. How can a team work on a code that is used by a team of 15 people?
A. A team can work on a shared code using version control also known as source control or revision control.
Q. What is version control, in brief?
A. Version control is a system that manages the changes to the files over time. The version control tool records all the changes made by anyone in the team. It is usually done by storing the modification time-stamp and the id of the user who did the change.
Q. What are mostly used version control tools?
A. Various version control tools that are widely used:
- Apache Subversion – SVN
Q. What is the process of changing code?
A. Here are the steps a developer follows to change any file any version control:
- Checks out the file
- Modifies the working copy of the file
- Checks in the file
The above steps are followed so that the file remains in consistent state and only one person is modifying a file at a particular point of time. But there are also versions control tools that allow more than one person to modify a file at the same time. And this then needs merging.
Q. What is repository?
A. A repository is an on-disk data structure which stores metadata for a set of files/directory structure. Any number of clients connect to the repository, and then read or write to these files/ directories. It is more like a file server but also stores all the revisions of file.
Q. What is merging?
A. When more than one developer is changing the file at the same time merging of the code is needed. Let us take an example:
- File X is updated to revsion 12 by developer A and developer B.
- Developer A checks in the changes to the repository and the file X has now version 13.
- Developer B has done the changes on top of version 12 and has to check-in his changes
- Developer B merges the changes from version 13 with the local changes and commits the file.
- Now the file version is 14.
Q. What is a code merging tool?
A. A code merging tool helps a developer to integrate the code from repository and the local changes. It shows the differences between the local file and the remote file. A good example of code merging tool is WinMerge.