Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: OOP: objects and methods

Author: Bo Persson

Date: 10:27:54 09/22/03

Go up one level in this thread


On September 22, 2003 at 12:54:26, Daniel Clausen wrote:

>On September 22, 2003 at 12:14:04, Robert Hyatt wrote:
>
>[snip]
>
>>The transposition table is a natural.  The opening book.  The endgame tables.
>>The repetition history.  The killer move list.
>
>While I agree with these suggestions for classes, I think such classes alone
>don't really make an engine OO.

That's a matter of opinion.

>What you basically mention so far is to replace
>"struct XYZ" with "class XYZ" and convert the functions which work with these
>structs closely (and typically take a pointer/reference to an object of XYZ) to
>member functions of the respective class.

Yes. A very good idea.

>
>If you do that, I'd call this a C++ engine but in the sense of a better C.

That's the general idea of C++ in the first place.

> I
>wouldn't call it an OO-engine though.

Ok, I would. :-)

>The design of the program is exactly the
>same.

No, it is totally different.

If you make the class' member variables protected, and collect the functions
acting on them inside the class, you have a much better abstraction.

>
>
>>The only thing to avoid is constantly creating and destroying things.  If you
>>avoid that, c++ is just as good as C.  Note that Eugene's endgame probe code
>>is written in c++ with _no_ speed penalty.
>
>I didn't read that code carefully (it's not that easy to read, to say it this
>way ;) but AFAIK I'd call that "better C", not OO.

Ok, so you are one of the "fundamentalists"? Dynamic allocations only and
everything virtual and polymorhic?

Some of us belive that using objects is object oriented. YMMV. :-)

>
>Sargon

Bo Persson




This page took 0.01 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.