U2U Blog Center

For developers and other creative minds

Welcome at the U2U Blog Center

U2U has built up the last 18 years a huge amount of expertise in the Microsoft .NET Framework. Expertise they have always shared in the community. Below you can find a list of the blogs maintained by U2U trainers.

Project Management: Hierarchical Work Items with Visual Studio and Project in Team System 2010

In my previous posts I talked about high level project management, and detailed iteration planning. Both created work items, mainly user stories with child task work items. How does this work in Visual Studio? And what about MS Project? Visual Studio and hierarchical work items Let’s start with Visual Studio. Open your team project and expand the Team Queries, then Workbook Queries: You’ll notice that for each iteration VSTS creates an iteration backlog query, showing you the work items for the iteration. Pay attention to the icon: this means that this is a hierarchical query which will use indentation to show the parent child relation. Execute one of the iteration backlog queries. You should get a list user stories: Notice the + sign before the user story title: with this you can expand the the child tasks. In the toolbar you can also see an + and – icon. These will expand/contract all user stories with their children: Should you see a task assigned to the wrong user story, you can simple drag it to the correct one, and Visual Studio will automatically move it, and indicate your changes using bold. Here I’ve moved tasks #48 to user story #11: You can also use the green arrows in the toolbar to change the level of a work item, for example to make it a child work item. Be careful: this only works if your work items is below a user story. Otherwise drag it to the parent like before. You can also directly create a child work item by right-clicking on a work item and adding a New Linked Work Item. Linking to other work items has been greatly extended. You can now choose from a variety of links: Note the predecessor link. We will revisit this when we look at MS Project and TFS. Scheduling tasks with MS Project When using MS Project with TFS 2008, dependencies added with MS Project would not be saved back to TFS. With TFS 2010 you can now easily plan tasks in project using Gantt charts, add dependencies and publish back to TFS without losing these dependencies. Start MS Project using the “Open in Microsoft XXX” feature in Visual Studio: Let’s say you have two tasks: Now you want to indicate that the first task assigned to April must be done before April can start the second task. Do to this Alt-drag the first task to the second task to create a predecessor relation. Your Gantt chart should now look like this: Note the Predecessors column which contains the row number of the first task. This is not the work item id, it is the number of the row in Project. Now you can publish this back to TFS. After that, go back to Visual Studio and open the first work item. Go to the links tab. You should now see a successor link to the next task:

Project Management: Planning a project with Team System 2010

