Author: Russell Reagan
Date: 14:21:12 10/23/03
Go up one level in this thread
On October 23, 2003 at 16:49:40, Dan Andersson wrote: > Before you go all out on objects in C++ you might want to read this interview >with Bjarne Stroustrup. The C++ language creator. He has some quite interesting >design insights. He basically states that C++ is a multi-paradigm language. And >to use it in only one paradigm like OOP is not the way it was designed. And I >must add that it can seriously damage your programming skills, btw ;) >http://www.artima.com/intv/goldilocks.html In his interview he recommended to use classes to maintain invariants. Most things in a chess program have invariants. A color, a piece type, a square, a board (verifying board contents with piece lists or bitboards), a move (it's type flags should be valid, if you use those), and so on. I guess maybe a bitboard itself doesn't have an invariant. This leads me to believe that using classes for just about everything in a chess program is not such a bad idea, and properly placed asserts inside the classes can give you immediate notification when something goes wrong and save you a lot of debugging time. What do you think? Am I wrong here? I'm not really talking about OOP, just using classes to maintain the invariant, like Bjarne recommended.
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.