Free Sample
+ Collection
Code Files

Refactoring with Microsoft Visual Studio 2010

Peter Ritchie

This book is a superb practical guide for any developer considering refactoring their code with Visual Studio. Its accessible approach covers all aspects of updating your C# code base to make it maintainable and adaptable.
RRP $35.99
RRP $59.99
Print + eBook

Want this title & more?

$16.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781849680103
Paperback372 pages

About This Book

  • Make your code base maintainable with refactoring
  • Support new features more easily by making your system adaptable
  • Enhance your system with an improved object-oriented design and increased encapsulation and componentization
  • Concepts are presented in a comfortable one-on-one, pair-programming style
  • A practical approach that's packed with examples to enrich understanding

Who This Book Is For

This book is primarily for developers who want to refactor their code in Visual Studio. However, the book can be used by anyone using Visual Studio. Developers, designers, and architects who are eager to improve the performance of their craft will find this book useful because it details refactoring existing code to use recognized and established patterns and principles to improve code structure and architectural behavior.

The book assumes that the reader knows both Visual Studio and C#, but no previous knowledge of refactoring is required.

Table of Contents

Chapter 1: Introduction to Refactoring
What is refactoring?
Why the term refactoring?
Unit testing the second half of the equation
Simple refactoring
Technical debt
In the software development trenches
The option of rewriting
Working refactoring into the process
What to refactor
Refactoring in Visual Studio® 2010
Chapter 2: Improving Code Readability
Built-in Visual Studio® refactorings
The smell of code
Dead code
Intention-revealing design
You ain't gonna need it
KISS principle
Keeping track of code changes
Check-in often
Removing unused references
Chapter 3: Improving Code Maintainability
Code maintainability
Chapter 4: Improving Code Navigation
Navigating object-oriented code
Convention over Configuration
IDE navigation
Navigation with design patterns and principles
Chapter 5: Improving Design Correctness
Liskov substitution principle
Composition over inheritance
Object-oriented design and object behavior
Move initialization to declaration
Chapter 6: Improving Class Quality
Chapter 7: Refactoring to Loosely Coupled
What is loosely coupled?
Dependency Inversion principle
Inversion of Control
Dependency Injection
Working with IoC containers
Decorator pattern
Detecting highly-coupled
Types of coupling
Interface segregation principle
Drawbacks of loosely-coupled
Other methods of loose-coupling
Chapter 8: Refactoring to Layers
Model View Presenter (MVP)
Additional layers
Chapter 9: Improving Architectural Behavior
Behavioral patterns
Chapter 10: Improving Architectural Structure
Structural patterns
Object/Relational Mapping
Chapter 11: Ensuring Quality with Unit Testing
Change is not always good
Automated testing
Unit tests
Mocking frameworks
Unit testing existing legacy code
Unit testing in Visual Studio®
Test driven development
Unit testing frameworks
Automating unit-testing
Third party refactoring tools

What You Will Learn

  • Improve code readability by applying effective concepts and techniques
  • Spot discrepancies in code with code smells
  • Catch and eliminate dead code and learn several such smart methods
  • Make changes to your code without introducing adverse side-effects with code maintainability
  • Learn smart ways to improve code navigability
  • Improve your design by applying design principles and methodologies
  • Enhance the maintainability of your code base by refactoring it to be more cohesive and less coupled
  • Obtain an optimal level of flexibility by refactoring your code to a loosely-coupled design
  • Minimize the side effects and support changes to your code by refactoring to a layered architecture
  • Support your evolving code base by refactoring architectural behavior
  • Back up the refactoring effort by ensuring quality with Unit Testing

In Detail

Changes to design are an everyday task for many people involved in a software project. Refactoring recognizes this reality and systematizes the distinct process of modifying design and structure without affecting the external behavior of the system. As you consider the benefits of refactoring, you will need this complete guide to steer you through the process of refactoring your code for optimum results.

This book will show you how to make your code base more maintainable by detailing various refactorings. Visual Studio includes some basic refactorings that can be used independently or in conjunction to make complex refactorings easier and more approachable. This book will discuss large-scale code management, which typically calls for refactoring. To do this, we will use enterprise editions of Visual Studio, which incorporate features like Application Performance Explorer and Visual Studio Analyzer. These features make it simple to handle code and prove helpful for refactoring quickly.

This book introduces you to improving a software system's design through refactoring. It begins with simple refactoring and works its way through complex refactoring. You will learn how to change the design of your software system and how to prioritize refactorings—including how to use various Visual Studio features to focus and prioritize design changes. The book also covers how to ensure quality in the light of seemingly drastic changes to a software system. You will also be able to apply standard established principles and patterns as part of the refactoring effort with the help of this book. You will be able to support your evolving code base by refactoring architectural behavior. As an end result, you will have an adaptable system with improved code readability, maintainability, and navigability.


Read More