Blogginlägg -

TFS and Git code reviews

One of the major features in TFS 2013 Update 4 CTP1 is the ability to create pull requests when using Git. This article will explain how the pull request feature is used for its intended use of performing code reviews on feature branches.

But first we will start with some basic introduction to TFS and version control just to make sure that everyone reading this article may feel comfortable with what we are talking about.

TFS
Team Foundation Server (commonly abbreviated to TFS) is a Microsoft product which provides source code management (either via Team Foundation Version Control (TFVC) or Git), reporting, requirements management, project management (for both agile software development and waterfall teams), automated builds, lab management, testing and release management capabilities. It covers the entire application lifecycle. TFS can be used as a back end to numerous integrated development environments but is tailored for Microsoft Visual Studio and Eclipse (on Windows and non-Windows platforms).

Version Control
There are a lot of different approaches to the problem of version control (VC). The simplest and sadly the most common way are to simple do this manually by copying files into time stamped backup folders. For any serous work such a manual VC approach will soon be incredibly error prone. The amount of copies of files will soon be so many that accidents are prone to happen.

VC becomes even more challenging when it comes to versioning files containing source code, since every change may cause a lot of things to a program or application. So for decades developers have used and improved on what we now call Version Control Systems (VCSs), for keeping track of changes to files.

TFS (Team Foundation Server) is developed by Microsoft and have become very popular since it integrates with Microsoft’s development environment Visual Studio. TFS also provides VC in the form of Microsoft’s own TFVC (Team Foundation Version Control). But the restrictiveness of TFVC and the popularity of the brilliant way the Linux community have solved the VC problem with it’s Git distributed VCS, Microsoft announced on Wednesday Jan 30 2013 that they would include Git in TFS 2013. . This was part of Microsoft attempt to interest embedded developers, people working in distributed teams, especially the huge open source arena, to Microsoft’s integrated development environment Visual Studio and TFS. However they failed to include support features for code reviews using Git up until November 12 2014 and the TFS 2013 update 4 release.

Code Review
In its simplest form, a code review is whenever we take a look at source code and give feedback to whomever are interested in the same code. Formally I will just refer to the following quote from Wikipedia.

“Code Review is systematic examination (often known as peer review) of computer source code. It is intended to find and fix mistakes overlooked in the initial development phase, improving both the overall quality of software and the developers' skills.” [Wikipedia]

I wont dive into specifics on code review strategies in this article. The important thing is to understand why code review can be improved by version control. A modern VCS intended for versioning source code will also address the problem of visualizing the changes that has been made to any file under version control. Since reviewing code is costly indeed it is convenient to make reviews on strategic changes to the code rather than on the complete code base. Fore example, if we delegate someone in our team to implement a certain feature it would be brilliant if we could review just the code for that feature when it is done. This is what we can use VCS for.

TFS Pull request
Let’s say our resource could request a code review when the feature he is working on is thought to be complete. Let’s imagine that we could perform our review in a forum like webpage and that our comments and feedback can be discussed back and forward by all the team members. Thus improving both the implementation of the feature and the knowledge of its implementation to every one involved in the discussion (Code Review). This could then be integrated with the development process and the VCS so that when a feature gets approved by the Code Review it will be included (merged) to a more stable version of the code. This is exactly what pull requests in TFS Git repositories is all about.

Ämnen

  • Data, Telekom, IT

Kontakter