O'Reilly logo

Professional Test-Driven Development with C#: Developing Real World Applications with TDD by Jeff McWherter, James Bender

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3

A Quick Review of Refactoring

WHAT'S IN THIS CHAPTER?

  • Why Refactoring application code is important
  • How Clean Code principals such as OOP and SOLID help you build robust applications
  • How to identify and fix some of the most common design and coding mistakes in application development

No code is perfect. For developers, accepting this fact is very freeing. There will always be something you could have done better, although maybe you don't realize it at the time. Looking at code you've written in previous years, you may sometimes find small, subtle things you would like to change to make the code faster, more aligned with the business, or simply easier to maintain. Other times you may say, “If only I knew then what I know now, I would have done this completely different.”

Refactoring is the act of changing the internal implementation of a class or method with the aim of making the code more readable and maintainable. Refactoring also reduces the code's overall complexity without changing the external behavior of the class or method. These alterations can be as simple as changing the name of a method or variable to moving methods from one class to another or even splitting large classes into several smaller ones. Refactoring allows you to continuously change and improve your code.

This chapter explains why refactoring your code is important. It reviews object-oriented programming and the SOLID Principles. It also shows you some common coding and design problems, colloquially ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required