2006-05-23

Kono: Refactoring

If I ever compile these posts, I will include my old code so programmers can have something to point to and snicker.

1) The first part that gets changed is to place every function that reflects / models / or is based on a rule of the game into the Rules class.

2) Hide as much as possible. While the signels enumerated constants need to remain exposed, there are others that do not. The size of the board (CBoard::DX) is one.

3) Even if copying data in two classes is faster, don't. Better to 'waste' computer cycles in function calls that to miss synchronizing the data and causing odd results. (The exapmle here is the COwner::Player ownership array in the CGame class.)

4) Right now the only other bit that I can see is to minimize the amount of data that goes into the Undo and the MoveGenerator classes. (Note: Optimize was not mentioned.)

No comments: