How to tell how long it will take you to build that feature or fix that bug

Cover image

Picture by Luke Chesser

Quick answer: "Depends on the code already written"

If the code written is easy to read. If it's logical and does what you expect it to do, you can estimate.

If the code written is a mess. Your estimate will be wrong.

You'll see senior software developers answer with "depends" to a lot of your questions and it's just a matter of time before you start doing it too.

What to do when the code is a mess:

  • Try to estimate, communicating that you might be wrong on your estimate. It's ok, it's an estimate.
  • Try to write cleaner code and leave things a bit better than they were before for the next person.
  • Read the code well and try to understand it. Write down a map of how it's working.
  • If you can, get the person who worked on the code last to share some knowledge your way.

What NOT to do when the code is a mess:

  • Don't blame it on who wrote it. You don't know what the situation was. Maybe he/she had a short deadline, maybe he/she found a messy code base to begin with.
  • Don't try to refactor the feature if you don't have enough time or you don't understand how big the feature actually is. Trust me, you never really know.
  • Don't complain to your PM / Boss / team / grandma.

Conclusion

Communication is key here. You can be wrong on your estimates even after 20 years of experience. You just have to be as clear as possible and leave things a bit better than they were.