Reply to Re: Classes, don't follow.

Your name:

Reply:


Posted by Dikkie Dik on 10/08/05 13:50

(I posted this also a few months ago in the XP yahoo group) When I
explain object-oriented programming, I usually draw the parallel
to electronic devices.

When I was young, I had a tape recorder dating from about 1965. It came
with a _huge_ electrical scheme that contained everything. You could
look at it for hours and still discover new parts of that same tape
recorder. For programmers, it looked a lot like an old BASIC program.

We don't build tape recorders like that anymore. Factories make not one
tape recorder, but a whole line of them. With different size, colour,
power, with an equalizer, with extra engine speed, etc.
If you open a modern tape recorder, you see that it is built up of
sub-assemblies that are plugged together. You can easily change the tone
control for an equalizer, or repair the left preamplifier by simply
replacing it for a new one.
These are, for me, objects. They are separately testable (with unit
tests), allow reuse (the line of tape recorders, but the preamplifier is
also used in an MP3-player) and have a small task.
A plug is the object's interface. Circumvening the plug (exposing
internal details or using global variables or singletons) is the same as
hard-wiring a point on one circuit board to another. You can even SEE it
is bad in electronics, because hard-wired objects are not separate
anymore, cannot be separately tested, etc.

Best regards

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация