Code Review Workflow in Visual Studio vNext - Visual Studio 11 / TFS 11

Posted by: Subodh Sohoni , on 9/22/2011, in Category Visual Studio
Views: 94080
Abstract: There are many new features that Microsoft intends to introduce in VS11 / TFS 11. In this article I am going to take an overview of the code review feature which is one of the new standard features. Till TFS 2010, we used to implement code review workflow with the custom work item, custom check-in policy and a server side event handler. With TFS 11, we will not need to do some parts of this customization since Microsoft has also provided these parts built-in.

There are many new features that Microsoft intends to introduce in VS11 / TFS 11. In this article I am going to take an overview of the code review feature which is one of the new standard features. Till TFS 2010, we used to implement code review workflow with the custom work item, custom check-in policy and a server side event handler. With TFS 11, we will not need to do some parts of this customization since Microsoft has also provided these parts built-in.  

One major change in approach that Microsoft provides in VS 11 /TFS 11 is the default tools built-in along with work items. There are a some new work items types that can be accessed using those tools only and not directly in their form in Visual Studio. Code Review Request and Code Review  

Response is a pair of work items like those. They have built in tools that integrate in Team Explorer and provide a special UI to manipulate data and state of those work items.  

Note: VS 11 / TFS 11 are only code names of the Visual Studio / Team Foundation Server planned to be released in near future and not the final brand names/  

 

Let us take a case a where a developer named Arun has modified a line of code and now seeks to check-in the code. 

clip_image002

 Before he does the check-in, it is desirable that he gets the code reviewed by a peer or a senior developer in the team. In Team Explorer under Pending Changes, he finds an option to Request Review.  

clip_image004

 Arun selects that option (Request Review) that opens the form to create a new Code Review Request work item. He assigns that work item to another developer named Subodh from the same team. 

clip_image006

 

He also provides a title of the work item and Submits the Code Review. While saving the work item, the code that was changed (Form1.cs) is shelved and a reference to that is added to the work item.  

clip_image008  

Arun can view that submitted code review request under My Work page in the Team Explorer on his computer.  

clip_image009

 When developer Subodh opens My Work page in team explorer on his computer, he can see that submitted work item (Code Review Request) appearing under the Code Reviews and Requests node.  

clip_image010

 He clicks on that node to expand and views details of that code review request.  

clip_image011

 Subodh can also view the shelveset that contains the Form1.cs file. When he selects the file from that shelveset, he can see two lines for the changed line of code. The previous state of the same line appears with pink background and the state as changed by Arun appears with yellow background.  

clip_image013

 

Subodh decides to accept the change but also decides to provide some review comments. He adds the comments on the Code Review tool that is showing the details of Code Review Request work item.

 He provides the comments for the Form1.cs as well as at overall Review level.  

clip_image014

 Now Subodh clicks on the Accept button where he chooses to accept the code changes with comments. At this time, TFS creates a new work item of the type Work Item Response and links that to the original work item of the type Code Review Request with Parent (Request) – Child (Response) relationship.  

clip_image015 clip_image016

 Now Arun can view the changed state of Code Review that he had requested.  

clip_image017

 He associates this work item with the check-in that he is doing and completes the check-in operation.

 clip_image019 clip_image021

 He can view the associated work item by going to the Changeset details.  

clip_image022

 Code Review Request work items appears as Closed.  

clip_image023

 If a query to view hierarchy of work items is created, it shows the Code Review Requests and Code Review Responses with Parent – Child relationship between them.  

clip_image025

 In this workflow, there still is no compulsion made on Arun to get the code review done. It is desirable to have such a compulsion. That may be implemented by implementing a custom check-in policy. It is also desirable to have a custom group of developers who are designated as code reviewers and Code Review Request work item can be assigned only to them. In the next article, I will try to provide a solution for these desires that I have mentioned. Stay tuned!

This article has been editorially reviewed by Suprotim Agarwal.

Absolutely Awesome Book on C# and .NET

