Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

Today I changed the bug of the day, talk about my experience;

For demand, we generally hold attitude is to do things, don’t take yourself too seriously, to do your own thing seriously, although many of the requirements in the product manager design, it is not reasonable, don’t cut, but after our logic design and checking, and good example or a template can be attained, This is also one of the aspects of the need to exercise us again and again, and to implement the feasibility of the need;

For bugs, we usually fix them not by ourselves, but mostly in the process of team cooperation, or in small details, such as the time difference between the system and other systems, which may be ten minutes or even more.

1. Find the problem first

Then ask yourself why?

I realized that I had found a problem before, and then it was a system anomaly, failure of operation, not a patient thinking of the whole situation, and the program was created by us for the needs, to help the world solve problems, so our job is essentially to solve problems.

The key to solve the problem is to clarify what the problem is (abnormal situation, specific positioning);

Can not say, I can not solve the problem, they will casually find, search Baidu, directly to find the answer, to learn to find the root of the problem data, and then the data out, check why the data abnormal,

2. What needs to be done?

In fact, this is the step we took to solve the problem:

For example, in the last test, I felt that the system time was inconsistent, and the data in the operating system and the queried time always felt wrong.

For time this thing, ordinary people are not very sensitive, because from his discovery to your understanding of this period of time, there has been this phenomenon, if the direct recurrence, this problem is very necessary;

For example, when I was comparing commodity data, I found that one index was not added successfully all the time, so I was not allowed to create new data, which made me confused.

Through the knowledge of the previous index, it will only appear in certain circumstances and have an impact;

In general, the data is not blocked by the index, this is a unique index, probably everybody uses it, mostly for creating goods, identifying uniqueness, by doing a unique index for the name of the item, the store of the item, and the product to which it belongs,

You can isolate most of the abnormal data,

As long as the data fits the unique index, it gets into our system,

At that time, I found that the index data I wanted to add happened to be a field of the oid of the commodity identifier. No, because it was the data after comparison, I changed the attributes added when the data was stored, and the data already existed, so my data could not be entered.

From this, I found that if I had identified the problem and what I was doing, did I send the problem?

With those two things figured out, the bug is half the battle;

3. Find the best solution according to the existing problems

In fact, this is the third step for us to solve the problem, many people, first go straight to the third step, that is too slow;

There is so much information on the Internet that you need to sort and filter, so try to be as aware as possible of the bugs we encounter 🔐;

For example, I encountered a data import problem today, and the display is JSON parsing exception, it is a JSON file to import data,

But the imported data contains collections, common attributes, and then some special attributes. Objects can contain everything, but if you parse JSON, you might not parse it all at once; I tried, and it really didn’t work;

I deleted the JSON data of the collection and simply parsed the object directly. Perfet succeeded, so I began to consider how to convert the JSON data of the object containing many attributes and sets into the template object I needed.

Then I simply convert JSON to a JSONobject, via getArray(), and then, depending on the stream, to a list of my last two articles.

Jsonobject.getstring () can convert the collection data I need directly to the other individual property data.

Basically you can get the data;

In this way, you can perfectly parse to the data you want, so as to write library, perfect end.

BUG pain points:

1. You have no idea what the problem is

2. You don’t know why the product is required (debug is needed)

A solution to the current problem, which can be discussed with each other

And one more thing that I feel is important,

All functions are first perfect and then perfect;

Are polished out, good snipers are fed by bullets, you should also be bug repair out;

That’s it for today, I’m Luca, and I’ll see you next time