O'Reilly logo

Professional Enterprise .NET by Scott Millett, Jon Arking

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

Chapter 3. Emancipate Your Classes

How many times have you been asked to modify a piece of existing code only to find that a small change has a rippling effect throughout the entire application, preventing it from compiling or worse still, introducing a bug that has a horrible knack of only surfacing just after you go live? What should have been a minor adjustment ends up becoming a massive task simply because your small change had an implicit effect on other portions of your code.

The problem is that software, for one reason or another, often requires changes. It's important for your code to be resilient, flexible, and adaptable, ultimately making your software more maintainable. Designing for maintainability is one of the most important goals when creating software. Maintenance is not just an important facet in making your job easier; it also makes the job of the next programmer easier when he or she takes over. By thinking about the future and how your code may evolve, you will be able to design applications in a way that makes them flexible and allows for easy modification as and when the business changes.

The biggest resisters to change are dependencies — classes that are dependent on other classes in your system. Dependencies can be found in all areas of code — high-level classes might be dependent on low-level classes, and vice-versa. If one portion of your code changes, other portions are required to change as well. In this chapter, you will learn what a dependency is, and ...

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