Is there a way to avoid circular dependencies, other than mixing modules, in a arrangement like this(it is a chess application)
Long description:
- There is the
Gui
module which imports aChessWidget
module; ChessWidget
just wraps theChessWorld
module and importsCellButton
;- The
CellButton
module imports the moduleCell
; - The
ChessWorld
module importsBoard
(to represent it) andPlayers
(to notify them and fetch their moves); - The
Board
module imports modulePiece
; - The
Piece
module imports modulePlayer
;
AND HERE IS THE PROBLEM:
The Player
module needs to know about other players and the board, thus importing ChessWorld
!
Short description:
The World
module needs to know about the Player
module (even indirectly by Board
/Piece
) and Player
need to know about World
.
Help is very appreciated.
PS: Is not because I cant use circular dependencies, but because they are evil.