Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Treasured bug-changing tips, how can programmers quickly and efficiently change bugs?


Jun 02, 2021 Article blog



In a programmer's career, you can't help but deal with bugs all the time. B ugs are also a grinding stone for programmers to advance. I f it is Virgo programmers, encountering bugs will be very excited, happy to toss, and even solve bugs; Bugs, of course, are a nightmare for most programmers.

 Treasured bug-changing tips, how can programmers quickly and efficiently change bugs?1

There are often problems with modifying bugs.

First, in the face of some of the attitude of the bug

Let's start with companies in the software industry that often have one person patch bugs in another's code. In this case, some programmers can write a piece of code in one go, and then leave the problem to other engineers.

However, this creates another embarrassment. B ecause everyone's code skills and styles are different, it's quite inefficient to let one person fix another's BUG. O n the other hand, making another programmer very faceless! W hat's more, for higher-tech programmers, the worse the code, the more painful it is! In their opinion, it's better to rewrite the code.

 Treasured bug-changing tips, how can programmers quickly and efficiently change bugs?2

Second, some programmers also have a negative attitude toward bugs: Are the testers targeting me? A m I really a programmer? It doesn't seem like my bug!

Professionally trained programmers, the correct posture in the face of bugs should be: debugging code, unit testing, joint debugging, integration testing, identifying the problem, further find out the cause of the problem, and then modify the code, verify the modified code.

Second, how to solve the bug?

1, dilyceetical positioning

This is also a more conventional method, that is, the program logic a little comment out, to see if there will be problems, similar to the two-point search method, gradually narrow the scope of the problem.

 Treasured bug-changing tips, how can programmers quickly and efficiently change bugs?3

2, step-by-step debugging

Due to code logic errors, output results often do not match expectations. T he best way to solve such problems is to use step-by-step debugging, which sets the expected results for each step of the code, and then tracks to determine whether the actual results are consistent with the expected results and find out why! If the development environment cannot be reproduced and cannot be debugged in a single step, you can use the addition of output logs to determine which step of the problem.

3, rewrite it again

Most bugs are actually typo. You can rewrite the code with a must-kill technique!

 Treasured bug-changing tips, how can programmers quickly and efficiently change bugs?4

And for programmers who also have management responsibilities, meet their bugs, do not have to explain, do not have to hammer, wait for themselves to change the program, or really can not, and then explain their ideas to you!