O'Reilly logo

Microsoft® Visual Studio® 2010 Unleashed by Lars Powers, Mike Snell

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

Extracting Interfaces

To better understand the Extract Interface operation, let’s look at an example. Suppose you review your code and notice that a number of your domain objects share similar properties and methods. Let’s say the objects Customer, Vendor, Manufacturer, SalesAgent, and Product all contain properties for Id, Name, and Description and methods for Save and Delete. In this case, you should consider extracting this commonality into a standard interface that each of your domain objects would implement. Let’s look at how the Extract Interface refactoring operation aids in this regard.

First, you position your cursor on the target class whose members you want to extract. In the example, choose the Vendor class. Invoking the Extract Interface ...

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