C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.

We at DotNetCurry are very excited to announce The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).

Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.

Click here to Explore the Table of Contents or Download Sample Chapters!

What Others Are Reading!
Was this article worth reading? Share it with fellow developers too. Thanks!
Share on LinkedIn
Share on Google+

Author

Subodh is a Trainer and consultant on Azure DevOps and Scrum. He has an experience of over 33 years in team management, training, consulting, sales, production, software development and deployment. He is an engineer from Pune University and has done his post-graduation from IIT, Madras. He is a Microsoft Most Valuable Professional (MVP) - Developer Technologies (Azure DevOps), Microsoft Certified Trainer (MCT), Microsoft Certified Azure DevOps Engineer Expert, Professional Scrum Developer and Professional Scrum Master (II). He has conducted more than 300 corporate trainings on Microsoft technologies in India, USA, Malaysia, Australia, New Zealand, Singapore, UAE, Philippines and Sri Lanka. He has also completed over 50 consulting assignments - some of which included entire Azure DevOps implementation for the organizations.

He has authored more than 85 tutorials on Azure DevOps, Scrum, TFS and VS ALM which are published on www.dotnetcurry.com.Subodh is a regular speaker at Microsoft events including Partner Leadership Conclave.You can connect with him on LinkedIn .


Page copy protected against web site content infringement 	by Copyscape




Feedback - Leave us some adulation, criticism and everything in between!
Comment posted by Ashutosh nigam on Thursday, September 22, 2011 7:36 AM
a great post...thanks for sharing
Comment posted by Tarun Arora on Thursday, September 22, 2011 7:35 PM
Hi Subodh, Code review is indeed an exciting new feature introduced in TFS 11. I have found some bugs and missing features in my assessment that I have blogged about here http://tinyurl.com/3apzeh4. Cheers, Tarun
Comment posted by manoochehr on Wednesday, May 30, 2012 11:52 PM
hi
how can i implementation this workfolw in vs2010 ?
please help me...
thanks a lot
Comment posted by Subodh Sohoni on Thursday, May 31, 2012 10:28 AM
There is no one to one way in TFS 2010 to implement this Code Review workflow. You will need to create a new work item type, custom check-in policy and a few event handlers. Follow article http://www.dotnetcurry.com/ShowArticle.aspx?ID=171 for the first two. For event handling follow article written by Martin Hinshelwood http://blog.hinshelwood.com/tfs-event-handler-for-team-foundation-server-2010/
Comment posted by manoochehr on Saturday, June 2, 2012 4:14 AM
thanks Subodh Sohoni
in first url that you send for me i can't undestand (Subscribing to events) if you know another article please send to me
and i can't open this page :http://blog.hinshelwood.com/tfs-event-handler-for-team-foundation-server-2010/..
my question is:
i have 3 group of users that use tfs. 1- amatory programmer that code reviewer must be review them code 2-code reviewer that don't need to review his code and can be ckeckin directly 3-another programer that don't need to review them code but code a copy of them codes automatically send to code reviewer...
how can i implement this ?
thanks for your help..
Comment posted by manoochehr on Saturday, June 2, 2012 4:15 AM
thanks Subodh Sohoni
in first url that you send for me i can't undestand (Subscribing to events) if you know another article please send to me
and i can't open this page :http://blog.hinshelwood.com/tfs-event-handler-for-team-foundation-server-2010/..
my question is:
i have 3 group of users that use tfs. 1- amatory programmer that code reviewer must be review them code 2-code reviewer that don't need to review his code and can be ckeckin directly 3-another programer that don't need to review them code but code a copy of them codes automatically send to code reviewer...
how can i implement this ?
thanks for your help..
Comment posted by Subodh Sohoni on Tuesday, June 5, 2012 12:16 PM
Hi Manoochehr
I will think about your question and answer in a couple of days.
Comment posted by Oren Micha on Monday, July 16, 2012 10:04 AM
Very Nice ... waiting for the next article....