Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 14 Jul 2012
Offline Last Active Jul 26 2012 05:23 PM

Posts I've Made

In Topic: Classes, Engine and Ownership.

14 July 2012 - 04:29 PM

I would say this definitely belongs in the Grid class. The Engine shouldn't have to worry about what the default state of the Grid looks like - it should be content to know the Grid has been reset, never worrying about the specifics of how.

Not only will it make the code easier to read, it will make it easier to make changes later. Say you want to implement a hexagonal grid, or a 3D grid, or whatever; if the resetting code resides in the Engine, you will have to change it; if it's handled by the Grid class, you can simply replace it with a new Grid class. As long as it implements the reset() method, the Engine won't know the difference - and shouldn't have to.

(In practice it will likely not be that simple, of course - but the principle holds.)