Bob said:
I have recently joined a healthcare company where I am the solo
programmer. I am going to be starting work on a project. The
management has asked me to provide an estimate of hours I am going to
spend on the project.
How do I estimate the number of hours I am going to spend on
programming in a project?
Tell them you have a ball-park estimate - 60, 80, 240, whatever - but you
will know much more in just one week.
Before that week, write the name of each _small_ feature they request on a
card. Ask whoever owns these features to sort them by business priority (not
technical risk, or alphabetical order, or whatever). The feature with
highest business priority is the feature that will boost end-user
productivity the most.
Take the top 8 cards.
For a week, implement those cards. Write lots of Unit Tests as you go, and
run them between each 1~10 edits, the fewer the better. Always rapidly
return the code to a condition where you can predict the results of the next
test run.
After one week, compile everything into a deliverable, deliver it, and make
them use it. Watch them operating the features they just request. (Oh, and
all those tests made sure you implemented very fast, but with absolutely no
bugs. You will be surprised. A few short minutes writing tests, and simple
code, can prevent many long hours running a debugger.)
Count the number of cards you finished. It could be 6, or 8, or 10, or
whatever. Suppose it's 9.
Now tell them, "If we keep going like this, I can finish 9 of these cards
per week. What's the next 9 cards to do? And does running the program make
you think of new cards?"
They will add any new cards they think of, remove any cards that might no
longer make sense, and then sort the stack by business priority. You will
pull off the top 9 cards.
When you implement these, refactor your code to merge the new features into
the old code. The tests that constrained the old code will support this
activity. Bugs come when you add new features to old code, so adding tests
to all features defeats this risk.
After the second week, you may finish 5, or 9, or 11, or whatever, number of
cards. And you will not slow down, no matter how many features, because the
tests maintain your velocity.
By this time, your stakeholders will have such a clear picture of your
velocity that they will no longer ask to "estimate" any number of hours.
They will have a perfectly clear understanding of your throughput, and will
not consider your velocity - 9 or whatever - as an estimate. This process
makes them feel very in-control of your project, and very reassured. They
can easily select features in batches that steer the project towards its
business goals.