I'm trying to design (say in java), Four In A Row game using the MVC pattern.
The FourInARowModel class stands for the model and looks something like this:
public class FourInARowModel extends Observable{
//fileds
private boolean turn = true;
private int discsNum = 0;
GameState gameState = null;
private Player firstPlayer, secondPlayer;
private Board board;
private Cell lastCellChanged;
//methods
}
Suppose there could be an implementation (server game for instance) s.t there could be multiple instances of the FourInARowModel class. Which pattern/"trick" would allow the best optimization for memory usage? (assume this class is heavy and I want to create a few instances as I can of it).
What should I use in this case? Caching/Pooling? make it Immutable class? Anything else?
Thanks for advance.