I get stuck each time I need to write a constructor for any class I design. The reason is that I am not sure what should go into a constructor and what should not.
On googling for this, I got the answer that the constructor need to do only as much as to make sure that the opbect created is valid. But my query is
How do you know if an object is in the valid state?
My class represents a chess board:
public class ChessBoard
{
List<ICellRow> lstRow;
int cellOffset;
//Other function
public ChessBoard()
{
//What should go in here?
}
}
How do you decide when a class has the minimum information to be in the valid state? In this specific example, makes the board class valid?