Programming Best Practices — Messes and Estimation
By: John Au-Yeung
Tags: Programming, Web Development, Software Engineering, Software Development, Technology

Photo by Todd Quackenbush on Unsplash

To be a professional programmer, there’re many things that we’ve to do to be a good one.

In this article, we’ll look at best practices for dealing with messes and estimation.

Messes

The more we try to move forward with a mess, the worse the mess will be.

This is a problem that we’ll run into when we work with a mess.

It’s better to go back and rework it as soon as we can rather than continuing with a mess.

Estimation

An estimate is a commitment from the business point of view.

But developers like to think of them as guesses.

The difference is big.

Commitment

A commitment is something that we must achieve.

If we commit to getting something done by a certain date, then we’ll do it.

Professionals don’t make commitments until we know we can achieve them.

Commitment is all about certainty.

Other people accept our commitments to make plans according to them.

The cost of missing commitments is big.

Missing commitments is an act of dishonestly that is slightly better than a straight-up lie.

Estimate

Estimates are a guess. There’s no commitment implied.

No promise is made. So if we miss an estimate, it isn’t being dishonest.

We make an estimate because we don’t know how long something takes.

Most of us are bad estimators. This is because we don’t understand the true nature of an estimate.

We’re supposed to make are estimates based on some probability distribution that’s in our heads.

Implied Commitments

We should be careful about implied commitments.

For example, if we say we’re going to try to do something, that sounds like a commitment.

We got to disclaim that by saying that it’s not a commitment, so we won’t disappoint people if we miss them.

PERT

We can use the Program Evaluation and Review Technique (PERT) to calculate estimates.

We provide 3 numbers:

O for an optimistic estimate. It’s a wildly optimistic estimate. This can only be met if we did everything right and it went the way we expected.

N is for nominal estimate. It’s the estimate with the greatest chance of success

P is for a pessimistic estimate. This is wildly pessimistic. If everything goes wrong, then we would hit this estimate.

Then we calculate this by writing:

m = (O + 4N + P) / 6

to get the expected duration of the task, which is m .

The standard deviation would be:

(P - O) / 6

Estimating Tasks

To make our estimates better, we can discuss a task, estimate it, and iterate the discussion until an agreement is reached.

We all discuss as a team until everyone agrees, then move on to the next task.

Agreements don’t need to be absolute. As long as they’re close, then it’s good enough.

The scale of the estimate is decided at the beginning of the meeting.

Planning Poker

Planning poker is something we can use to estimate tasks.

Everyone sits around and give their estimate of the task.

Then we take the average of them for an estimate.

Some people may make cards with Fibonacci numbers to give estimates with those numbers.

Affinity Estimation

We can also estimate without talking.

Everyone stands around a table or a wall with cards that have the tasks spread out randomly.

Tasks that take longer are moved to the from the quickest on the left to the longest on the right.

Law of Large Numbers

Estimates often have errors.

We can manage errors with the law of large numbers.

If we break up a big task to many smaller tasks and estimate them independently, then the sum of the estimates of the small tasks would be more accurate than one big estimate of a big task.

This is a good technique as they may integrate out.

Photo by Alex Holyoake on Unsplash

Conclusion

There are various ways to estimate task duration.

We can use planning poker, arranging cards, or PERT.

As long as we aren’t sure, we shouldn’t commit to anything and stick to estimates.

If we aren’t sure of something, then we shouldn’t commit to it. This way, we won’t disappoint people.

If we have messes, we should clean them up before continuing.

JavaScript In Plain English

Did you know that we have four publications and a YouTube channel? Find them all at plainenglish.io and subscribe to our YouTube channel!