Introduction

Pro .NET Best Practices is a book that was primarily written for professional software developers who want to bring new and different .NET practices to their teams and organization. The phrase best practice is a handy way to describe widely-used practices and generally-accepted standards that many .NET developers in many organizations have found to be good and effective practices. Because best practices cannot work in every situation, the book encourages you to sort out what may or may not work well for your situation.

The adoption of new and different practices is a central theme of this book. Consider the four levels at which best practices are embraced:

  • Individual: You or any individual adopts better practices to increase personal and professional productivity, quality, thoroughness, and overall effectiveness.
  • Group: The team adopts better practices to be more industrious together, avoid problems, achieve desired results, improve interpersonal relationships, and work more effectively with other teams.
  • Organization: Your company, agency, or firm adopts better practices to bring more positive outcomes to the organization, attract and retain employees, satisfy end-user expectations, and make stakeholders happy.
  • Profession: Better practices are widely adopted and become generally-accepted standards, patterns, and principles that bring alignment to software development and benefit to all that follow them.

In an ideal world, best practices are quickly adopted at all four levels. However, this is not realistic for many of the reasons discussed in this book's early chapters. Pragmatists know that they usually cannot control all four levels within their current circumstances and can only influence a few. And so they work within their span of control and spheres of influence. As you read this book, think about adopting better practices within those areas you can control and positively shaping those areas that you do influence.

Pro .NET Best Practices is a practical reference on the best practices that you can apply to your .NET projects today. You will learn standards, techniques, and conventions that are realistic and helpful to achieving results. The book covers a broad range of practices and principles with an emphasis on tools and technologies for

  • Automated testing
  • Build automation
  • Continuous integration
  • Code analysis

To get warmed up, you can turn to the sample .NET best practices scorecard in Appendix B. If you take the time to score your current project, what might the score tell you about where things currently stand? Hopefully, completing the scorecard prompts these kinds of questions:

  • What are the best practices you want to see adopted? Why are they important to you? Do you foresee any obstacles or barriers?
  • What practice on the scorecard should you, your team, or your organization focus on first? Do you prioritize practices that offer greater efficiencies or help to prevent problems?
  • How would you revise the scorecard to make it fully apply to your current situation? What practices would you add to the list? What practices would you remove?
  • Once you have the scorecard that is right for you, how often would you reassess it? Is yearly too infrequent? Is weekly too intrusive and demotivating?

Adopting best practices is an initiative that is guided by having relevant objectives and a way to track progress. Put together the right scorecard, based on your situation. Track it regularly and use the overall score as a gauge that indicates and validates your continuous improvement.

If I find 10,000 ways something won't work, I haven't failed. I am not discouraged, because every wrong attempt discarded is another step forward.

Thomas Edison

The complex problems in life require iterative solutions. Edison knew that patience and perseverance are an inventor's competitive advantage. The same is true for best practices. It is better to take an iterative and incremental approach to adopting new and different practices. Be patient with it, stick to it, and have fun with it.

Who This Book Is For

This book is for anyone who has a stake in bringing better practices to software development.

Developers

As a developer, you have personal practices that make you an effective software developer. Are there new and different practices that could make you a more effective developer? This book offers realistic, practicable, and truly helpful best practices. The early chapters focus on the benefits, relevance, and purpose behind adopting best practices. The later chapters focus on technologies, tools, and techniques that bring greater effectiveness. The final chapter examines the influence of biases and aversions and how you can overcome these obstacles to adopting better practices.

Team Leaders

As a team leader, you see the team develop software through their current practices. Could the team perform better and achieve better outcomes with new and different practices? You can expect that this book will offer you pragmatic advice on how to implement suitable best practices likely to be followed by project members. You learn how to get best practices started and keep them from falling out of practice. You learn how to gain support for following best practices from all stakeholders by recognizing and overcoming biases, highlighting the gap between current results and desired results, and demonstrating the value of following best practices.

How This Book Is Structured

Pro .NET Best Practices presents the topics to provide reasonable breath and go into depth on key practices. For example, the chapter on code analysis looks at both static and dynamic analysis, and it goes into depth with FxCop and StyleCop. The goal is to strike the balance between covering all the topics, discussing the widely-used tools and technologies, and having a reasonable chapter length.

