Welcome to pay attention to the public account “JAVA Front” to view more wonderful sharing articles, mainly including source code analysis, practical application, architecture thinking, workplace sharing, product thinking and so on, at the same time, welcome to add my wechat “JAVA_front” to communicate and learn together


1 methodology is important

In your daily work, you must have dealt with some thorny problems. In the face of these complex problems, especially when the problem is urgent, some people are completely clueless and do not know where to start, while others have clear ideas, orderly analysis of the problem, and clear action steps. Why the gap?

I think people with clear thinking have a methodology that can be applied to a variety of scenarios, allowing them to take their time when faced with a problem and eventually find the answer.

Programmers face a lot of complexity in their work. For example, when there is a problem in the system, it is difficult to see the problem at a glance due to the complexity of the system, so it is more necessary to learn the methodology to solve the problem.

In this article about how programmers can solve problems, we’ll start with a problem: suddenly web access is slow.


2 Discovering problems

We first distinguish between two concepts: representation and problem.

Representation is the manifestation of the problem. For example, if the same web page suddenly slows down, but the root cause of the problem is not the same, then the solution must be different.

The problem is the root of representation. The technician needs to find the root of the problem, and it must conform to the monistic principle that the problem can explain all the representations present in the current system.

I think the implication of discriminating the above concepts is that we should not be obsessed with representation, which is only external performance, and we need to think deeply about the problems leading to representation.

Here’s the first methodology: listing problems by representation.

Web access suddenly slows down. Is this description a representation or a problem? It’s clearly a representation.

With this in mind, the next step is to make a list of the problems that are known to cause the presentation, based on the representation. The programmer can use experience to make a list of the problems that are causing the sudden slow down of the web page. We tried to list two questions:

Problem 1: The code my colleague just modified has an error

Problem 2: A surge in traffic causes database performance problems

This step requires programmers to learn and practice a lot in the work, in order to be well-informed, and in listing the dimensions of the problem to be MECE, that is, independent of each other, completely exhausted.

Note that this article focuses on methodology. The issues listed are not comprehensive and do not involve specific technical solutions.


3 Verification Problems

Now that we’ve asked the question, it’s time to test the question, to see if we’ve asked the right question.

Here is the second methodology: the PDCA cycle.

PDCA cycle is the quality management expert Dr. Hugh hart first proposed by Deming adopted publicity, so it is also known as deming ring. Let’s introduce the concept of the PDCA cycle:

P: Plan

D: Execute (do)

C: Check

A: Handle (act)

Step 1: Present a plan. Based on the hypothesis, a plan to test the hypothesis can be put forward. Let’s test question 1. Above we guess that a colleague made a code upgrade, which caused the website to slow down. So here’s our plan: look at the release record and the code commit record.

Step 2: Execute the plan. We review the release history and code change history.

Step 3: Check the execution results. In the execution result of the previous step, no release record and code modification record were found, so this can be ruled out as the cause.

Step 4: Based on the results of the review, decide whether to deal with the problem directly or make a new plan to verify the next problem, which is to enter the PDCA cycle. At this point we should enter the loop and verify problem 2.

I think the point of this approach is to reliably validate one variable at a time, exit the loop if you find a problem, and enter the next loop if you don’t. Although each step is not big, but every step is solid.

This theory has wide application in various industries. For example, the method commonly used in scientific experiments: the control variable method. In order to verify whether a variable has an impact on the experimental results, it is necessary to keep other variables unchanged and modify only this variable to verify whether it has an impact on the experimental results.

There is also the Internet products often said minimum availability, that is, each version of the launch to meet a major core needs, based on user feedback, the next version to solve or optimize. This is rapid iteration, small steps.

The same phenomenon or practice is found repeatedly in different fields. The same law or theory has been summed up repeatedly throughout history.


4 Problem Solving

Suppose, based on the step 3 validation problem, we find that the real problem is problem 2: a sudden increase in traffic causes database performance problems.

Even if it is the same problem, there are many solutions, such as adding cache, optimizing data index, optimizing interaction flow, isolating fusing and so on for performance problems. So which solution should we choose?

Here’s the third methodology: assess the cost and effectiveness of a solution in context, treating the symptoms before the root causes.

Assume that the website is carrying out the double 11 promotion, so the highest priority is to ensure that users can normally participate in the activity, then need to choose the shortest way to solve the problem quickly, if adding an index can solve the problem, then choose this solution. To treat the symptoms first means to solve the immediate problem first.

Assuming that the user peak is over and the response time is normal, give the programmer plenty of time to fix the problem by adding a cache layer, optimizing the code, and releasing a new version.

If you find that the product interaction process does not make sense, then in the project meeting, you will raise the issue with the product manager and work together to improve the process. Large version iteration after process optimization.

Solutions are very specific and vary from place to place, addressing the symptoms first and then the root causes, depending on priorities.


5 Article Summary

Programmers think about problems in three main steps: problem discovery, problem verification, problem solving.

To find the problem, we should first distinguish between representation and problem, not be confused by representation, do not get bogged down in the mire of representation, we should think about the problems behind representation, list all the problems that may cause representation.

Validation questions are the verification or falsification of a list of questions, using the powerful PDCA cycle, which is also widely used across disciplines and industries.

Assess the cost and effectiveness of a solution in the context of a problem, treating the symptoms first, then the root cause. The problem occurs in different scenarios, and the solution with the highest marginal benefit should be given according to the current scenario.

Methodology is a very important tool. A seemingly complicated and chaotic problem can be sorted out with a proper methodology, which immediately makes the problem clear, the scheme specific and the result measurable. This is to sum up theory from practice and then use theory to guide practice.

Welcome to pay attention to the public account “JAVA Front” to view more wonderful sharing articles, mainly including source code analysis, practical application, architecture thinking, workplace sharing, product thinking and so on, at the same time, welcome to add my wechat “JAVA_front” to communicate and learn together