Section 1

When we instantiate a Grid, the number of rows and columns must be specified. Here is the #initialize method. The #initializeCells method still needs to be written.

Here is the #initializeCells method.

If for some reason the "numberOfColumns" or the "numberOfRows" instance variable is not defined, this method will blow up. We could build a "safety net" by adding lazy initialization to the variable accessors. Make the default size to be 1 row and 1 column.

We will want to address cells within the grid. Rather than "expose" how cells are actually stored in our grid, we should provide methods that provide access to and setting of specific cells.

Index Page Next Page

Copyright © 2007, 2008, 2009, 2010 Stephan B Wessels    stevewessels@me.com