Refactoring

Methods are at the center of a type’s operational behavior. They often acquire quite a bit of logic to carry out the task at hand. To tame this complexity, it’s essential to have a proper code structure where common tasks are factored out in utilities. By making each method carry out a well-described specialized task, it should become easier to compose and reuse bits and pieces of functionality. On a larger scale, object-oriented programming techniques (which are discussed in Chapter 14) are very useful to separate concerns.

Refactoring is the label applied to a set of techniques that involve continuous attention to keeping a program’s code readable, maintainable, and sound for ease of extensibility in the future. One way to achieve ...

Get C# 5.0 Unleashed 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.