Starlight-30036225 / ChessTCP

FILLMELATER
0 stars 0 forks source link

Using interfaces for more efficient call backs #36

Open Starlight-30036225 opened 5 months ago

Starlight-30036225 commented 5 months ago

Certain classes had messy two way dependencies that made debugging quite ugly. This could also lead to memory leaks.

To avoid this, when a class needed a reference to its owner, it would receive an implementation of an interface with the relevant functions. This has made development in these areas much easier.

For instance, the game client object is created by the player master class. The player master class implements the game handler interface, and passes a reference to this interface to the game client. Now the game client only has access to functions defined by the game Handler interface. This will enable me to swap out the player master class for an AImaster class later in development

This process has been repeated for the connection between board display and player master via the UIhandler interface