do Android It's been more than six years since development , From a little white who doesn't know anything about it to an old bird who can take charge of his own affairs now , It has experienced many pits , Before always Baidu , Ask for the help of others to solve the problem , Now I feel more and more , In fact, there are many ways to solve problems , The most important thing is through continuous practice , Keep summing up , Quick positioning problem , solve the problem , Form your own way to solve problems , method , So that they can be promoted .

 
I don't know what you think of a thorny problem , I've had this kind of problem before , I'm in a hurry , Always want to pass Baidu , Ask someone else to solve it , It turns out that this idea is useless at all , Your own problems , No one else has an obligation to help you , Things from Baidu , It's always different from what you want , Later, when I solved more and more problems , find , In fact, the problem is not as difficult as you think , Change your mind , In fact, if you solve this problem , It's a promotion for yourself , Self confidence is also an improvement , There will be no fear of difficulties in the future , In time, it didn't work out in the end , It's also a kind of exercise for yourself . get down to business , Let's talk about some problems I encountered in my work , And how to deal with these problems .

  1. Quick positioning problem

 
We are often at work , There are some problems , For example, I feel , The code is clear that there is no problem ( Don't think about it , There is a problem ), How can you get the result you don't want . This is suitable for the inevitable problem , Or the high probability occurrence problem ( In fact, it is inevitable , It's just that we didn't find the necessary path ), What happens is that the value returned by the parameter is incorrect , The effect of the display is not equal . The easiest way to do this is to look at where assignments and calls are made , Because it happened , It's in places you can't imagine , Method was called one more time , Or write the value one more time . I usually have this kind of problem , It's when you assign a value , Where to call , Print some logs , Or in the reading and writing places debug, The cause of the general problem will be found , So as to solve the problem .

 
Occasional problems , The probability of occurrence is relatively low, and the problem is solved , This one , I've met a lot , I now work on the development of the machine , There may be no problem on the phone , There's something wrong with the car , Often the problem is to look at the code , I can't see the problem . Such problems , We need to analyze the code ,review once , Add some logs where problems may occur , Try to reproduce , This kind of problem is very often , It's a way , parameter , Call timing , It was caused by the wrong conditions , I have this problem, and the solution is , What I think is wrong , Add the error code , See if the problem can be repeated , If it reappears , It's probably the reason for this . For example, we will encounter one , Method explicitly calls the ,debug If you go in, it doesn't work , The problem is not what we think it is , It turns out that something else went wrong ( For example, not UI Thread called refresh UI Methods ).

 
UI Display problem , For example, I wrote a layout , Why is it wrong , This is a lot of time , Some parameters are not set correctly , Other layout impacts , Don't ignore what margeStart Properties like this can also affect the current layout , This kind of problem is very often , Some properties are often set incorrectly , The best way is , Write it as a fixed value , Especially large value , See if it works , This will locate the cause of the problem .

  2. Most easily overlooked

 
We often solve problems , What is often the easiest to ignore , First, it must be based on our source code , First of all, we need to analyze it , Is there a problem , The logic is unreasonable , Sort out the code ( A lot of the time when we develop projects , It's often developed by several people , The code may not have been written by itself , The first is to understand other people's code , To solve the problem ), And then analyze the problem , Log, especially error log information ( It mainly refers to those that are not very obvious error Level error log ), We often add TAG, Filter the log , But some error logs may have caught them , We don't pay attention and often miss it , What's the problem , Error logs must be carefully analyzed , Often the problem is , Easy to ignore .

  3. What to do if you have a tough problem

  first , Put yourself in a good mood , Calm down to solve problems , An unsolvable problem , Don't think about it , Lower your expectations .

  second , There must be a time limit to the work assigned , Don't spend too much time on one solution , We should make good use of our time .

 
third , Based on current conditions , Find the best solution , For example, make a demand , Time is tight , first , What you have to do is , Look for similar information on the Internet , wheel , The simpler the better , Because it must be changed in the future , It's too complicated. It takes time to understand it .

fourth , Don't think about it , take your time , Step by step , The most important thing is to have an effect , Like the question , You must analyze the problem clearly , Will you do the effort , Try to solve the problem , get ready , The boss asked you , You can tell him, too , On demand , The simplest effect must be made , Even if there is a problem , If you can't do it at all .( Only when there is a plan can we follow this plan to solve the problem ).

  fifth , I believe I can solve it , Analysis code , view log , Solve problems in the most primitive way , In the end, it will be solved .

 
Talk about yourself and develop another one IOS Problems encountered in the project , I have another requirement, that is, after a control is rotated , stretching , move view It can operate normally , I thought that after the rotation, I called the original method directly , Later we find that there will be problems , At the beginning, I thought that I could find a similar solution on the Internet , I found out in the back , No, , There are also different from what you want , no way out , You just have to be tough , First, analyze the problem , Comment out the useless code , Leave the simplest , stretching , A lot of logic is removed , That leaves a basic stretch view method , Give it a try , sure , Discover new problems , solve , And then think about saving and restoring , Think of one last way , Record the coordinates before rotation , size , Then rotate the restore , Then there are all kinds of thinking about how to coordinate transformation , Try it step by step , New problems arise , solve the problem , Little by little , Until it's done . When you're done with this , I found that the problem is to try and try , Solve the implementation of , We must try boldly , The pattern may not be obvious at first , Do it bit by bit , It's more and more clear . We must try boldly , simplify what is complicated .

  To sum up , Have a good attitude when facing problems , Summarize more , reflect , Positioning problem , call , The place of assignment is the most important , Try boldly when problems arise , Abstract to concrete , Error logs cannot be ignored , Based on current code , solve the problem .

  The above is a summary of personal development experience , Have good experience also can comment to share , Thank you for reading .

 

Technology
©2019-2020 Toolsou All rights reserved,
One is called “ Asking for the train ” A small village Finally got the train Spring Boot Lesson 16 :SpringBoot Implementation of multithreading with injection class Chrome OS, For programmers and Windows What does it mean ? Internet Marketing JAVA Convert a string to a numeric type I've been drinking soft water for three years ? What is the use of soft water and water softener You don't know ——HarmonyOS Talking about uni-app Page value transfer problem JavaScript Medium Call and ApplySparkSQL Achieve partition overlay write Character recognition technology of vehicle license plate based on Neural Network