Section 1

That was a lot of code moving around between 2 classes. It's possible we may have made mistakes. Run the unit tests again to see if we are still good.

The MirrorCell class still needs to be moved under our new Cell abstract class. So does the TargetCell class.

MirrorCell

When we left off coding the MirrorCell we realized that there were a lot of similarities with BlankCell and a few differences. We know we will have to set the orientation for the mirror both when the cell is first instantiated as well as on-the-fly if the user decides to rotate the cell. Therefore we need methods to handle those requests.

The initialize method should be modified to use one of these new methods for setting default behavior.

The #exitSideFor: method on BlankCell is suitable for our cell too and can be moved up to the super class. The #isOff and #isOn methods should also be moved. Finally, the #isSegmentOnFor: and #laserEntersFrom: can be moved up as well.

The only code left on BlankCell is initialize code. If we run our unit tests again we verify that everything still works.

Index Page Next Page

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