Project management has changed. Changed towards SCRUM based project management where you start by building a list of User Stories, also known as the backlog... This list of user stories allows you to plan the project by selecting the highest priority user stories, adding them to an iteration, planning the iteration and implementing it. User stories are assigned story points which is an abstract unit for measuring the amount of work. Let’ start by creating a new Team Project. Nothing has changed in the “New Team Project” wizard except that the team project templates have been modified (to better support SCRUM like project management). Again you can choose between an agile template and the CMMI template. The CMMI (Capability Maturity Model Integration) template is more formal; in this post I’ll be using the agile template. Creating user stories A newly created team project will now be empty of work items; the intent is that you start by creating User Stories. These user stories describe the user’s needs. Then you prioritize the user stories and assign story points to them to estimate the work required. A user story is a very slim and high-level user requirement. For example: “The delegate can pay by credit card to confirm reserving the course” (Personally I see user stories as short-hand versions of use cases). To create a new user story with Team System you can choose between Visual Studio, Excel or Team Web Access. Using Excel To create user stories you’ll probably want to use Excel. Previously I found the workbook that came with team foundation 2008 a little lacking, but now you get all you need to perform high level planning. So let’s set out and try this. Open Team Project explorer, and drill down to Documents->Shared Documents. Double click on Project Backlog.xlsm to open Microsoft Excel. Ignore the security warnings if you get some... The Product Backlog is a new workbook that enables you to manage your product backlog of work items from within Microsoft Excel. Start by refreshing from the server by clicking the Refresh button. This will synchronize your workbook with changes made to the server. From Excel you can also edit your areas and iterations, access Team Web Access, and create reports. But also take notice to the sheets in this workbook: First one is for editing the backlog, second one is for high-level iteration planning and the third one is for planning interruptions. The workbook takes very good care of synchronizing changes from one sheet in the other. Let’s start with the first one: the product backlog. The workbook is open in read-only mode by default, so start by clicking on the “Edit workbook“ button: Then you can start adding user stories: Prioritize your user stories by assigning a rank. Prioritizing user stories can be done in many ways, for example Karl Wiegers Kano model. You also need to assign story points as an estimate for the amount of work required (story points don’t generally use precise estimates, like hours or something). Using Visual Studio You can also use Visual Studio to add a new user story; then you’ll get this window inside VS: Please note the format of the title. This makes it a lot easier to think about user stories. Using VS for a single user story works like a charm, but for lists of users stories you’ll want to use Excel. Using Team Web Access Another option, which I think is quite realistic for project managers (and even end users), is to use a web site for editing work items. That is why Team System comes with Team Web Access. You can find the site from your team project portal. Then you can add any work item directly like this: Select User Story from the drop down and you get this: Again, you can add all necessary information directly. Planning Iterations Once you have a good idea about your user stories, you can start iteration planning. In this phase you will assign user stories to iterations. Each iteration will have room for a number of story points (this number is called project velocity, which is the average number of story points your team can do in a single iteration). Iteration planning is done with the Iteration planning worksheet. Note the help above. Once you’re familiar with this sheet you can hide the help. In here you plan your iterations. First you enter start and end date. The sheet will calculate the number of days for the iteration, taking into consideration any planned interruptions you entered into the interruptions sheet. Next you can start to assign user stories to iterations. The sheet will update again with a simple bar chart, making it easier to load balance your work over iterations: The interruptions sheet is just that, simply fill out any dates when no work can be done on the project because of holidays, special events, etc… The Planned Iterations sheet will automatically update nr of days with it. So for example, if we plan a team building meeting in Hawai on the 01/13/2010, the iteration will have 4 days: That’s it for now. In my next post I’ll discuss detailed iteration planning with Visual Studio 2010. Trying this yourself If you want to try this yourself, I recommend you download the virtual machine from Microsoft (comes with sample data and all, and a bunch of labs). The one using Virtual PC 2007 The one for Windows 7 Virtual PC The one for Hyper-V Windows Server 2008

Blogging Frenzy

Looks like I started to blog a lot more lately, and so do a couple of my colleagues. Check out Nick’s blog: http://blogs.u2u.be/Nick/  And of course Kris’s blog: http://blogs.u2u.be/Kris/ Both of them have gone crazy with Extension methods… So should I?

Workflow 4 parallel and compensation activities

