Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Is there an overhead in this OO design ?

Author: Alessandro Scotti

Date: 12:06:08 01/06/06

Go up one level in this thread


On January 06, 2006 at 12:28:00, Alexander Kure wrote:

>>>>>3) Instead of low-levely maipulating a square by means of operator+=() you could
>>>>>declare the following high-level functions in class CSquare:
>>>>>
>>>>>   void Up();
>>>>>   void Down();
>>>>>   void Left();
>>>>>   void Right();
>>>>>   void Next();
>>>>>   void Previous();

>Everything you say is correct but doesn't address the encapsulation issue. By
>making IsAdjacent() a member function actually _reduces_ encapsulation!
>
>I don't think a square should decide if it is adjacent to another square.
>Adjaceny is a concept that goes way beyond of the concept of a square and should
>therefore be handled somewhere else.

Hi Alex,
this makes sense but if so then also all of the above functions (up, down, etc.)
should be moved outside the class, leaving it pretty short of methods... :-)
Maybe it's just better to leave CSquare as int and move this stuff into a
CBoard.



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.