Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dangers of Object-oriented coding...

0 views
Skip to first unread message

Brian Moelk

unread,
Oct 3, 2002, 9:03:29 AM10/3/02
to
Not to spoil the fun, but this shows that although inheritence is a powerful
form of reuse, those that do not fully understand the Liskov substitution
principle can get into trouble.

--
Brian Moelk
bmoe...@SPAMbrainendeavorFOR.MEcom
http://www.brainendeavor.com


Tony Benci

unread,
Oct 3, 2002, 9:05:48 AM10/3/02
to
Should have seen what one of those buggars did to the front of my car.

I have no difficulty believing they could take out a blackhawk.

Glynn Owen

unread,
Oct 3, 2002, 10:24:07 AM10/3/02
to
Brian Moelk wrote:
> Not to spoil the fun, but this shows that although inheritence is a powerful
> form of reuse, those that do not fully understand the Liskov substitution
> principle can get into trouble.
>

I'll bite. What is it?
Glynn

Ianier Munoz

unread,
Oct 3, 2002, 10:13:41 AM10/3/02
to
IMO this is more an example of a bad OO design.
Ianier


Tony Benci

unread,
Oct 3, 2002, 11:04:41 AM10/3/02
to
Ianier,

Mate, this article is from an Aussie source. I wonder whether it is meant to
be taken that seriously. Smacks of the typical Aussie practical joke.

When I was at Uni, one of the law undergraduates impersonated a visiting
High Court Judge and spent the afternoon lecturing the school on a number of
contentious and thought provoking legal concepts.

Took them weeks to realise that is was a sham. (Think the bloke is now a
Queens Council for what its worth).

LOL, the thought of Kangaroos with full of ground to air kit hiding behind a
hill is just too much of the same thing.

Regards
Tony


JQP

unread,
Oct 3, 2002, 11:37:56 AM10/3/02
to
"Tony Benci" <tbe...@bigpond.net.au> wrote in message
news:3d9c...@newsgroups.borland.com...

> Should have seen what one of those buggars did to the front of my car.
>
> I have no difficulty believing they could take out a blackhawk.

Just be thankful that they don't have hooves,

Friend of mine hit a deer. It came over the hood (bonnet?) and part way
through the windshield (screen?), kicked him and broke his jaw.


DRS

unread,
Oct 3, 2002, 1:02:35 PM10/3/02
to
"Andrew Gabb" <ag...@tpgi.com.au> wrote in message
news:3D9C1A0F...@tpgi.com.au...
> Yep, mostly urban legend but with some basis in truth.
>
> More on this one at
> http://www.sie.arizona.edu/sysengr/OOSE/kangaroo.html including the
> following (from myself - as an ex-DSTO employee I was asked by a
> Yank if there was any truth in it, and happened to know a couple of
> those involved):

I thought this was even funnier than the Stingers:

"What I didn't relate in the talk is that since we were not at that stage
interested in weapons, we had not set any weapon or projectile types, so
what the kangaroos fired at us was in fact the default object for the
simulation, which happened to be large multicoloured beachballs."

--

Quidquid latine dictum sit, altum videtur.


Chuck Hutchings

unread,
Oct 3, 2002, 1:21:46 PM10/3/02
to
Glynn,

http://www.brent.worden.org/tips/2000/liskovSubstitutionPrinciple.html

In summary:

The formal stating of the principle is

If for each object o1 of type S there is an object o2 of type T such
that for all programs P defined in terms of T, the behavior of P is
unchanged when o1 is substituted for o2 then S is a subtype of T.

Or stated more simply, modules that use references to base types must be
able to use references to derived types without knowing the difference.


John Kaster (Borland)

unread,
Oct 3, 2002, 2:44:47 PM10/3/02
to
JQP wrote:
> Friend of mine hit a deer. It came over the hood (bonnet?) and part way
> through the windshield (screen?), kicked him and broke his jaw.

In the US, people have been killed by deer's legs kicking after the deer is
flipped into the windshield and is trying to get away. Anything that powerful
is dangerous when in pain and trying to get away.

--
John Kaster, Borland Developer Relations, http://bdn.borland.com
$1280/$50K: Thanks to my donors!
http://homepages.borland.com/jkaster/tnt/thanks.html
Make a wish! http://qc.borland.com * Got source?
http://codecentral.borland.com
See you at BorCon 2002 Japan? http://www.borland.co.jp

Glynn Owen

unread,
Oct 3, 2002, 3:46:46 PM10/3/02
to

Thanks for the reference. In it, I found this reference -

http://www.objectmentor.com/resources/articles/lsp.pdf

which is an even more thorough discussion of the subject.

Regards, Glynn

Chuck Hutchings

unread,
Oct 3, 2002, 3:52:39 PM10/3/02
to

"John Kaster (Borland)" <jka...@borland.com> wrote in message
news:3D9C901F...@borland.com...
> JQP wrote:
<SNIP >

>Anything that powerful
> is dangerous when in pain and trying to get away.

Sounds like some of my old college roommate's dates! <g>

Chuck


Plaster O'Paris

