当前位置:网站首页>Have you learned all these routines to solve bugs?
Have you learned all these routines to solve bugs?
2022-06-24 04:01:00 【Programmer fish skin】
I recently sorted out my original 140 Programming experience and technical articles , Welcome to read , Growing up together ! The way :https://t.1yb.co/ARnD
Hello everyone , I'm fish skin .
In the process of learning programming , We will encounter all kinds of Bug, I often feel bald because of them .
But as you continue to solve Bug、 Accumulate experience , You'll find that it actually solves Bug There are also routines .
Today, I'd like to share the solutions summarized by fish skin Bug tricks , Help everyone improve the efficiency of programming learning , Protect your hair .
solve Bug Routine summary
Outline of this article :
preparation
Actually change Bug The process is the same as solving a case .
First , In a hurry to search for questions 、 Change the handwritten code on Bug Before , Do a few things first .
1. Get more information
It's like looking for witnesses at the crime scene 、 Like collecting evidence .
We need to find out Bug When does it happen ? Why does it happen ? Under what circumstances ?
What exactly did the user do , That led to Bug ?
It happens every time Bug, Or a little back trigger , If it is triggered by accident , Is it reproducible ?
Not reproducible Bug, Also called Bug Well ?
This information , It's all important . If you can , You'd better get the user's detailed error reporting reasons 、 Requests and responses , More information , To help us locate and analyze problems more accurately .
2. Define the boundaries
To put it bluntly , Is through the information already in hand , Make sure you put this Bug On whose head ?
for instance , If users suddenly can't visit your website . At this time, don't put that silly analysis and investigation first , But you can visit the website first . If you can visit , Maybe not at all Bug, But the user's own network cable is broken !
In enterprise development, many people often cooperate , For example, front end and back end 、 Service providers and service callers , How to judge who wrote it Bug Well ?
Generally, we can go through Interface Request parameters and response parameters to divide responsibilities .
For example, I'm the front end , Request your back-end interface , Send you " Fish skin ", You must return to me " dog's head ". The result finally appears Bug when , I have a look at , I sent you " Fish skin ", You gave me " Fish head " Right , That's obviously on your side Bug, Rain I have no melon .
3. Protection site
Make sure it's your own Bug after , If it's an online program Bug, Remember to keep the program state at that time , such as dump Memory 、 Download logs , For later troubleshooting .
Just like solving a case , Don't touch anything at the crime scene , Otherwise, key information may be missing .
Let's see how to solve Bug.
Take care of yourself
Everyone's time is precious , When something goes wrong , It is suggested not to ask others blindly , It's self-reliance , You can solve it yourself in the following ways .
1. self-examination
Except for problems in the program , The most direct way to check is : Error reporting of the program 、 Analyze the logged error log .
For example, when you see an error in the program "db connection timeout", Obviously, the database connection timed out , At this time, you can first confirm whether there is a problem with the network and database itself , Maybe it can be solved Bug 了 .
2. Search engine
As the saying goes , Never ask a certain degree in case of trouble , This is probably the most common solution Bug Means .
But today's search engines are not very friendly to programmers , Many advertisements 、 The content is outdated 、 After clicking in, it's not right , These will become obstacles to your search .
Then you might as well try these skills :
Screened ads
Add... After the search term "-advertisement" Can quickly block the search advertising information :
On-site search
Use site: domain name + Search terms , You can quickly search in a specific website , Like most now Bug The solutions are actually CSDN:
Keyword search
When using a certain degree to search for long sentences , You can disassemble the keywords in the error message , Such as version number 、 Database type, etc , Use spaces to connect and overlay keywords , You can search the desired results more accurately , Avoid the interference of conjunctions .
Limit the scope
Open the search tool , You can add restrictions to the search , Such as time 、 Document type, etc :
Of course , Other search engines also have their own search skills , Be the same in essentials while differing in minor points .
Besides , You can also try Developer search , A search engine for programmers , Much purer . And it seems that its implementation is very simple , Just search for content from developer related websites .
3. Official documents
When we use some unpopular technology or newer technology , It may be difficult for domestic search engines to find a solution .
At this time, you might as well open the official document , Directly search for the part related to your problem , Read it carefully , You may find that your syntax or parameters are wrong ?
Actually , quite a lot Bug It's because you don't read the document carefully !
For component libraries 、SDK、 Class library 、 plug-in unit 、API Use , I actually prefer to read official documents , More direct , Pierce to the heart of the matter .
4. Github
If you're using an open source project , Then try in the project warehouse issues Search for answers in , Especially famous projects , A lot of people use it , What you met Bug Maybe others have met .
If there is a solution, you can directly copy , Even if there is no solution , You can also try to contact and encounter similar Bug Classmate , Explore together .
5. Trace source code
In addition to dependency conflicts 、 Technical problems such as memory overflow Bug, In fact, our work is more about repairing business logic Bug. For example, make a payment function , user A Buckle the money , But there was no reaction .
Then don't bother searching online in this case , Because everyone writes different business code , multifarious . Why don't you start at the entrance of the program , use Debug Make some breakpoints 、 Print some variable information , Just debug slowly line by line .
If you suspect that something is wrong with a dependent class or method , You can also directly click in to view its source code and comments .
Ask for help
If you can't solve the problem yourself , We can only turn to others for help .
Questioning skills
Asking questions is also skillful , Want to be faster 、 Get answers more accurately , Just put your problem 、 scene 、 Ins and outs 、 Key information is provided clearly , It can also be used PasteBin Tools like sharing code , Let others better understand .
For example, I receive hundreds of private letters and questions every day , Many of them can't even describe what they want to ask , such as : Why is my website inaccessible ?
How can I help you solve this problem ? Isn't this a waste of each other's time ?
So I suggest you read 《 The wisdom of asking questions 》 This free little book , Teach you to be an intelligent questioner .
Address :https://github.com/tvvocold/How-To-Ask-Questions-The-Smart-Way
The way
After thinking about what to ask , Ask who ?
The first is the two platforms : The domestic CSDN Relatively suitable for beginners ; foreign Stack Overflow , More active 、 There will be more answers .
If it's an open source project , You can consider GitHub Put forward a new one under the project warehouse Issues , Aite team officials to solve .
If you use class libraries and services provided by others , The maintainer of the project can be found in the official documentation , Contact them and give feedback .
Besides , You can also add some professional friends 、 Add some programming communication teams and so on , It's all good .
Last , If none of the above methods can solve Bug, Then you might as well try : restart !
Restart Dafa ,Bug Can't escape . Restart is not enough , Then uninstall and reinstall ~
That's what we're sharing , I'm fish skin , Ask a give the thumbs-up , This will be the biggest driving force for my continuous creation , thank you
边栏推荐
- 高斯光束及其MATLAB仿真
- 一次 MySQL 误操作导致的事故,「高可用」都顶不住了!
- TCP three handshakes and four waves
- High quality travel on national day, visual start of smart Tourism
- hprofStringCache
- Summary of rust high concurrency programming
- Cross platform RDP protocol, RDP like protocol and non RDP protocol remote software
- How to identify information more quickly and accurately through real-time streaming media video monitoring?
- Received status code 502 from server: Bad Gateway
- How to be a web server and what are the advantages of a web server
猜你喜欢

