One of the many skills a developer needs, is to be able to estimate how long a task is going to take to develop and test. These estimations are really important for a dev company as they can be helpful when it comes to quoting the client and planning what tasks you can fit into a sprint.
Most developers however find it difficult to estimate times accurately ( sometimes estimating too many hours or too few hours).
Here are some tips to make estimating time easier.
If you are working on someone else's code, make sure to thoroughly review their code and make sure you know what you are going to change or add to their code. Also, estimate extra time in case you hit a roadblock (eg. you have picked up unforeseen issues with the code).
When given a task from a client, sometimes we think that we know what the client wants. But it is always good to organise a meeting with the client to discuss the task in detail and make sure you understand what is needed to be done.
It is good practice to break down the tasks into smaller bite-size tasks. It is a lot easier to estimate the time it takes to do 1 small item than to do a bunch of items. Another benefit is that when breaking down the task you will be able to think through exactly how you are going to do the task and what you need to do. I also find it helps keep you motivated when you are able to mark smaller tasks as completed (you can easily see how much you have done and what you have left to do).
If there is a task that you have never done before, contact a colleague who has and get their input on how long they think it is going to take. They can also help you break the task down and plan time in their next sprint to be available to pair program with you if needed.
Once you have estimated all your times and calculated the total, it is always good to add buffer time. You can think of this as how you would add a contingency to a budget for unforeseen items. Remember that estimating too much time is always better than too little time. A client will always be happy if you are finished with something sooner than planned.