Index

Overview


This design challenge features fractals...

Steps


Code up a graphics class named "Drawer".

It's job will be to draw a variety of basic shapes such as ellipses and rectangles.

It will also draw fractals.
We do a quick estimate.

We think that just the fractal generation will take about 1,000 lines of code.
We're at a crossroads.

Should we dive in and start coding, or take a detour and look for code reuse?

We decide to visit "look for code reuse".
We pull out our #1 toolbox.

This toolbox contains reusable components.
We look in the toolbox and find a component that looks like it could help -- a FractalGenerator class.

We grab it.
We add the FractalGenerator as a component (ivar) on "Drawer".

When "Drawer" is asked to draw, it now simply delegates to it's component.

We replaced 1,000 lines of code with one message send by delegating to a component.


Ideas Doc


The "Ideas Doc" completed for this example is shown below or downloadable here....