祝贺钟君成为 CHAOSS Metric Model 工作组的 Maintainer

An accident caused by a MySQL misoperation, and the "high availability" cannot withstand it!

halcon知识:区域(Region)上的轮廓算子(2)

共建欧拉社区 共享欧拉生态|携手麒麟软件 共创数智未来

Clickhouse (02) Clickhouse architecture design introduction overview and Clickhouse data slicing design

Yuanqi forest pushes "youkuang", and farmers' mountain springs follow the "roll"?

内存泄漏之KOOM

Flutter series: offstage in flutter
![[Numpy] Numpy对于NaN值的判断](/img/aa/dc75a86bbb9f5a235b1baf5f3495ff.png)
[Numpy] Numpy对于NaN值的判断

Idea 1 of SQL injection bypassing the security dog
随机推荐
What is a virtual host server? What are the advantages?
Old popup explorer Exe has stopped working due to problems. What should I do?
共建欧拉社区 共享欧拉生态|携手麒麟软件 共创数智未来
Configuration process of easygbs access to law enforcement recorder
What should I pay attention to when choosing a data center?
Web penetration test - 5. Brute force cracking vulnerability - (3) FTP password cracking
Record a programming contest
[code Capriccio - dynamic planning] t392 Judgement subsequence
Iguard6.0 - appropriate website protection system
How to be a web server and what are the advantages of a web server
The quick login of QQ cannot be directly invoked through remote login, and the automatic login of QQ can be invoked using VNC
Summary of rust high concurrency programming
Cloud development CMS Enterprise Edition demand survey
你了解TLS协议吗?
Recording a summary of frequently asked questions
How should the server be placed?
Event id:7001: after restarting the machine, the World Wide Web failed to start automatically, resulting in inaccessible websites
How to avoid man in the middle attack (mitm)
Demonstration of C language structure function research
LeetCode 1281. Difference of sum of bit product of integer