Interfaces and calling out the back Another thing that all software engineers
and many other kinds of engineers seem to agree about is the separation of interface and
implementation. Of course, thats closely related to encapsulation. I hope we all agee that
the data members of an object should be private. So the interface of the object is defined
by the methods it provides. Right? Well, up to a point.
Electrical engineers work with boxes. What comes out of the box is the interface. Whats
inside the box is the implementation. Heres a box. Is this its interface?
No, not quite. It has a back as well as a front, and heres the back. The interface consists of both the front, with the user controls, and the back, with all the wires going to the rest of the world.
How does this relate to objects? The public methods of an object are just the front view:
the user controls. The interface consists of the public methods provided to users and the
methods of other objects that the object calls. But in design we tend to ignore the back
and worry about the front only. UML encourages this, by the way.
Grogono gives credit to Brian Shearing for this "calls-out-the-back" problem. Peter went into more depth in his talk, but this idea alone is something which rocks my world.