Coding With Fun
Home Docker Django Node.js Articles FAQ

Added two lines of code, but it took two days

Jun 01, 2021 Article blog

Table of contents

Ming Ming only added two lines of code, why did it take two whole days?

This question may seem reasonable, but there are some terrible assumptions behind it:

  • The number of lines of code . . . the amount of work
  • The number of lines of code is the value
  • All lines of code are the same

But none of this is true.

It took someone a full two days to change the code, but why do we look back and think it's so easy?

(Recommended tutorial: python tutorial)

Because the problem report's description of how to reproduce is very vague.

It took me several hours to successfully reproduce the problem. S ome developers immediately go to the person reporting the problem and investigate when they have more information. A nd I will try my best to use the information that has been provided. I know some developers don't like bug bug so they'll try to get away with it. C laiming that you don't have enough information is a good way to shake the pot in time, and it looks like you're trying to help, but you don't have to do any work. I know it's very difficult to report errors, and I'm very grateful to those who reported them. I'll make the most of the information I have, and I can't really ask anyone who reported the error for more information to express my gratitude.

Because the reported problem is related to a feature, I'm not familiar with it.

I rarely use features related to this issue, and I have not been exposed to specific details related to this feature. So I spent a lot of time understanding how to use this feature and how the bug interacts with the software.

Because I spent a lot of time investigating the real cause of the problem, not just the surface.

If some code throws an error, you just wrap it in try..catch can be suppressed in catch statements. N o mistakes, no problems. I s that right? S orry, in my opinion, hiding the problem is not the same as solving the problem. M asking errors can easily lead to other unexpected side effects. I don't want to stay in the future and deal with them again.

Because I investigated whether there were other ways to reproduce the problem than the steps of the problem report.

Errors can be easily surfaced through a set of reproduction steps, but in reality they can involve deeper problems. F ind the exact cause of the problem and study all the ways to solve it to provide valuable insights. For example, the actual use of code, there may be problems to be solved elsewhere, or there may be code inconsistencies that cause errors to be raised in one code path, while others will not.

Because I took the time to verify that other parts of the code were affected by similar problems.

If an error causes the bug the same error may exist elsewhere in the code base. I can take this opportunity to examine it carefully.

(Recommended course: JavaScript tutorial)

Because if I find out the root cause of the problem, I can find the simplest solution and the risk of introducing side effects is small.

I don't want to fix the problem in the quickest way. I hope that fixing this problem will not cause confusion or other problems in the future.

Because I thoroughly tested this code change and verified that it solves all the problems under the affected code path.

I don't want to rely on others to test whether the changes I've made are correct. I don't want to wait until I've completely forgotten about this change before I find a bug forcing me to look back at the code again. S witching back and forth is time-consuming and frustrating. I don't want a full-time tester to test the same change again.

I don't like the work of changing bug in part because it feels like it's the result of my previous mistakes. Another reason I don't like bug bug is that I prefer a new job.

Q: What could be worse than changing bugs? A: Fix the same bug over and over again.

I'd like to take the time to make sure that every bug I encounter is completely fixed so that I don't have to face bug anymore, and I don't have to spend time investigating, fixing, and testing bug

The above is about why sometimes clearly only added a little bit of code, but spent several days related to the introduction, I hope to help you.


Reference source: