reading-notes


Project maintained by Razan-am Hosted on GitHub Pages — Theme by mattgraham

Solving Problems

Common mistakes when start solving problems

A simple set of steps to follow

  1. Read the problem completely twice.

You want to make sure you completely understand the problem, a good test of this is whether or not you can explain the problem to someone else.

  1. Solve the problem manually with 3 sets of sample data.

It’s very important that when you solve a problem manually, you recognize what your brain is actually doing to solve the problem.

  1. Optimize the manual steps.

For this step you want to do here is figure out if there is another way you can solve the problem easier, or if there are some steps you can cut our or simplify.

  1. Write the manual steps as comments or pseudo-code.

Here you want to do here is capture all the steps we created and now either put them into our editor as comments or write them as psuedo-code that we can translate to real code.

  1. Replace the comments or pseudo-code with real code.

All we do here is take each comment and convert it into a real line of code.

  1. Optimize the real code.

It’s to make sure all your variables are named with long meaningful names.

===================================================

Act like you make $1000/hr

How you value your time is how you value your life

How do you value your time?

===================================================

How to think like a programmer

“Everyone in this country should learn to program a computer, because it teaches you to think.” — Steve Jobs

Essentially, it’s all about a more effective way for problem solving.

So, what should you do when you encounter a new problem?

  1. Understand: Know exactly what is being asked. Most hard problems are hard because you don’t understand them hence why this is the first step
  2. Plan: Don’t dive right into solving without a plan and somehow hope you can muddle your way through Plan your solution!
  3. Divide: Do not try to solve one big problem at once. Instead, break it into sub-problems. These sub-problems are much easier to solve. Then, solve each sub-problem one by one. Begin with the simplest.
  4. Stuck?: Do these steps:
    • Debug: Go step by step through your solution trying to find where you went wrongProgrammers call this debugging.
    • Reassess: Take a step back. Look at the problem from another perspective. Is there anything that can be abstracted to a more general approach?
    • Research: No matter what problem you have, someone has probably solved it,Find that solution.
  5. Practice: If you want to be a good problem-solver, solve a lot of problems!

===================================================

The 5 Whys

When to Use a 5 Whys Analysis

How to Use the 5 Whys

  1. Assemble a Team: Gather together people who are familiar with the specifics of the problem, and with the process that you’re trying to fix.
  2. Define the Problem: observe the problem in action. Discuss it with your team and write a brief, clear problem statement that you all agree on.
  3. Ask the First “Why?”: Ask your team why the problem is occurring.
  4. Ask “Why?” Four More Times: ask four further “whys” in succession. Each time, frame the question in response to the answer you’ve just recorded.
  5. Know When to Stop: You’ll know that you’ve revealed the root cause of the problem when asking “why” produces no more useful responses, and you can go no further. An appropriate counter-measure or process change should then become evident.
  6. Address the Root Cause(s): when identified at least one root cause, you need to discuss and agree on the counter-measures that will prevent the problem from recurring.
  7. Monitor Your Measures: Keep a close watch on how effectively your counter-measures eliminate or minimize the initial problem.

References:

@By John Sonmez/How to Solve Programming Problems

@By Anthony Moore/Pretend Your Time is Worth $1,000/Hour and You’ll Become 100x More Productive

@By Richard Reis/How to think like a programmer — lessons in problem solving

@By The Mind Tools/5 Whys