October 8, 2009

As Easy as Pi

Software Maintenance Blog

William A Clements

As Easy as Pi

or π or 3.1415926535897932384626433832795… or 22⁄7, 223⁄71, 355⁄113 [[1]]

“How though, are pies thought to be easy? They aren't especially easy to make; I know, I've tried it.” [[2]]

With in the first few week of working out side the academic world, I was asked to work on fixing code. My boss asked me to work on several tasks, and to tell him how long it would take. Since I was new to the large software, and had no experience in estimating how long any of the tasks would take, I estimated 2-6 week for each of the tasks. 2 week for a problem that I could reproduce. 4 weeks for adding new features. And 6 weeks for problems that involved removing code and problems that I could not immediately reproduce. Let just say this I did not get any awards for my estimations.

How long does it take to do software maintenance? Any smart programmer, contractor, or professional, will say, “That depends! What is the problem?” Most professionals, (i.e.: general contractor, plummer, car mechanic) I have come across will not get cornered in say how long something will take until they have looked in to it further. Most professionals will not start a task until they understand the whole problem. It is kind of like starting a home improvement project and half way through you realize that you do not have the tools to complete the task. Understanding the whole problem is the problem in most cases.

Scotty: Do ye mind a little advice? Starfleet captains are like children. They want everything right now, and they want it their way. But the secret is to give only what they need, not what they want!

Geordi: Yeah, well I told the captain I'd have this analysis done in an hour.
Scotty: And how long would it really take?
Geordi: An hour!
Scotty: Oh, ye didn't tell him how long it would really take, did ye?
Geordi: Well, of course I did.
Scotty: Oh, laddie, ye've got a lot to learn if ye want people to think of ye as a miracle worker! [[3]]

“How long will this take?”

Rule 1: Investigate first, then solve.

My answer, “I need at least XX days to investigate the problem:
- 2-4 day to understand the architecture
- 2-4 day to play with the software
- 4-8 days to figure out the problem.

Then I will give you an answer on how long it will take to fix the problem.”

Rule 2: Multiply by Pi

Or any other factor, but never what you think it is. To use another Star Trek euphemism:

Kirk: “How long to re-fit?”
Scotty: “Eight weeks. But you don’t have eight weeks, so I’ll do it for you in two.”
Kirk: “Do you always multiply your repair estimates by a factor of four?”
Scotty: “How else to maintain my reputation as a miracle worker?”
Kirk: “Your reputation is safe with me.”
– From Star Trek III [[4]]

No matter how long you think it will take, it will never take that long. What mother actually delivers on her due date? It is better to over estimate, and be the miracle worker, then under estimate and be the “weakest link”.

Rule 3: Record it

Keep a record of how long it takes you to do different software maintenance tasks. This will give you a ball park for estimating. Also keep a record of things that you learned from other people’s code.


[1] http://en.wikipedia.org/wiki/Pi
[2] http://www.phrases.org.uk/meanings/as-easy-as-pie.html
[3] http://www.c2.com/cgi/wiki?DiscordantRewardMechanisms , Star Trek: The Next Generation - Relics (1992)
[4] “What Scotty from Star Trek Can Teach Us About Managing Expectations”, Scott Vandehey http://blogs.popart.com/2007/07/what-scotty-from-star-trek-can-teach-us-about-managing-expectations/

October 1, 2009

The Winchester Mystery House and Legacy Software

Software Maintenance Blog
William A Clements

The Winchester Mystery House[1] and Legacy Software



“The Winchester Mystery House is a well-known California mansion that was under construction continuously for 38 years, and is reported to be haunted. It once was the personal residence of Sarah Winchester, the widow of gun magnate William Wirt Winchester, but is now a tourist attraction. Under Winchester's day-to-day guidance, its "from-the-ground-up" construction proceeded around-the-clock, without interruption, from 1884 until her death on September 5, 1922, at which time work immediately ceased.[2] The cost for such constant building has been estimated at about US $5.5 million[3] (if paid in 1922, this would be equivalent to almost $70 million in 2008 dollars).[4]
Figure 2: Aerial View


The mansion is renowned for its size and utter lack of any master building plan. According to popular belief, Winchester thought the house was haunted by the ghosts of individuals killed by Winchester rifles, and that only continuous construction would appease them. It is located at 525 South Winchester Blvd. in San Jose, California. […]
Figure 3: Stairs to Ceiling


There are about 160 rooms, including 40 bedrooms and two ballrooms, one completed and one under construction. The house also has 47 fireplaces, 10,000 window panes, 17 chimneys (with evidence of two others), two basements and three elevators. ”[5]
Some of the most interesting part of the house, is there are staircases that lead to the ceiling, doors that open to walls, or worse, to the outside three stories up.

“What the $#!^? This code doesn’t go anywhere!”
Legacy Code with out a master plan in software maintenance will eventually end up in much like the Winchester House. Without careful management of the four categories of maintenance (Corrective, Adaptive, Perfective, Preventive), the code could easily have areas that doesn’t lead to anywhere. For example, adding new functionality, without removing or replacing old functionality from the code. If not all the t’s are crossed, and i's dotted, and all the piece removed, legacy code can be come blotted, and unworkable.


[1] http://www.winchestermysteryhouse.com/
[2] A Mystery House, Frommer's San Jose, retrieved Oct. 30, 2006.
[3] Amazing Facts, Winchester Mystery House, retrieved Nov. 7, 2007
[4] CPI Inflation Calculator, Bureau of Labor Statistics, retrieved Nov. 19, 2007
[5] http://en.wikipedia.org/wiki/Winchester_Mystery_House