Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: OOP: objects and methods

Author: Anthony Cozzie

Date: 10:45:03 09/22/03

Go up one level in this thread


On September 22, 2003 at 13:27:54, Bo Persson wrote:

>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

You are going to have a hard time convincing me that

class a
{
public:
  foo1();
  foo2();
};

is better than:

struct a;

foo1(a*, ...);
foo2(a*, ...);

etc.

To me these are the same.  If you prefer the C++ syntax, that is of course your
option, of course.

anthony



This page took 0 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.