Strategies for effective problem solving
1. Always have a Plan
- You should have a plan how you are going to find solution
- The plan may be altered along the journey or you may abandon your original plan and make another one
- Planning allows you to set intermediate goals and achieve them.
- Without a plan you have only one goal, solve the whole problem. Until you have the entire problem solved you will feel frustrated.
- So create a plan with series of minor goals, then you will make measurable progress towards a solution and feel that your time been spent usefully.
- At the end of each work session, you'll be able to check off items from your plan and gain confidence that you will find a solution instead of getting increasingly frustrated.
2. Restate the Problem
- In some cases, a problem that looks very difficult may seem very easy when restated using different terms.
- Restating a problem allows you to check out the problem from every angle to see if there is an easy solution.
- Restatement sometimes shows us the goal was not what we thought it was.
- If a problem is assigned to you (by supervisor or instructor), you can take your restatement to the person who assigned the problem and confirm your understanding.
3. Divide the problem
- Finding a way to divide a problem into steps or phases can make the problem much easier.
- If you divide the problem into two pieces, you might think that each piece would be half as difficult to solve as the original problem, but usually, it's even easier than that.
- For example: Insertion Sort Vs Merge Sort, divide and conquer.
4. Start with What You Know
- When programming, you should always try to start with what you already know how to do and work outward from there.
- Divide the problem up into pieces and complete any pieces that know how to code already.
- Having a working partial solution may spark ideas about the rest of the problem.
- A common theme in programming is making useful progress to build confidence that you will ultimately complete the task.
- By starting with what you know, you build confidence and momentum toward the goal.
- Always try to use your brain to think what parts of the problem can be solved with the tools(skills) that you already know before trying to get more tools.
- This technique follows a plan and gives the order to our efforts. When we begin our investigation of a problem by applying the skills we already have, we may learn more about the problem and its ultimate solution.
5. Reduce the Problem
- You reduce the scope of the problem, by either adding or removing constraints to produce a problem that you do know how to solve.
- To solve the original problem, we will eventually need the skills involved in both reductions. Even so, reduction allows us to work on a simpler problem even when we can't find a way to divide the problem into steps.
- By writing code to solve each individual aspect of the problem, programmers see how to combine the various pieces of code into a unified whole.
- Reducing the problem also allows us to pinpoint exactly where the remaining difficulty lies.
- If you need assistance from an experienced programmer, you should be able to describe the progress you have made towards the solution to the experienced programmer.
6. Look for Analogies
- An analogy is a similarity between a current problem and a problem already solved that can be exploited to help solve the current problem.
- Sometimes two problems can be really same, other times it is not the case.
- It is a difficult skill to build because you can't look for analogies until you have a storehouse of previous solutions to reference.
- Beware there is good and bad software reuses.
- Sometimes the best way to progress is to try things and observe the results.
- Experimentation is not same as guessing.
- An experiment is controlled process; you hypothesize what will happen when certain code is executed, try it out, and observe if the hypothesis is correct.
- From these observations, you gain information that will help you solve the original problem.
8. Don't get frustrated
- The final technique isn't so much a technique, but a maxim: Don't get frustrated.
- When you are frustrated you can't think clear, work efficiently.
- Frustration feeds itself.
- You allow yourself to get frustrated; you are in effect giving yourself an excuse to continue to fail.
- Take a break, or work on a different problem, solve that and build confidence.
ALWAYS PLAN, DIVIDE THE PROBLEM, REDUCE THE PROBLEM, START WITH WHAT YOU KNOW, AND EXPERIMENT.
Please let me know if you can think of additional problem solving techniques.