Programming task estimates

Why does building software take a long time and cost a lot? Sometimes a programming task works like this:

1. Programmer has a task to complete such as adding a fairly small feature to a web page. Task is estimated at 4 hours.

2. Although they haven't been revised in a while, unit tests are available for this page, so a good starting point is to look at the existing tests and determine what needs to be added or changed to test the new feature. (1 hour)

3. The unit tests that were previously created did not test the existing page, so new ones are created. (1 hour)

4. The new unit tests do not function as expected because the test data does not work. Thinking that perhaps the newer version of the library that builds the test data might fix the issue, programmer upgrades the library. (1.5 hours)

5. Library upgrade fortunately does not cause any new problems, but it does not fix the test data issue. Continue debugging the test data until resolved via a workaround. Immediately after workaround implemented, light bulb goes on and test data is fixed rendering workaround unnecessary. (1 day)

6. Approximately 11.5 hours into task, we have good regression testing to help prevent a failure of previously existing functionality. Unfortunately, no work has really been completed on the original task.

The original task will likely be close to the actual estimate, but the additional time spent can't be easily accounted for. In good conscience, we have to eat this extra time internally as overhead or some kind of other catch-all account that doesn't really gain us much but is necessary.

Lesson learned - just that there will often be issues and subtasks that are seemingly unrelated to the original task. This is part of building software and gets worse the more mature a product is and the more modifications and additions that it has undergone. Under pressure, they are often skipped or we just ignore them and hope that someone else catches any problems that the programmer does not (programmer pushes some of the time toward the testing team).