[Tutor] designing POOP
alan.gauld at btinternet.com
Sat Feb 9 10:09:14 CET 2008
"Tiger12506" <keridee at jayco.net> wrote
> Are some simple examples off the top of my head. It's not difficult
> to model
> real-life things with classes, but ...
This is a good point, it is excellent practice for thinking
about the responsibilities of objects
> ...it is much more difficult to model them
> in such a way that you interact with them normally.
And this is the bit that does require experience and careful thought.
But even thinking in the absract about doors, knobs,locks etc helps
to get the brain attuned to the kind of decions that need to be made
> door, or the knob? Does the knob contain a Lock, or does the
> developer only
> need to know that it has one and whether it is locked or not?)
And its important to remember that the answers will be problem
There is no absolute right or wrong, just what works best for your
Of course that's why building reusable objects is so hard.
Something apparently reusable will usually only be reusable
within a single problem domain. And even then may need to
be tweaked for the specific problem. It has been estimated
that building reusable objects costs between 3-5 times as
much as building a bespoke version (and commercially
reusable objects cost up to 10 times as much!)
More information about the Tutor