Section 1

New Methods for MirrorCell

Whenever we instantiate cells from the MirrorCell we need to take an extra step of orienting the mirror. As a practical matter, the MirrorCell must always have one orientation, left or right. We can streamline this behavior with a few new class methods on MirrorCell. Note we are using a new class methods protocol of "instance creation".

Important note! In the browser above we just created a new Class method. Not an Instance method. Make sure you have the "class" button clicked before creating the #newOfSize: method. A number of students learning from this tutorial have made this mistake. If you do too, just delete the instance method you created by mistake, click on the "class" button and create a new class method instead.

We can go back and incorporate these new methods in our unit tests -- in a few places only so that the old technique is still tested too.

After we make these changes we should once again run our unit tests and validate our changes.

Index Page Next Page

Copyright © 2007, 2008, 2009, 2010 Stephan B Wessels