Author: Robert Hyatt
Date: 10:23:41 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. 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. > >If you do that, I'd call this a C++ engine but in the sense of a better C. I >wouldn't call it an OO-engine though. The design of the program is exactly the >same. > > >>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. > >Sargon Just remember, the main distinction for OO programming is _not_ creating and destroying lots of objects. It is all about the classes and how they can be inherited (re=used) by other applications later on. OO came straight from software engineering and the principle of code reuse. When you encapsulate an object with its methods, you are there. Whether you do one create or one zillion. The point is to make everything "black box" to the outside world so that nothing depends on how something is accomplished, just on the fact that it is accomplished. Then that code can be used by any software that requires a similar "object". I think you (and others) confuse the real purpose of OO programming with the idea of creating and destroying lots of instances of an object. Nothing in OO programming says that has to be done. A single instance of an object is often more than enough.
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.