Chapter 13
Code Consistency Tools
WHAT’S IN THIS CHAPTER?
- 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 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 codebase can easily go from being well structured and organized to being a mess of variables, methods, and classes. This problem is amplified if the application is large and complex, and if it has multiple developers working on it concurrently.
In this chapter, you’ll learn about how you and your team can use features of Visual Studio 2012 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 codebase 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’ll learn about FxCop and StyleCop, which you can use 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.
SOURCE CONTROL
Many different ...
Get Professional Visual Studio 2012 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.