Today, in order to catch up with the schedule, my test students worked overtime to test my functions.

Because my code is finished, there is no need to accompany the test, so I did not go ~

In the afternoon, the first question came up. According to experience, this should be a logical problem in the test. Finally, he found it himself.

After a while, raised the second question, said that should hit the condition into a certain level, did not enter, jumped to the next level.

With a few years of development experience under my belt, I’m certainly not going to say, “My code is bug-free, try again.” It costs almost nothing to say, but when you hit your face, it really hurts

After a quick thought in my mind, I found that the answer could not be given by practicing in my mind. So I obediently lifted the lid of my computer, unlocked it with my fingerprint, connected to the VPN, and checked the log.

Because of the large number of requirements and the relatively long process, I have printed data logs at key points in the code.

So, want information, the log is available. Just, carefully looked at the data of the log, and carefully compared the test data given by the test students. In all fairness, this should have been a hit.

But there was no hit, so the search started.

Viewing the Configuration Center

Because there are many indicators, each indicator has a threshold value. First of all, the first reaction was that it was someone else’s fault, so I did not rest assured to check whether there was something wrong with the parameter threshold value adjusted by the test student. After reading it, I felt a little guilty.

But still not give up, is it not according to the key points I told him to choose hot loading options, resulting in the index did not take effect. Think of here, I am a little excited, yes, I can surface understatement, in fact, the heart excited to tell him the truth: you this is configuration forgot to check (how the matter, again your problem)

You want to think, you want to hold your head high, you want to hold your head high, you need proof.

Our configuration center is so considerate that we can check the history of every operation. Just count it, grab a picture, and throw it to him.

Wait, wait, wait, wait, wait, wait, wait, wait, wait, wait, wait, wait, wait.

emmm

Adjust the strategy

According to the log, the test data is ok.

From the configuration center, configuration is also checked.

The test eliminates the suspicion, the truth only has one, is my problem (oneself hit oneself face, start can light point).

Although the home is connected to the VPN, you can also view logs and publish projects, but the local startup service is not working, and UT cannot run.

That can only look at the code, you know, close to the ink, close to the black, find other people’s shortcomings, that is zhang Mouth, a good one.

Look for your own problems? How hard it was to deny yourself first, to know that you are flawed, but I did it!

In order to test a classmate account, I began to read their own code, in an attempt to find their own shortcomings at a glance ~ (too south

The missteps

The code logic involving test points is also not complex. This is how it’s going to work

Upstream concurrent calls to obtain the current value of each indicator -> filter at the rule layer -> If two rule conditions are hit, it is regarded as hit, otherwise no hit

Therefore, the thresholds of the two rules are compared according to the two indicators provided by the test students and the test data provided.

From the log, there is no problem with the upstream data. From the data comparison, the comparison should be passed, but there is no hit.

So began a careful examination of the two rules related to the code, in case the hand shook!” Phi is equal to phi is equal to phi.

Unfortunately, when I looked at what I thought was critical, I found that my code was so rigorous that I couldn’t find any flaws.

I had to release the lock in order to keep my testers from hanging on to my thread: “The code looks fine, you test the other logic first and I’ll check it out.”

Little yellow duck saved me

I knew I had astigmatism, but I wasn’t blind.

So even if you compare it ten times or eight times, you still can’t find the bug.

It’s time to think differently.

As it says, the upstream code is ruled out, the code itself is ruled out, and, of course, the test students are ruled out, not to mention the downstream code, which has no idea.

If you think about it, two rules are preceded by other code, even though it’s a rule. I decided to open my eyes and look for bugs.

Treat yourself as an emotionless machine, reading through the neat and concise code I wrote, calculating the results of the code, and eliminating suspicion.

Upstream assignment is ok! No problem with variable initialization and result return! No problem with the first rule!Copy the code

No problem with the first rule!

Other initial variable assignments and returns are fine!

Then start the intermediate rule code between the first rule and the second rule.

Does the method return the expected value? !

Yes, I returned a variable value that should have been returned regardless of whether it was hit or not, only in the hit condition. If this rule is not hit, then no assignment is made, and what is actually returned is the default value of the variable’s type, which is 0.

High and mighty will only be late, but never absent.

I told the test students, I should know the reason, I fix it, I will try again later, the following “heroic deeds” will not be introduced.

Summary of inventory

It’s not a big problem, it’s not a big online incident.

Just want to express, almost no one dare to say their own code 0bug, written can be online. I have such a promise and brand of people, and eventually escape the fate of overturned and hit in the face.

There are problems, rational analysis is the most important, from the aspects involved in the bug, including the handling of the code itself, can be wrong.

Sometimes, if the discovery is their own problem, but slow to find the reason, do not a person stuffy head thinking hard, find a colleague to help you find. Sometimes, just as you’re about to let others take a look, you start to describe the weirdness of a problem, and before you finish, you suddenly know why. I don’t know if you have, but I have.

Looking back on it today, the people I called were actually tool people. They were little yellow ducks.

What is yellow duck and yellow duck debugging method, see baidu entry

This concept is referenced to a story from the book The Way to Become a Programmer. Legend has it that a programmer would carry around a little yellow duck, place the duck on his desk while debugging code, and explain each line of code to the duck in detail.     Many programmers have asked and explained a programming problem to someone (even someone who doesn't know how to program at all), and hit the solution in the process. Any incongruity between stating the intent of the code and observing what it actually does and debugging becomes apparent and makes it easier to spot your mistakes. If you don't have a duckling toy, consider talking to other things, such as plants on the table, a keyboard and mouse.Copy the code

Like this

Or it

If you can’t find a duck, you can’t find a colleague

Welcome to JackieZheng