Chapter 13. Code Consistency Tools


  • Working with source control

  • Creating, adding, and updating code in a source repository

  • Defining and enforcing code standards

  • Adding contracts to your code

If you are building a small application by yourself, it's very easy to understand how all the pieces fit together and to make changes to accommodate new or changed requirements. Unfortunately, even on such a small project the code base can easily go from being very well structured and organized to being a mess of variables, methods, and classes. This problem is amplified if the application is large, complex, and has multiple developers working on it concurrently.

In this chapter, you will learn about how you and your team can use features of Visual Studio 2010 to write and maintain consistent code. The first part of this chapter is dedicated to the use of source control to assist you in tracking changes to your code base over time. Use of source control facilitates sharing of code and changes among a team but more importantly gives you a history of changes made to an application over time.

In the remainder of the chapter you will learn about FxCop and StyleCop, which can be used to set up and enforce coding standards. Adhering to a set of standards and guidelines ensures the code you write will be easier to understand, leading to fewer issues and shorter development times. You'll also see how you can use Code Contracts to write higher quality code.


Many different ...

Get Professional Visual Studio® 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.