1. Use log to print information of interest.
2. Print the call stack of the Method
Package COM. jue. test; public class testmain {public static void main (string [] ARGs) {test ();} Private Static void test () {system. out. println ("Test start"); new exception (). printstacktrace (); system. out. println ("test end ");}}
3. Half-Lookup
After a problem occurs, you can considerCodeBlock all, and test again to see if it is normal. If it is normal, it indicates a. Otherwise, it indicates B.
- The blocked code is not the cause of the problem. You need to consider other aspects.
- The blocked code is where the problem exists. You can use the half-lookup method to find the cause recursively.
4. A new demo Test
In a relatively large project, you can write a demo separately when it finds that a function is not useful. The demo has the following meanings:
- Clean (this demo only contains the parts we are interested in, which reduces other factors that affect it and can better locate problems)
- Testing and debugging is more convenient (small demo, more efficient to handle)
5. Historical Regression
For a problem that does not exist before, you can choose to restore the previous version, and then perform a search test until the problem is found.
6. Tools
There are many professional tools for different measurements to help you find problems easily. (For example, memory leak, you can use mat for help analysis and debug Debugging Using the debug tool)
7. Go out for a walk
When you go out and relax, it also helps you analyze the problem.
8. Positioning of background changes
For a problem, such as the UI, when you find that changes to attributes are always ineffective, you can consider changing the background color of the UI, whether the UI is an object we are modifying. We can also assign different colors to some UIS to observe whether they exist, their size, and changes.
9. Network
ProfessionalCommunityTo see if there are any similar issues.
10. Consult with colleagues
Colleagues may:
- This is best if you have encountered a similar problem.
- My colleagues have good technical skills. I think deeply and come to the conclusion that this is also very good.
- Colleagues and outsiders may think differently from their long-term thinking, and may be able to pinpoint the problem.
11. clarify ideas
- What is this?
- What can this thing do?
- How does this thing work?
12. Pay attention to some abnormal scenarios
When a problem occurs, pay attention to other exception scenarios. These exception scenarios may be the key to the problem.