Re: How Not to Design a Dog.
- From: AndyW <a@xxxxxxxxxx>
- Date: Thu, 08 Mar 2007 12:25:06 +1300
On Wed, 07 Mar 2007 14:28:48 +1300, John Carter
<john.carter@xxxxxxxxxx> wrote:
On Tue, 06 Mar 2007 10:43:40 -0800, Diego wrote:
On Mar 5, 11:44 am, "Nick Keighley" <nick_keighley_nos...@xxxxxxxxxxx>
wrote:
"If you asked Marconi's for a cat they'd send you a dog with a mod
kit."
Royal Navy Petty Officer
I am sorry, but I could not figure out what the hell are you talking...
I take it you work for Marconi then? :-)
Ok, so here is the long version of what I said, but being long, isn't
nearly as funny.
I'm riffing off the standard english "Tail wags the Dog" illustration of
control gone wrong to illuminate how "Big Balls of Mud" in software arise.
The correct answer in designing a Dog, of course, is the tail merely needs
to send an "Ouch!" signal to primary control object (brain) and there
after The Right Thing happens.
However a common anti-pattern in software is to implement requirements
starting from input event, and since creating new software couplings are
"free", to access the control elements directly from the inputs. ie. In
software, the "Tail" module can trivially access the leg control module
and the "Tail" developer can get himself bogged down trying to write a
"make legs run" routine.
In hardware and Canines connections (wires / nerves) are expensive so
there is a natural conservatism about creating additional coupling. In
software it's just another #include and a name reference so developers
will often gratuitously create additional coupling, since the cost of
doing so is borne in maintenance not development.
The correct solution is given by the OOD concepts of Single Responsibility
/ Data Ownership / Law of Demeter / Tell Don't Ask.
So now you know the full story, and next time you see someone hugely
violating the Law of Demeter you can briefly and pungently say, "Your tail
is trying to teach the Dog to run."
lol. Sometimes getting the tail to wag the dog can be all the
customer wanted (although a bit daft imho).
Being an OO person (and an odd one at that), my solution is to climb
over the fence and look at my own grass from the other side.
One realises that all mammals use the same design based on a central
nervous system, are warm blooded, have a backbone etc.
So for the OO approach I would simply create a mammal with a central
nervous system that has a set of pain receptors (input controls) and
emotional response unit (output control). The Dog part is merely just
a custom wrapper (UI) for that solution where the tail is connected to
the output control.
So I guess, its really a mammal with a dog mod kit applied :)
Ask for a dolphin and you'd likely get the same solution but with the
dolphin mod kit.
----------------
AndyW,
Mercenary Software Developer
.
- References:
- How Not to Design a Dog.
- From: John Carter
- Re: How Not to Design a Dog.
- From: Nick Keighley
- Re: How Not to Design a Dog.
- From: Diego
- Re: How Not to Design a Dog.
- From: John Carter
- How Not to Design a Dog.
- Prev by Date: Re: Is Procedural Paradigm a basis of OO Paradigm?
- Next by Date: Re: Is Procedural Paradigm a basis of OO Paradigm?
- Previous by thread: Re: How Not to Design a Dog.
- Next by thread: Re: How Not to Design a Dog.
- Index(es):
Relevant Pages
|