Solving Problems
Common mistakes when start solving problems
- You really want to make sure you take enough time to understand the problem completely before attempting to solve it. No to start writing code as soon as possible.
- Another big mistake is trying to over solve the solution on the first iteration. Keep it simple, don’t try to get fancy.
A simple set of steps to follow
- 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.
- 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.
- 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.
- 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.
- 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.
- 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
-
So many people waste much of their time on pointless, low-quality activities that don’t help them reach their true goals.
-
And most people value their time at far, far less than it’s worth.
-
They say yes to things they have no business doing. They give away their talents, attention, and effort to others who take, take, take.
-
They spend hours watching low-quality television and social media when they should be productive and effective.
-
See, many people could be making a fortune if they used their time well…but instead, they give away their time in unproductive ways that leave them broke, unhappy, and stuck.
-
In reality, a lot of people are living a frenzied, busy life. They wear their business as a badge of honor, and brag about their full schedules. And most people prefer the little dopamine boost of checking boxes on a to-do list than actually getting important work done.
How do you value your time?
- Take stock of the things you did this week. How many of them were worthy of $1,000/hour?
- How many activities were a true waste of time?
- Value your time at what it deserves to be,
The higher the value, the more important and productive work you’ll do — and the less trivial and mindless tasks you’ll get caught in.
===================================================
How to think like a programmer
- If you’re interested in programming, you may well have seen this quote before:
“Everyone in this country should learn to program a computer, because it teaches you to think.” — Steve Jobs
- You probably also wondered what does it mean, exactly, to think like a programmer? And how do you do it??
Essentially, it’s all about a more effective way for problem solving.
So, what should you do when you encounter a new problem?
- 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
- Plan: Don’t dive right into solving without a plan and somehow hope you can muddle your way through
Plan your solution!
- 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.
- Stuck?: Do these steps:
- Debug: Go step by step through your solution trying to find where you went wrong
Programmers 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.
- Practice: If you want to be a good problem-solver,
solve a lot of problems!
===================================================
The 5 Whys
- The 5 Whys uses
counter-measures,rather than solutions. A counter-measure is an action or set of actions that seeks to prevent the problem from arising again, while a solution may just seek to deal with the symptom. As such, counter-measures are more robust, and will more likely prevent the problem from recurring.
When to Use a 5 Whys Analysis
- You can use 5 Whys for troubleshooting, quality improvement, and problem solving, but it is most effective when used to resolve simple or moderately difficult problems.
How to Use the 5 Whys
- 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.
- 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.
- Ask the First “Why?”: Ask your team why the problem is occurring.
- 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.
- 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.
- 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.
- 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