0
0
LLDsystem_design~12 mins

Board and piece hierarchy in LLD - Architecture Diagram

Choose your learning style9 modes available
System Overview - Board and piece hierarchy

This system models a board game structure with a hierarchy of boards and pieces. It manages different types of pieces placed on a board, supporting operations like moving pieces and checking their positions. The design ensures clear separation between the board and piece responsibilities for easy extension and maintenance.

Architecture Diagram
  +------------+          +-------------+          +-------------+
  |   Client   |  ----->  |   Board     |  ----->  |   Piece     |
  +------------+          +-------------+          +-------------+
                              |  ^                      |
                              |  |                      |
                              v  |                      v
                         +-------------+          +-------------+
                         | BoardCell   |          | PieceType   |
                         +-------------+          +-------------+
Components
Client
user_interface
Interacts with the board system to perform moves and queries
Board
service
Manages the grid of cells and pieces on the board
BoardCell
data_structure
Represents a single cell on the board that can hold a piece
Piece
entity
Represents a game piece with position and type
PieceType
entity
Defines the characteristics and rules of a piece kind
Request Flow - 6 Hops
ClientBoard
BoardBoardCell
BoardPiece
PiecePieceType
BoardBoardCell
BoardClient
Failure Scenario
Component Fails:Board
Impact:Moves cannot be processed, clients receive errors
Mitigation:Implement retry logic and fallback to cached board state for read-only queries
Architecture Quiz - 3 Questions
Test your understanding
Which component is responsible for enforcing the rules of how a piece can move?
APieceType
BBoard
CBoardCell
DClient
Design Principle
This design cleanly separates concerns: the Board manages cells and pieces, while PieceType encapsulates rules. This modularity allows easy extension of piece types and board configurations without affecting other parts.