Latest issue: June

Sister website

Sister website

Website rate card

Features

Integration is the key to true teamwork

By Dave Baker and Joel Semeniuk, Microsoft

As the year on year growth in the size and complexity of software almost becomes exponential, it becomes more difficult to develop programs using traditional methods. One way to try and solve this problem is to throw more resources at it. These extra resources help, but there is a finite amount of time, money and manpower that can be thrown at a project before the law of diminishing returns sets in.

Communication between departments, or even groups doing similar jobs in differing geographical locations, starts to deteriorate, version tracking becomes difficult, mistakes creep into the code and test coverage is nowhere near as comprehensive as it should be. The answer to this conundrum is to work smarter; use formal methods and tools which will maximise available resources and make project management much easier. This article looks at one such tool, Microsoft’s Visual Studio Team System and explains how the features can assist in the development of even the most complex applications.

Visual Studio Team System is an Application Lifecycle Management solution (ALM) that changes the focus of the project from developer to development. The ALM solution is designed to assist throughout the entire lifecycle from design, develop, build, test, configure and item tracking through to process methodology. This set of tools is extensible and customisable so that the set used can be tailored for each individual customer.

Figure 1. Microsoft Visual Studio Team System.

Team System for Software Architects

Distributed System Designers make modelling an integral new capability of Visual Studio. These designers don’t just create attractive diagrams, but evaluate application and system design for deployment before writing any code. All of the Distributed System Designers in Team Architect leverage the System Definition Model (SDM), an XML-based format that stores the model definition. SDM provides a common language in which both application systems and datacenter infrastructure can be described, enabling better communication between experts in each field, and allowing an application to be validated to determine whether it could be successfully deployed and run in a target environment.

Logical Datacenter Designer

The physical infrastructure of a datacenter is not normally significant to a developer who needs to understand what application hosting environments are present, and how they are configured, constrained, and connected. The Logical Datacenter Designer is used to create a logical datacenter diagram, which does not depict physical machines or even machine types in a datacenter, but is used to define or document specific configurations of application server software and to show how these configured logical representations of (application) servers are interconnected.

Once properties are added to the logical servers and zones in the diagram, these shapes can be added to the Toolbox for future reuse. For each logical server or zone placed on a diagram, a set of constraints and settings can be specified and a policy of operating characteristics of each server that must be adhered to by applications that will be deployed on that server.

Application Designer

After visualising a solution on a whiteboard, models are refined until ready to move on to deeper design, functional decomposition, and finally, construction. Application Designer allows the design and configure of applications using a tool that understands what is being built. Using the application diagram, the solution can be decomposed into applications.

Similar to the Logical Datacenter Designer, additional constraints and properties can be added to application definitions and endpoints, using the Settings and Constraints Editor. These constraints specify application requirements for deployment and constrain the logical server types to which an application can deploy.

Figure 2. System diagram. he Properties dialog box of any managed code project, click the Code Analysis tab, and select Enable Code Analysis.

There are dozens of rules that are already defined and enabled—from rules that check coding and design guidelines, to rules that check for security issues. It is possible to disable rules that don’t apply to the project, as well as create custom rules to look for specific code patterns. When a rule detects a problem with the code, Visual Studio will throw either a warning or an error, depending on how the rule is configured.

The code analysis tools can also be used to improve the quality of native Microsoft C++ code. For example, these tools can be used to help identify buffer overruns, un-initialised memory, and null pointer dereferencing. These are reported in the same fashion as compiler warnings, which can be turned off using the #pragma compiler directive.

Dynamic Analysis

The dynamic code analysis toolset includes a code profiler to measure the performance of applications at runtime. There are two profiling modes: sampling and instrumentation.

Sampling takes “samples” of application performance every so often, to find out what it’s doing. This form of analysis makes it less likely that the act of profiling itself will affect the performance of the application, because it is only running a small percentage of the time. Due to the statistical nature of the approach, however, it doesn’t provide an exact representation of application timing.

Instrumentation, on the other hand, provides a thorough account of what the application is doing, because before the application is executed, the profiler will instrument extra code into every single procedure and method call, allowing it to track exactly what method was called and how long the method took to execute. Instrumentation-based profiling will slow down the performance of the application, simply because there are more lines of code running and more data being collected.

Unit Testing

Unit testing has always been an important part of the software development process. Unit testing refers to a specific type of testing responsible for validating one aspect of the system—a specific function or procedure, a component, or even a usage scenario. Team System provides a framework for writing and executing unit tests in both Team Developer and Team Test, and provides tight integration into the development IDE. As shown in Code Sample 1, unit tests are attributed test functions that verify the behavior of a corresponding function or procedure in the product under test. Once the [TestMethod] is added to test code, Visual Studio will recognise it as a unit test and display the function in the Test Manager windows.
[TestMethod()]
public void AdditionTest()
{
Math target = new Math();

int x = 5;

int y = 5;

int expected = 10;
int actual;

actual = target.Addition(x, y);
Assert.AreEqual(expected, actual,
“Math.Addition did not return the expected value.”);
}
Code Sample 1. Simple unit test

Test Manager will allow the selection and execution of unit tests, as well as group, filter, and organise them into Test Lists. Each test managed through the Test Manager can have a set of work items associated with it, as well as other pieces of metadata, including Priority, Owner, and Class Name.

Code Coverage

Team Developer and Team Test both provide the ability to execute unit tests and to track which lines of code executed during those tests. These results will indicate what other unit tests may be required in order to ensure that all lines of code are tested, as well as to give a good idea of how complete testing practices are.

Team System for Software Testers

There is often a temptation to skimp on software quality assurance. Furthermore, those organisations that embrace testing on software development projects often don’t have a very good selection of integrated tools to support testing needs, being forced to purchase very expensive and not well integrated software testing solutions. Microsoft has addressed these challenges by providing a set of integrated testing tools for both developers and testers alike.

Build Automation

Build automation is an extremely important best practice for software development teams. Team System provides build automation with Team Foundation Build, which leverages MSBuild, can run associated unit tests and code analysis, release builds to a file server, and publish build reports. Team Foundation Build results and logs can be propagated to the Team System data warehouse for reporting and analysis. Additionally, Team Foundation Build is fully integrated with other Team System tools such as source control and work item tracking. There are also many different build types that can be defined and customised.

The results of all builds are maintained, and can be viewed from within Visual Studio or through build reports. It is also important to note that many build machines can be set up to perform the build process.

Project Site

When a new Team System project is created, a new Microsoft Windows Sharepoint Site can also be created to enhance collaboration for the project. Sharepoint Services provide the document management and storage capabilities for documentation created by the team for the project. The definition of the Team System project template also defines the structure and content of the Sharepoint site, down to document library structure and document templates.

Project Management

Visual Studio Team System provides a built-in interface to allow project managers to interact with work items. However, in many cases, it’s much more natural to have project managers use the tools they most commonly use to do their jobs. Team System allows the synchronization of work items with Microsoft Excel and Microsoft Project.

www.microsoft.com/uk/embedded

A more comprehensive version of this article can be found at
http://msdn2.microsoft.com/en-us/library/ms364075(vs.80).aspx