300 likes | 501 Views
A Taste of Visual Studio 2005. David Grey. Introduction. In this session we will introduce Visual Studio 2005 and its features and examine those features that are most relevant to CS teaching Class Designer Object Test Bench Refactoring Unit testing, static analysis and code coverage
E N D
A Taste of Visual Studio 2005 David Grey
Introduction • In this session we will introduce Visual Studio 2005 and its features and examine those features that are most relevant to CS teaching • Class Designer • Object Test Bench • Refactoring • Unit testing, static analysis and code coverage • Source control and Team Foundation Server
Overview • Visual Studio 2005 comes in several different editions • Express editions • Standard • Professional (supplied in MSDN AA) • Similar feature set to Visual Studio .NET 2003, plus Class Designer and Object Test Bench • Team System editions • Team Architect: Professional edition plus visual distributed application and SOA design tools • Team Developer: Professional edition plus unit testing, code coverage, static analysis, profiling • Team Tester: unit testing, code coverage, Web load testing, test management • Team Suite (contains all of the Team System editions) • Team Foundation Server : Server back-end for Visual Studio which offers source control, bug tracking and work item management, automated build and test, collaborative working tools
Visual Studio Express Editions • Completely free, stripped-down version of one of the technologies in Visual Studio 2005 • Designed for hobbyists and teaching • Ideal for introductory teaching • Simpler user interface than Visual Studio • Software is freely available to all • Ships with wide range of sample starter applications • Express editions available: • Visual C# Express • Visual Basic Express • Visual C++ Express • Visual J# Express • Web Developer Express - supports ASP .NET development
Deploying Visual Studio 2005 • Visual Studio 2005 will co-exist with Visual Studio .NET 2003 • Occasional errors with plug-ins registered against one version not working in the other • Visual Studio 2005 will co-exist with Visual Studio 2005 Express editions • Can use Express editions for introductory programming courses and move to full version as confidence in the IDE grows
Class Designer • Not a UML modelling tool but supports graphical design of classes • Each class represented by a shape • Methods, properties, fields and events listed • New members can be added directly to the diagram • Tightly coupled to source code • Adding new members to diagram generates source for them • Modifying source updates the diagram • Good for • Understanding relationship between classes • Performing class-level design inside the IDE
demo • Visual Studio 2005 IDE • Using Class Designer • Adding new classes • Adding members to classes • Source code integration
Object Test Bench • Designed for simple object-level testing • Object Test Bench can be used for • Teaching object-oriented programming concepts without going into language syntax. • Testing simple classes and their methods. • Providing a lightweight testing tool designed for use on small and simple projects. • Discovering the behaviour of a library API quickly.
demo • Using Object Test Bench • Creating object instances • Invoking methods • Using other object instances
Refactoring • Visual Studio supports several source-code refactorings • Encapsulating a field as a property • Promoting a local variable to a parameter • Reordering method parameters • Extracting a block as new method • Extracting an interface from a class • When performing a refactoring, all affected code is updated • Benefits • Simplifies refactoring for novice programmers • Productivity improvements for experienced programmers • Allows consideration of refactoring and design issues without requiring large amount of language experience
demo • Refactoring with the Visual Studio IDE
Improving Coding Skills Static Analysis, Refactoring and Testing
Static Analysis • Static analysis for .NET was previously only available in a 3rd party open source tool –FxCop • FxCop integrated into IDE and build process in VS 2005 • FxCop • Extensible, rule driven static analysis tool • Detects known security issues and poor programming practices • Suggest ways to improve code and its performance • Customisable with configurable rule sets and custom rules • Pre-defined rules based on commercial best practice • Useful tool for students • Highlights limitations of their code • Suggests common performance and maintainability improvements • Helps improve coding standards by illustrating differences between student code and commercial-grade code
demo • Examining code with FxCop static analysis • Configuring FxCop • Integrating into the build process
Testing in Visual Studio 2005 • Visual Studio 2005 has extensive testing tools • Team Tester version aimed solely at testers • Unit testing tool and code coverage integrated directly into the IDE • Code generation support for tests • Other testing tools exist in VS but probably less relevant to general-purpose CS teaching
Unit Testing • Easy to generate unit tests for code by right clicking the class or method • Generates one test case per method • Attempts to write sensible basic test as prelude to developer writing the test properly • Auto-generates all code required to access private members • Promotes writing of tests after writing code • Doesn’t fit well with test driven approaches • Possible to write tests manually before code to be tested is written but less IDE support for this
demo • Creating unit tests • Test View and running unit tests
Code Coverage Analysis • Code coverage statistics can be generated during unit testing • Configured through project properties • Detailed statistics shown in test results • Tested/untested code paths highlighted directly in source code view • Clear visualization of what has and has not been tested
demo • Code coverage
Team Foundation Server Visual Studio for Group Working
What is Team Foundation Server? • TFS is the server back-end for Visual Studio 2005 which provides • Source control and check-in policies • Bug tracking and work item management • Automated building and testing • Project portal and reporting • Customizable software methodology templates • Supports collaborative working for software development teams • Team Foundation features accessed through • Team Explorer add-on client for VS 2005 • Sharepoint portal for each project • Standard Office tools (e.g. Excel, Project, etc) • Team Foundation Server releases Q1 2006 • Not available in MSDN AA
Team Foundation Source Control • Tight integration with IDE • Based on SQL Server database • Significant improvement over SourceSafe, though SourceSafe can still be used • Supports complex branching and merging, concurrent check-out, code shelving • Enables customisable check-in policies to be enforced • e.g. code must pass FxCop analysis, defined set of unit tests must be passed, code reviews performed, etc • Association of check-ins with work items and bug tracking
Work Item Management • Team Foundation Server enables • Definition of work items • Assignment of tasks to team members • Monitoring progress on tasks • Bug tracking, and assignment of tasks to resolve bugs • Sophisticated reporting tools provided which provide a range of software development metrics and predications • e.g. bug rates, predicted completion dates, overall progress and quality
Project Portal • TFS creates a Sharepoint portal for each project • Accessible only to team members • Provides access to a range of reports and intelligence • e.g. remaining work, daily bug rates, overall quality, outcomes of automated building and testing • Document libraries and other data repositories for information sharing and communication between team members • Guidance on chosen development methodology
demo • Team Explorer client • Creating a Team Project • Assigning team members and setting permissions • Using Team Foundation source control • Project portal site • Team Foundation reports
Team Foundation and Group Working • TFS seems ideally suited to student group projects • Source control means they can adopt proper working practices and access source code from anywhere • Work item assignment ideally suited for assigning tasks to group members and management of group projects • Project portal and reports allow teaching staff to transparently monitor activity and progress on the project • Portal document libraries can be used for storage and assessment of project documentation (e.g. requirements, design diagrams, etc) • Ability to plug Web parts in to portal means it can be customised to any project process • Process template can be customised to specific group project processes, practices (and learning outcomes?)
Summary • In this presentation we have introduced the various versions of Visual Studio 2005 and have examined • Class Designer • Object Test Bench • Refactoring • Unit testing, static analysis and code coverage • Source control • Team Foundation Server
Reading and Resources Reading • Hundhausen, Working with Microsoft Visual Studio 2005 Team System, Microsoft Press, 2006