Re: Programming to an Interface
- From: Patrick May <pjm@xxxxxxx>
- Date: Sat, 13 May 2006 12:05:45 +0100
"GoogleEyeJoe" <crgsmrt@xxxxxxxxxxx> writes:
That's fine. I understand that. What does confuse me however, is the
notion that programming to an interface reduces the likelihood that
changing an object's implementation will break existing code (code
created by the client of the object (that implements the interface).
Why is this...?
I don't understand your parenthetical, but the three main reasons
that programming to an interface is good practice are:
- Defining the interface encourages you to think in terms of the
behavior you need to provide rather than how to implement it.
- The implementation of the behaviors exposed by the interface
can be changed without impacting users of the interface. The
implementation selection can even be deferred until runtime.
- Users of the interface are less likely to become coupled to
implementation-specific details.
You are, of course, correct that changing a method signature in the
interface would require changes to the users of that interface.
Regards,
Patrick
------------------------------------------------------------------------
S P Engineering, Inc. | The experts in large scale distributed OO
| systems design and implementation.
pjm@xxxxxxx | (C++, Java, Common Lisp, Jini, CORBA, UML)
.
- Follow-Ups:
- Re: Programming to an Interface
- From: GoogleEyeJoe
- Re: Programming to an Interface
- References:
- Programming to an Interface
- From: GoogleEyeJoe
- Programming to an Interface
- Prev by Date: Programming to an Interface
- Next by Date: Re: Searching OO Associations with RDBMS Persistence Models
- Previous by thread: Programming to an Interface
- Next by thread: Re: Programming to an Interface
- Index(es):
Relevant Pages
|