!title Brain Surgery Guides I was working with a client a few weeks ago. He had asked me to help him get started developing a feature for one of his applications. He wanted to learn the flow of acceptance testing, unit testing, and coding. !meta You can see this flow by reading the [[Craftsman][http://www.objectmentor.com/resources/listArticles?key=topic&topic=Craftsman]] articles, starting at !-#25-! and going forward. We used FitNesse to write a simple acceptance test. Then we started executing the acceptance test. Since the Fixtures weren't written, we had to implement each of them one step at a time. At first the fixtures were skeletal, having just enough code in them to allow FitNesse to proceed without exceptions. We implemented each Fixture in the simplest possible terms. The Fixtures would compile, but did very little else. Within half an hour or so we got to the point where the acceptance test was executing to completion, and failing. Next we had to tie the Fixtures to the application. Since there was no application at this point, this was an act of design. We had to determine how the fixtures would interact with the application, and build the skeletal structured within the application that would support that. When we were done with that, the acceptance test still ran to completion, and still failed. Next, one step at a time, we made the acceptance test pass. This involved adding code the the application to process the information in a manner consistent with what the acceptance test expected. We wrote unit tests for all the code in the application that was more than trivial. In the end, my client something to this effect: !* Client said: ''Oh, OK! The acceptance test acts like a guide, or a support. It keeps you focussed on the big picture of the feature you are working on. The unit tests are also like guides, but at a much lower level. They keep you focussed on the particular classes and methods you need to write in the application.'' *! I thought this was an interesting observation. It reminded me of a NOVA I saw once. It was about a person who had uncontrollable tremors. He went to a neurosurgeon who determined that the tremors were being caused by a small cluster of neurons that were misfiring deep in the patient's brain. He decided that he could stop the tremors by destroying that cluster of neurons. Destroying a cluster of neurons is simply a matter of heating them up until they die. You can heat them with a very tiny needle with a heating element on the end. You insert the needle into the brain, positioning it right in the middle of the errant cluster of neurons, and then pulse the heat for a fraction of a second. In order to do as little collateral damage as possible, the needle must be very fine, and it must be positioned perfectly. To do this, the surgeon imobilizes the patient's head, removes the necessary portion of the skull, and then using PET scans, locates the errant cluster of Neurons in 3 dimensions to within fractions of a millimeter. Then he builds a set of guides, anchored to the patient's head. The needle will be threaded through the guides. The guides control the azimuth and altitude angles of the needle relative to the patient's head, and also the depth of the needle. Setting up these guides takes a lot of time and effort. Setting up the guides ''is'' the operation. The actual insertion and heating requires barely more than a minute. Acceptance tests, Unit tests, and the practices of Agile Development are like those guides. They set everything up. They constrain and restrict what the production code will eventually do. They make sure that the production code does what is needed, and only what is needed. ---- !commentForm !* Mon, 14 Mar 2005 02:07:46, Kelley Harris, Great analogy. A collection of similar analogies would be interesting. A collection of similar analogies would be interesting. Possible additional analogies: * Surgery: Sterile procedures (Bob I think you've written about this before), cooperating team, ... * Fine woodworking: jigs, clamps, ... * House painting: taping lines and windows *! !* Mon, 14 Mar 2005 11:17:09, Bill Rutiser, The same thing happens in machining metal. To make a complex shaped part, an expert machinst, sometimes known as toolmakers, will make special gauges, jigs, fixtures, and specially shaped cutters. This subprojects may themselves require gauges, jigs, fixtures, and specially shaped cutters. Eventually the recursion stops. *! !* Mon, 14 Mar 2005 20:16:41, Hui Deng, One good metaphort is worth a thousand words. *! !* Mon, 14 Mar 2005 20:17:36, Hui Deng, One good metaphor is worth a thousand words. *! !* Sun, 30 Oct 2005 16:03:34, linda soucy, tremors in my head and voice I am considering having brain surgery for my tremors. Alot of people say they do not notice them, they are in my head and my voice. I notice them alot and they are very embarrasing, to the point that I do not go out to much. I am 54 do you thing having this surgery is too drastic. Thank-you *! !* Mon, 26 Dec 2005 09:35:29, cat, analogy This subprojects may themselves require gauges, jigs, fixtures, and specially shaped cutters. Eventually the recursion stops. http://www.3ecom.com House painting: taping lines and windows *!
Use alt+s (Windows) or control+s (Mac OS X) to save your changes. Or, tab from the text area to the "Save" button!
Grab the lower-right corner of the text area to increase its size (works with some browsers).