Refactoring with Microsoft Visual Studio 2010

Refactoring with Microsoft Visual Studio 2010
eBook: $35.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $95.98    Print cover: $59.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • 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

Book Details

Language : English
Paperback : 372 pages [ 235mm x 191mm ]
Release Date : July 2010
ISBN : 1849680108
ISBN 13 : 9781849680103
Author(s) : Peter Ritchie
Topics and Technologies : All Books, Application Development, Microsoft Development , Enterprise, Microsoft

Table of Contents

Chapter 1: Introduction to Refactoring
Chapter 2: Improving Code Readability
Chapter 3: Improving Code Maintainability
Chapter 4: Improving Code Navigation
Chapter 5: Improving Design Correctness
Chapter 6: Improving Class Quality
Chapter 7: Refactoring to Loosely Coupled
Chapter 8: Refactoring to Layers
Chapter 9: Improving Architectural Behavior
Chapter 10: Improving Architectural Structure
Chapter 11: Ensuring Quality with Unit Testing
  • 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 to patterns
      • Refactoring to principles
      • Code smells
      • Complexity
      • Performance
      • Kernel
      • Design methodologies
      • Unused and highly-used code
    • Refactoring in Visual Studio® 2010
      • Static code analysis
      • Code metrics
    • Summary
  • Chapter 2: Improving Code Readability
    • Built-in Visual Studio® refactorings
      • Rename identifier refactoring
        • Rename field
        • Rename property
        • Rename method
        • Rename local variable
        • Rename class
      • Extract Method refactoring
      • Encapsulate Field refactoring
    • The smell of code
      • Duplicate code smell
        • Duplicate code in a class
        • Duplicate code in multiple classes
        • Duplicate code in construction
        • Advanced duplicate code refactoring
      • Long method smell
      • Code comments smell
    • Dead code
    • Intention-revealing design
    • You ain't gonna need it
    • KISS principle
    • Keeping track of code changes
    • Check-in often
    • Removing unused references
    • Summary
  • Chapter 3: Improving Code Maintainability
    • Code maintainability
      • Automated unit testing
      • Feature Envy code smell
      • Design for the sake of reuse
      • Don't repeat yourself
      • Inappropriate Intimacy code smell
      • Lazy Class code smell
      • Improved object-model usability
      • Contrived Complexity
      • Detecting maintainability issues
    • Summary
  • Chapter 4: Improving Code Navigation
    • Navigating object-oriented code
    • Convention over Configuration
      • Consistency
      • Conventions
        • Naming
      • Scoping types with namespaces
    • IDE navigation
      • Search
      • Class View
      • Solution Explorer
      • Class Diagram
      • Code Editor
    • Navigation with design patterns and principles
    • Summary
  • Chapter 5: Improving Design Correctness
    • Liskov substitution principle
      • Convert to Sibling refactoring
      • Refactoring to single class
    • Composition over inheritance
      • Refactoring virtual methods to events
      • Exceptions to preferring composition
      • Replace inheritance with delegation refactoring
    • Object-oriented design and object behavior
      • Refactoring to improved object-orientation
    • Move initialization to declaration
      • Value types
      • Refactoring to value type
      • Modeling business rules appropriately
    • Summary
  • Chapter 6: Improving Class Quality
    • Cohesion
      • Class cohesion
        • The Single Responsibility Principle
        • Refactoring classes with low-cohesion
        • Detecting classes with low-cohesion
      • Method cohesion
        • Refactoring methods with low-cohesion
      • Namespace cohesion
        • Refactoring namespaces with low-cohesion
      • Assembly cohesion
        • Refactoring assemblies
    • Coupling
      • Refactoring subclass coupling
      • Refactoring content coupling
        • Interface-based design
        • Delegates
        • Events
      • Refactoring external coupling
      • Dependency cycles
      • Proper dependency design
    • Summary
  • Chapter 7: Refactoring to Loosely Coupled
    • What is loosely coupled?
      • What are coupling and dependencies?
        • Tightly-coupled
    • Dependency Inversion principle
    • Inversion of Control
    • Dependency Injection
    • Working with IoC containers
      • Tightly coupled to creation
      • Factory Pattern
      • Abstract Factory
    • Decorator pattern
    • Detecting highly-coupled
    • Types of coupling
      • Afferent coupling
      • Efferent coupling
    • Interface segregation principle
    • Drawbacks of loosely-coupled
    • Other methods of loose-coupling
      • Web services
      • Communication hosts
    • Summary
  • Chapter 8: Refactoring to Layers
    • Layers
      • Business logic and domain layers
      • Data Access Layers
        • Refactoring UI data access to Data Access Layer
        • Refactoring domain data access to Data Access Layer
      • Plain Old CLR Objects
      • User interface layers
    • Model View Presenter (MVP)
    • Additional layers
    • Summary
  • Chapter 9: Improving Architectural Behavior
    • Behavioral patterns
      • Don't Repeat Yourself (DRY)
      • Strategy pattern
      • Detecting need for strategy pattern
      • Refactoring to strategy pattern
      • Specification pattern
      • Detecting need for specification pattern
      • Refactoring to specification pattern
      • Publish/Subscribe paradigm
      • Observer pattern
      • Detecting the need for the observer pattern
      • Refactoring to the observer pattern
    • Summary
  • Chapter 10: Improving Architectural Structure
    • Structural patterns
      • Legacy code
      • Adapter pattern
        • Detecting need for the adapter pattern
        • Refactoring to the adapter pattern
      • Façade pattern
        • Detecting the need for façade
        • Refactoring to the façade pattern
      • Proxy pattern
        • Detecting need for proxy
        • Refactoring to proxy
    • Object/Relational Mapping
      • Problems with code generation
      • Detecting need to refactor to ORM
      • Refactoring to ORM
        • ORM sessions
    • Summary
  • Chapter 11: Ensuring Quality with Unit Testing
    • Change is not always good
    • Automated testing
    • Unit tests
      • Other testing
      • Mocking
      • Priorities
      • Code coverage
    • Mocking frameworks
      • Rhino Mocks
      • Moq
    • Unit testing existing legacy code
      • TypeMock isolator
    • Unit testing in Visual Studio®
    • Test driven development
    • Unit testing frameworks
      • NUnit
      • XUnit
    • Automating unit-testing
      • Continuous Integration
    • Third party refactoring tools
      • Resharper
      • Refactor! Pro
    • Summary

Peter Ritchie

Peter Ritchie is a software development consultant. Peter is president of Peter Ritchie Inc. Software Consulting Co., a software consulting company in Canada's National Capital Region specializing in Windows-based software development management, process, and implementation consulting. Peter has worked with such clients as Mitel, Nortel, Passport Canada, and Innvapost from mentoring to architecture to implementation. Peter has considerable experience building software development teams and working with startups towards agile software development. Peter's range of experience ranges from designing and implementing simple standalone applications to architecting distributed n-tier applications spanning dozens of computers; from C++ to C#. Peter is active in the software development community attending and speaking at various events as well as authoring various works including Refactoring with Microsoft Visual Studio 2010.
Sorry, we don't have any reviews for this title yet.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Refactoring with Microsoft Visual Studio 2010 +    WS-BPEL 2.0 for SOA Composite Applications with Oracle SOA Suite 11g =
50% Off
the second eBook
Price for both: £34.45

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • 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.

Refactor Visual Studio solutions to make them more maintainable


This book focuses on real-world, easy-to-understand examples of code in a one-on-one style. Refactoring examples are performed and reasons why this refactoring should be applied are detailed. The book is structured from less advanced topics to more advanced topics; but is designed so that reading from beginning to end is not necessary.

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.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software