note 102676 deleted from language.oop5.interfaces by danbrown

[email protected] Mon, 28 Feb 2011 06:34:59 -0800
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: anonymous 

----

@jballard at natoga dot com, actually, programming interfaces are very much like computer peripheral interfaces. Hence the reason they are called interfaces. I agree that you wouldn't use an object interface in the sense of OO programming to connect to a peripheral, but to say that they are not at all alike is incorrect. In fact they use the exact same concept.

To clarify for others who may be confused, object interfaces are used to define the methods an object MUST have for the purposes of interfacing to another object. Generally an object interface is used when another class will most definitely call the methods defined by the interface. In this example, if the implementing object did not implement the interface (and for aguments sake php did not throw an error) then the software wouldn't work together.

Peripheral interfaces define a set of functions which are normally the functions the peripheral can/will perform. In certain circumstances a peripheral may require the software to perform a certain function(s) to operate correctly. This is the essence of an interface. It defines how two things work together to do something. Both software and peripheral interfaces operate within this definition.