Chapters 1 through 5 are focused on the context of new and different practices. Since adopting better practices is an initiative, it is important to know what practices to prioritize and where to uncover better practices within your organization and current circumstances.

  • Chapter 1 shows how to choose new and different practices that are better practices for you, your team, and your organization.
  • Chapter 2 draws out ways to uncover better practices in the areas of .NET and general software development that provide an opportunity to discover or learn and apply better practices.
  • Chapter 3 presents practical advice on how to get team members to collaborate with each other and work toward a common purpose.
  • Chapter 4 describes specific practices to help with quantifying the value of adopting better development practices.
  • Chapter 5 provides you with practices to help you focus on strategy and the strategic implications of current practices.

Chapters 6 through 9 are focused on a developer's individual practices. These chapters discuss guidelines and conventions to follow, effective approaches, and tips and tricks that are worth knowing. The overarching theme is that each developer helps the whole team succeed by being a more effective developer.

  • Chapter 6 helps sort out the generalized statements, principles, practices, and procedures that best serve as.NET rules and regulations that support effective and innovative development.
  • Chapter 7 is an informal review of the C# language's power both to harness its own strengths and to recognize that effective development is a key part of following .NET practices.
  • Chapter 8 describes many specific practices to improve test code, consistent with the principles behind effective development and automated testing.
  • Chapter 9 discusses using build automation to remove error-prone steps, to establish repeatability and consistency, and to improve the build and deployment processes.

Chapters 10 through 12 are focused on supporting tools, products, and technologies. These chapters describe the purpose of various tool sets and present some recommendations on applications and products worth evaluating.

  • Chapter 10 presents the continuous integration lifecycle with a description of the steps involved within each of the processes. Through effective continuous integration practices, the project can save time, improve team effectiveness, and provide early detection of problems.
  • Chapter 11 provides an overview of many static and dynamic tools, technologies, and approaches with an emphasis on improvements that provide continuous, automated monitoring.
  • Chapter 12 is a comprehensive list of testing frameworks and tools with a blend of commercial and open-source alternatives.

The final chapter, Chapter 13, is about the aversions and biases that keep many individuals, teams, and organizations from adopting better practices. You may face someone's reluctance to accept or acknowledge a new or different practice as potentially better. You may struggle against another's tendency to hold a particular view of a new or different practice that undercuts and weakens its potential. Many people resist change even if it is for the better. This chapter helps you understand how aversions and biases impact change so that you can identify them, cope with them, and hopefully manage them.

Appendix A provides a list of resources organized by topic. Many of the resources are either referenced throughout the book or are good sources for further reading. Either way, once you are ready to tackle a .NET practice area, this appendix is a good way to delve into the details.

Appendix B provides a scorecard for you to use while evaluating and tracking best practices. As discussed earlier in the Introduction, this scorecard is a starting point for your ongoing initiative to bring better practices to .NET development.

Prerequisites

To follow along with the examples in this book, you need the following:

  • A good working knowledge of the .NET Framework 4.0 and the C# language
  • Microsoft Visual Studio 2010. Many examples in the text refer to features of the Professional, Premium, or Ultimate editions of Visual Studio 2010. A few code samples work with Visual Studio 2010 Express.
  • Many samples use Microsoft SQL Server Express, but other versions should work fine. Some use the database that comes with the MVC Music Store tutorial, available at mvcmusicstore.codeplex.com.
  • NUnit version 2.5.10 or later, available at nunit.org.
  • Moq version 4.0.0 or later, available at code.google.com/p/moq.
  • FxCop version 10.0 or later. I wrote a blog post that describes how to extract the FxCop 10.0 setup program from the icrosoft Windows SDK for Windows 7 and .NET Framework 4. With the FxCopSetup.exe file, you can run the installer on your development machine or build server. See http://ruthlesslyhelpful.net/2011/06/09/liberate-fxcop-10-0/.
  • StyleCop version 4.5.25 or later, available at stylecop.codeplex.com.

Many other tools and technologies are presented and discussed throughout the book. Information on obtaining those specific applications is provided at the time the topic is discussed.

Downloading the Code

This book includes source code that is available for download. The source code illustrates the practices described in the book. It is not production code. You can download the code at www.apress.com by searching for and going to the detail page of Pro .NET Best Practices. On the book's detail page is a link to the sample code compressed into a ZIP file. You can use a utility like 7-Zip (7-zip.org) or WinZip to uncompress the code.

For more detailed information, go to http://www.apress.com/source-code/.

Contacting the Author

Stephen can be reached through

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.171.153