|
Prev: Funny Videos
Next: Wow
From: John Carter on 4 Mar 2007 23:04 So the Dog has been built and a new requirement comes in... If you stand on the dogs tail, it must yelp and scrabble away. So what does Joe Average Coder do? Open up the Tail.cpp, #include "AudioOutput.hpp" wire Dog to Yelp when the tail has been stood on. He then #include's "LegControl.hpp" and begins to try to work out how the Tail can get the Dog to run... -- John Carter
From: Phlip on 4 Mar 2007 23:37 John Carter wrote: > So the Dog has been built and a new requirement comes in... > > If you stand on the dogs tail, it must yelp and scrabble away. > > So what does Joe Average Coder do? > > Open up the Tail.cpp, #include "AudioOutput.hpp" > wire Dog to Yelp when the tail has been stood on. > > He then #include's "LegControl.hpp" and begins to try to work out how the > Tail can get the Dog to run... That sounds like Peter Merel's "ExtremeHour" game. -- Phlip http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
From: Nick Keighley on 5 Mar 2007 09:44 John Carter wrote: > So the Dog has been built and a new requirement comes in... > > If you stand on the dogs tail, it must yelp and scrabble away. > > So what does Joe Average Coder do? > > Open up the Tail.cpp, #include "AudioOutput.hpp" > wire Dog to Yelp when the tail has been stood on. > > He then #include's "LegControl.hpp" and begins to try to work out how the > Tail can get the Dog to run... -- "If you asked Marconi's for a cat they'd send you a dog with a mod kit." Royal Navy Petty Officer
From: Diego on 6 Mar 2007 13:43 On Mar 5, 11:44 am, "Nick Keighley" <nick_keighley_nos...(a)hotmail.com> wrote: > John Carter wrote: > > So the Dog has been built and a new requirement comes in... > > > If you stand on the dogs tail, it must yelp and scrabble away. > > > So what does Joe Average Coder do? > > > Open up the Tail.cpp, #include "AudioOutput.hpp" > > wire Dog to Yelp when the tail has been stood on. > > > He then #include's "LegControl.hpp" and begins to try to work out how the > > Tail can get the Dog to run... > > -- > "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... Diego HP
From: John Carter on 6 Mar 2007 20:28
On Tue, 06 Mar 2007 10:43:40 -0800, Diego wrote: > On Mar 5, 11:44 am, "Nick Keighley" <nick_keighley_nos...(a)hotmail.com> > 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." -- John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter(a)tait.co.nz New Zealand |