unread,
Oct 3, 2002, 4:04:07 PM10/3/02
to
"Marc Rohloff" <marc rohloff at bigfoot dot com> wrote in message
news:MPG.18066a5e3...@newsgroups.borland.com...
>
> And then you call yourself 'plaster o'paris'. You sound rather error
> prone to me <g>
>

Only when it comes to my ankles and fingers, of which I've broken 6 over the
years (all while engaging in sports: basketball, volleyball, and baseball).
The odd thing is I never broke anything playing football - and I've played a
lot of football, albeit mostly at quarterback.


Marc Rohloff

unread,
Oct 3, 2002, 3:53:54 PM10/3/02
to

> *I've hit several, and my worst injury was some glass cuts on my hand.

And then you call yourself 'plaster o'paris'. You sound rather error
prone to me <g>

Marc

Plaster O'Paris

unread,
Oct 3, 2002, 4:05:15 PM10/3/02
to
"Chuck Hutchings" <chutc...@ashvinsgroup.com> wrote in message
news:3d9c9f94$1...@newsgroups.borland.com...

>
> Sounds like some of my old college roommate's dates! <g>
>

Najeh Davenport was your college roommate?

<g,d,&r>


Marc Rohloff

unread,
Oct 3, 2002, 4:41:45 PM10/3/02
to

> Only when it comes to my ankles and fingers, of which I've broken 6 over the
> years (all while engaging in sports: basketball, volleyball, and baseball).
> The odd thing is I never broke anything playing football - and I've played a
> lot of football, albeit mostly at quarterback.
So is this where you got your name from (and whi is Warble McGorkle)?

Gavin Horne

unread,
Oct 3, 2002, 5:12:45 PM10/3/02
to
ROTFLMAO.

Of course anyone who's remebers the old Hoges (Paul Hogan) shows would be
well aware the Skippy can & does shoot a rifles, dangerous buggers those
roos :)))

Gavin ,
www.fleetsafe.au.com


"Richard Grossman" <usenetuserDE...@techIII.com> wrote in message
news:3d9bfb6a$1...@newsgroups.borland.com...
> This may be apocrophyal but I enjoyed it - hope you do...
>
> [Allegedly...]
> From June 15, 2002 Defense Science and Technology Organization Lecture
> Series, Melbourne, Australia, and staff reports
> -----------------------------
> The reuse of some object-oriented code has caused tactical headaches
> for Australia's armed forces. As virtual reality simulators assume
> larger roles in helicopter combat training, programmers have gone to
> great lengths to increase the realism of their scenarios, including
> detailed landscapes and, in the case of the Northern Territory's
> Operation Phoenix, herds of kangaroos (since disturbed animals might
> well give away a helicopter's position).
>
> The head of the Defense Science & Technology Organization's Land
> Operations/Simulation division reportedly instructed developers to
> model the local marsupials' movements and reactions to helicopters.
>
> Being efficient programmers, they just re-appropriated some code
> originally used to model infantry detachment reactions under the same
> stimuli, changed the mapped icon from a soldier to a kangaroo, and
> increased the figures' speed of movement.
>
> Eager to demonstrate their flying skills for some visiting American
> pilots, the hotshot Aussies "buzzed" the virtual kangaroos in low
> flight during a simulation. The kangaroos scattered, as predicted, and
> the visiting Americans nodded appreciatively... then did a double-take
> as the kangaroos reappeared from behind a hill and launched a barrage
> of Stinger missiles at the hapless helicopter. (Apparently the
> programmers had forgotten to remove that part of the infantry coding.)
>
> The lesson? Objects are defined with certain attributes, and any new
> object defined in terms of an old one inherits all the attributes. The
> embarrassed programmers had learned to be careful when reusing
> object-oriented code, and the Yanks left with a newfound respect for
> Australian wildlife.
>
> Simulator supervisors report that pilots from that point onward have
> strictly avoided kangaroos, just as they were meant to.
>


Brian Moelk

unread,
Oct 3, 2002, 9:44:15 PM10/3/02
to

In addition to the references provided the practical concept is that the
traditional "IS-A" relationship that is taught in OO is not accurate. A
better guideline is substitutability. Paraphrasing Bertrand Meyer a bit: A
derived class should require no more and promise no less than its ancestor.

To see where IS-A breaks down think about a square and a rectangle class. A
square IS-A rectangle, but since it has additional constraints (i.e.
requires more) you can't substitute a square for a rectangle.

But relating to Kangaroo's and infantry men, IS-A doesn't work either; so I
admit to being somewhat pedantic.

Mike Ryan

unread,
Oct 6, 2002, 3:11:31 AM10/6/02
to
Having grown up with them, I can attest that the Looney Tunes cartoons of
the cute roo kicking the crap out of you is all true! :-)

Many a time I limped home from a walkabout sporting a bruise or two from a
run-in with a boomer.

Those were fantastic times!

MR.


"Don" <ozde...@yahoo.com> wrote in message
news:3D9C3CA7...@yahoo.com...


> Andrew Gabb wrote:
> > Yep, mostly urban legend but with some basis in truth.
>

> You've obviously never been in close contact with a 'roo then. <g>
>
> Don
>


0 new messages