From: Mark S. <mar...@gm...> - 2008-11-05 00:42:55
|
I would like to pose a question using your example routine in the Tile Class: 325 /** 326 * Is the tile layable now (in the current phase)? 327 * 328 * @return 329 */ 330 public boolean isLayableNow() { 331 return GameManager.getInstance().getCurrentPhase().isTileColourAllowed(colourName); 332 } This calls in the Game Manager the 'getInstance ()' routine: 336 /** 337 * @return instance of GameManager 338 */ 339 public static GameManager getInstance() { 340 return instance; 341 } What I am very puzzled by is why bother to call to get the instance at all? If you have the GameManager, you already have a copy of the instance. You can reduce the original call to: 325 /** 326 * Is the tile layable now (in the current phase)? 327 * 328 * @return 329 */ 330 public boolean isLayableNow() { 331 return GameManager.getCurrentPhase().isTileColourAllowed(colourName); 332 } And even saving the a pointer to the object within the object is a circular reference that accomplishes nothing useful that I can see. Maybe I am failing to realize why you bother with this self-referencing object. Mark |