So I’m looking into workflow foundation 4 (using Visual Studio 2010 Beta 2). Let’s look at the parallel activity included within. The parallel activity will schedule all of its child activities asynchronously and then wait until all children have completed or the CompletionCondition evaluates to True. Let’s do a little experiment: Start Visual Studio and create a new workflow console application. Drag a Sequence activity to the designer. In it add a WriteLine activity and a Parallel activity. Drag a sequence activity inside the parallel activity. It will automatically split up to allow other branches: Rename this sequence to left, then add a WriteLine activity, a Delay and another WriteLine activity. Repeat this for the right branch, calling it Right. Now we only need to add two variables to time the delays. Select the Start sequence, and on the bottom of the designer click on the variables button. This will open the variables window: In here define two variables leftDelay and rightDelay and make them of type TimeSpan using the dropdown combobox and select “Browse for Types…”. This should open the “Browse and Select a .NET Type” dialog. One of the new things I like about this window is that you can search for a type: Finally we should end up with this: Run and you should get this: As you can see the parallel activity will now execute both left and right branches. But what if you want one of the branches to stop because another branch has done all that is needed? For that we can use the Parallel’s activity CompletionCondition. When one of the branches of the parallel activity completes, the parallel activity will check its CompletionCondition. If set to false, it will allow other braches to continue. Otherwise it will cancel the other, still running, branches. So let’s test this. Click on the parallel activity and add a new boolean variable called stopProcessing (I’ve renamed the parallel activity Race, so that’s set as the stopProcessing variable’s scope): Now set the parallel activity CompletionCondition to this variable by clicking the activity and using the property window: Next add to each branch an assignment activity after the last writeline to set the stopProcessing to true: Run: you should see one branch complete while the other never does: And what about doing something when you get cancelled? To do this we need to use a CancellationScope. A CancellationScope allows you to define what needs to be done when a branch gets cancelled, for example in a parallel activity because another branch completed with the CompletionCondition set to True. Let’s try this. Inside the parallel activity drag a CancellationScope. Then drag the left branch in it. Repeat with a new CancellationScope for the right branch. Drag a WriteLine activity into each CancellationScope’s CancellationHandler. For example the left side should write “Left was cancelled” in the CancellationHandler: Run again: You should now see one side complete, and the other being cancelled: WARNING: Although you might think it is a good idea to schedule as much work as possible in parallel, this will not make your orchestration faster. WF will still schedule all activities on the same thread, so if your activities never go idle, it will take the same amount of time as if you’re using a sequence. Only if each branch in the parallel activity needs to wait on some response will using the parallel activity make a difference.

Visual Studio 2010 Beta 2 available today!

I’m downloading it as we speak. So please wait until I’ve done :) Oh, for the first couple of days the download is only available through MSDN subscriber download, but then MS will make it public for everyone. Today Microsoft announced a new (albeit beta 2) release of their flagship developer software, Visual Studio 2010. I’m curious if Sharepoint development will be available now because we’re building our new Sharepoint 2010 course and I think this would be nice to have (I’ll check it out after downloading completes, look for details here). I’ll also be looking at improvement in the Workflow Foundation 4 designer, because some things didn’t work yet with the designer (but in code it did). Of course I’m loving .NET framework 4 with its WCF improvements. I’ve been looking over them and I’m impressed. Especially with the integration of the REST starter toolkit, because I’m sure REST will become more and more important for Web service development, thinking about Silverlight for example. And for MSDN subscribers we will get: Free develop hours with Azure Full access to Team Foundation Server 2010 40 hours of e-Learning Also the official date of the launch of Visual Studio has been released: 22 march 2010. So what’s with the 22 of the month (on 22 October MS is releasing Windows 7 to the public)? :)

Generate sequence diagrams with Visual studio 2010

Cool! I’ve just discovered this new feature in Visual Studio 2010 (Beta 2) where you can generate a sequence diagram from your code. This should take the hard bit out of generating documentation from your code :) Here’s a screen shot: The only thing you need to to is to point to the method you want to see a sequence diagram for, right-click and choose Generate Sequence Diagram… Then Visual Studio will ask you how deep you want to go, which classes/methods to include in the sequence diagram: And then you can start making changes to the diagram: Nice!

Installing VS2010 Beta 2

So I’ve installed VS2010 today. Installation went quite well but you might want to uninstall the Silverlight 3 SDK because that gave an issue on my machine. The VS logo has changed colors: Usual license stuff… 5.6 Gb on disk required… And there we go… This took about half an hour on my machine. Please note that I first expanded the .iso to a directory. Doing this on an external disk might speed things up… Sharepoint developers: look at this! And for the Silverlight people, yes, we can now do drag&drop databinding using the data sources window:

Strange but true: using a keyword as a variable

Can you use a keyword as an argument, or any other kind of local variable? Why would you want to do that? That aside: how? Easy! Just use the @ in front of any keyword and you can now use it as a variable. For example: class Program {   static void UsingKeywordArg(string @string)   {     Console.WriteLine(@string);   }     static void Main(string[] args)   {     UsingKeywordArg("Hello world");   } }   I found this while digging through some generated code from workflow foundation 4. Cool!