Abstraction From Interface

last modified: September 27, 2009

[In part, this addresses some of MartinLippert's questions from RefactoringFrameworkBasedApplications.]

Forces:

Solution:

Particulars:

If you inherit from an excessively large interface, having a "split personality" of functionality, then ExtractClass each logical piece of functionality.

If you must work with an excessively complicated and robust interface that does much more than you need, build a simple adaptor for your use that hides the complexity of the full interface. (AdapterPattern) This is commonly an issue with database interfaces like ADO, DAO, RDO, ODBC and JDBC; each of these interfaces can and should be able to do much more than just the things you need to do for any particular application.

Results: This approach can very easily lead to a LayeredApplicationFramework, where you build custom framework(s) to meet your needs on top of existing frameworks that are somewhat resistant to change.


CategoryAbstraction


Loading...