Re: OOP Interfaces
- From: "C. (http://symcbean.blogspot.com/)" <colin.mckinnon@xxxxxxxxx>
- Date: Mon, 19 Jan 2009 04:54:39 -0800 (PST)
On 19 Jan, 05:52, 703designs <thomasmal...@xxxxxxxxx> wrote:
On Jan 18, 11:48 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:<snip>
Curtis Dyer wrote:
On Sun, 18 Jan 2009 15:27:15 -0500, jstuck...@xxxxxxxxxxxxx wrote:
I started reading on Interfaces and I understand HOW to use them, but I
am really foggy on WHY to use them.
<snip>What other benefits do Interfaces serve?
ScottyBasically, yes, Scotty. Interfaces are more important in strongly typed
languages such as java. They ensure that the implements the necessary
As you know, PHP is a lot less strongly typed. But interfaces are still
important, for the same reason.
Aside from this, it seems interfaces would also seem to shine in
teams of developers.
The same benefit goes for programmers who distribute libraries.
Very true. OTOH, if you have the design properly documented, then
anyone who doesn't implement according to the design gets to go back and
rewrite their code.
Interfaces do make it easier to enforce the design, however.
Interfaces are also the only way to get anything close to multiple
inheritance in PHP.
Eh? Actually there are ways of implementing multiple inheritance in
PHP (using classkit is probably the simplest) but I can't see what
interfaces (implied or explicit) have to do with it.
Can you enlighten me?