voidtwerp wrote:
Polymorphism is being able to plug more than one kind of electrical
appliance into a wall socket.
Socks
I mean - heh - thats more like the kinda response i was expecting -
dang google groups
You can go a long way with house wiring as a metaphor for OO design.
Polymorphism we just covered.
Information hiding is pretty easy as well. The wires that bring the
power
to the socket are hidden. So are details like breaker switches, the
step down transformer from the area grid, the bigger transformers
from the regional grid, or what power station exactly produced the
power. Yet you can still plug in your appliances and have them work.
And you can't do gnarly things like following back the wire from the
socket and soldering a lamp to the middle of the wire, or patching
around the breaker. At least, not without a lot of work.
Encapsulation is not so easy. It's not easy to pick up a wall socket
and take it someplace else. So it's tough to draw the boundary
that "the wall socket and it's stuff" fits inside. You can *sort of*
get it from an extension cord.
Abstract type is there but it's quite limited. There are not very many
types of wall socket. 110 and 220, maybe N. American and
European, but that's about as far as it goes. It's hard to get a
new kind of wall socket accepted.
I seem to be forgetting one (or a couple) but I'm forgetting them.
Socks