From: Gerry Quinn on
In article <1118445066.277822.299790(a)f14g2000cwb.googlegroups.com>,
topmind(a)technologist.com says...
> Well, actually there are a lot of shape conundrems floating around,
> such as the square-isa-rectangle classification problem. I was just
> trying to mentally move people beyond the common textbook examples and
> didn't mean to formally endorse shapes. -t-

Another good example of a bad example is Chess, where Knight, Bishop
etc. inherit from Piece. (I ignore situations where the pieces have
animated battle graphics, which is best handled separately from the
game engine anyway.)

A Piece class or possibly just a Piece enum belonging to a Board class
is superior in several ways:

1. Far more efficient code in practice

2. Chess pieces really are properties of a chessboard rather than
things in themselves. A piece is meaningless without a board.

Example:
bool King::CanCastle( bool kingside )
{
// Am I in check?
// Have I moved?
// Has the Rook in question moved?
// Do any pieces block the intervening squares?
// Do any opposing pieces attack the intervening squares?
}
Could be a long old function to write based on interrogating other
pieces...

3. Chess piece properties belong to the rules of a chess game. For
grandmaster level play you'd hardcode a lot of stuff (and use other
tricks) but for an ordinary chess program, why not leave open the
option of easily changing the rules?


- Gerry Quinn






From: Daniel Parker on
"topmind" <topmind(a)technologist.com> wrote in message
news:1118431499.490767.127720(a)g47g2000cwa.googlegroups.com...
> Daniel keeps insulting me
>
Not intentionally, I'm trying to do something else. To inspire you, through
words alone, to up your game: to move beyond "telling", and into "showing."

Regards,
Daniel Parker

It ain't what you don't know that gets you into trouble. It's what you know
for sure that just ain't so.
Mark Twain



From: Robert C. Martin on
On Fri, 10 Jun 2005 18:57:21 -0400, CTips <ctips(a)bestweb.net> wrote:

>topmind wrote:
><snip>
> > OO is good for .... shapes.
>>
>
>Not really. Anytime someone comes up with the shapes example, ask them
>how they would add the method:
>
>class shape {
>// true if object has any points in common with <B>
>boolean intersects(shape B);
>}
>
>See how quickly mind-lock sets in....

That one is not so hard. Simply algebra can solve it without too much
difficulty (I've done it). The tougher one is:

Shape intersection(Shape s);

That requires a generic shape that can represent any shape at all.




-----
Robert C. Martin (Uncle Bob) | email: unclebob(a)objectmentor.com
Object Mentor Inc. | blog: www.butunclebob.com
The Agile Transition Experts | web: www.objectmentor.com
800-338-6716


"The aim of science is not to open the door to infinite wisdom,
but to set a limit to infinite error."
-- Bertolt Brecht, Life of Galileo
From: CTips on
Jeff Brooks wrote:

> CTips wrote:
>
>> zing!
>> :)
>>
>> But its a bit of a waste of effort. Once he made the preposterous
>> claim that any curve can be approximated with a combination of simpler
>> curves, it was already clear that he doesn't understand the field. I
>> tried to demonstrate the fallacy using a reductio-ad-absrudum
>> argument, but it seems that he's never been exposed to power-series
>> and transforms of any form, and the argument escaped him.
>
>
> Lol.
>
> If you understood the field you would know that even a series of lines
> can approximate a curve. A series of points can approximate a line, etc.

yes - it can APPROXIMATE a curve. And using an approximation means that
you can (and will) get the wrong answer when the approximation isn't
good enough.

> A good example of this is your monitor. A monitor can't draw lines it
> can only draw small squares called pixels. Using a series of these
> pixels a line can be approximated, so can a curve, etc.
>
> Your original argument didn't prove anything. Finding a curve that won't
> work doesn't prove that there isn't a type of curve that does work. I
> suggest you study up on logic so in the future your "logical" arguments
> don't work against you.

Umm...it just means that there is finite set of curves that can be
finitely combined to model another curve. Either you need an infinite
basis set or you need to use an infinite number of elements

> Power-series, and transforms have nothing to do with your original
> challenge. Bringing them up has no impact on the fact that I succeed at
> your challenge.

<shrug>
From: Jeff Brooks on
CTips wrote:

> Jeff Brooks wrote:
>
>> CTips wrote:
>>
>>> zing!
>>> :)
>>>
>>> But its a bit of a waste of effort. Once he made the preposterous
>>> claim that any curve can be approximated with a combination of
>>> simpler curves, it was already clear that he doesn't understand the
>>> field. I tried to demonstrate the fallacy using a
>>> reductio-ad-absrudum argument, but it seems that he's never been
>>> exposed to power-series and transforms of any form, and the argument
>>> escaped him.
>>
>> Lol.
>>
>> If you understood the field you would know that even a series of lines
>> can approximate a curve. A series of points can approximate a line, etc.
>
> yes - it can APPROXIMATE a curve. And using an approximation means that
> you can (and will) get the wrong answer when the approximation isn't
> good enough.

"he made the preposterous claim that any curve can be approximated with
a combination of simpler curves"
- you

"yes - it can APPROXIMATE a curve"
- you

Preposterous! ;-)

Jeff Brooks
First  |  Prev  |  Next  |  Last
Pages: 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Next: Use Case Point Estimation