Programming is a problem solving activity. When you write a program, you are actually writing an instruction for a computer to solve some problem. Overtime, there are several strategies that have been developed and applied to solve problems. Problem solving is the processing of transforming problem from initial state to a desired state. Some techniques are more effective while others are less. Here I outline some of the common strategies
Trial and Error – This is also known as solving problems using guess and check or generate and test. While it is certainly true that we don’t want to simply guess random answers as a means of solving problems, there are instances when educated guesses are important, valid and useful. For instance estimating the time an activity will end is an example of an informed guess. This techniques works like this:
- Form an educated guess
- Check your solution to see if it works and solves the problem
- If not, revise your guess based on whether it is too high or too low
Root Cause analysis – a sequence of cause and effect is investigated until the origin of the problem is identified. Root Cause Analysis (RCA) is a systematic concept that involves a set of problem-solving approaches used to determine the underlying cause of an issue. In most cases, when a problem occurs, it creates other problems and resulting problems create others. For instance, in one of the software systems we discovered that some parts of the system were becoming very slow. On further analysis, the page was loading too much data. On further analysis the users where not closing the visiting, leaving many data points to be queried. So a possible solution was to close the visits programmatically after some time. The alternative solution could have been to add more RAM and processing power to the computers. Tools that can help in carrying out effective root cause analysis include the 5 WHY and the Fish Bone Diagram.
Algorithms – in this approach one defines set of step-by-step procedures that provides the correct answer to a particular problem. By following the instructions correctly, you are guaranteed to arrive at the right answer. An algorithm provides specific rules that guarantee a solution.
Brain Storming – Here the methods works by collecting a large number of ideas until one works. Some of these ideas can be crafted into original, creative solutions to a problem, while others can spark even more ideas.
Analogies – Here we compare parallels and make analogies to some other fields where the problem can easily be understood. An analogy is an abstract parallel between two quite different things. For example, you might analogize driving to project management. In both cases it helps to have a map (i.e., a plan) for where you’re going. An analog is a comparison between two objects, or systems of objects that highlights aspects in which they are thought to be similar. Analogical reasoning is any type of thinking that relies upon an analogy. Note that analogy is a cognitive process in which the problem solvers reason through the relationship between the prior experience and the current problem. There are three steps to
- Mapping step
- Application Step (Inference Step)
- Learning Step
Challenges with this approach include ability to find relevant analogies and ability to resist false counter-suggestions that would destroy the analogy.
Working backwards – Working backwards is to start with the final solution and work back one step at a time to get to the beginning. This process will include the following –
- Work back through the logic of what is causing the problem, using the 5WHY’s process or any information that may be relevant, to the ‘resources’ that are driving it.
- Look at the history of the events that have brought the situation to its current level.
- Sketch out how you think a solution for the future might work, by changing the input flows and working through what could happen to input and output levels.
This technique works well when
- The final result is clear and the initial portion of a problem is obscure.
- A problem proceeds from being complex initially to being simple at the end.
- A direct approach involves a complicated equation.
- A problem involves a sequence of reversible actions.
Means End analysis – In this technique aims to apply sequence of transformations that directly target the end state. As described, a problem exists in a current state (initial state) that must be transformed to arrive at given final state. So one might look at the current state, identify the differences between the current state and final state and then keep on providing solutions to the differences. For instance, start at initial state and then create every possible permutation from my initial state. The next step is to calculate the difference in the states just made and end state. In summary:-
- Identify your current state,
- Identify where you want to be (your goal state),
- Identify the means that will get you there.
Brute force – Here we systematically try all possible solutions until one of them works. For instance if I know that pin number to unlock a phone is 4 digits, then I can try all the possible 4 digit combinations because the pin is one of them. This approach works where the solution space is well known and can be traversed in reasonable amount of time. The approach also requires checking each of the possible solution whether it is correct or not.
Hill Climbing – This technique involving choosing any available option that moves you closer to the solution. One challenge with this approach is that the chosen move may appear to move closer to the solution but is incapable of progressing to final solution. We call this getting stuck at local maxima. Local maxima are states that are closer to a goal than any neighboring state but they are not a goal state.
In conclusion, the different strategies outlined above, fall under two broad categories of Algorithmic approaches and Heuristic approaches. Hill climbing, brute force, trial and error, means ends analysis, working backwards all belong to the heuristic strategies because they lack systematic step by step procedures that guarantee a solution all the time. Algorithmic problem solving is more common in computer programming and several algorithms such as bubble sort and binary search among others that solve specific problems.
5,844 total views, 2 views today