Engineering Topics - 401-advanced-javascript-aimurphy/seattle-javascript-401n13 GitHub Wiki
How to Solve Programming Problems
- Read the problem completely twice.
- this means to measure twice cuts once.
- Solve the problem manually with 3 sets of sample data.
- noting can be automated if it cannot also be done manually, break down those steps.
- Optimize the manual steps.
- clean up the steps you just broke down, make them succinct
- Write the manual steps as comments or pseudo-code.
- write out the steps into the way you would code it
- Replace the comments or pseudo-code with real code.
- code it
- Optimize the real code.
- now clean up that code
Be More Productive by Valuing Your Time
Busyness and focus are not the same thing, in fact busyness and busy work are your enemy. They cause stress and steal your focus... You know this: "If you don't manage your time, it will manage you". So, make sure your prioritize those choices.
People will also treat your time the same way you value it, so make sure YOU are valuing it. You become what your are and you attract what you are looking for... make sure you are truly embodying these things otherwise you will be tired and unhappy and a magnet for the same.
And sometimes you have to draw the line and say NO.
“The difference between successful people and really successful people is that really successful people say no to almost everything.” -Warren Buffet
“People think focus means saying yes to the thing you’ve got to focus on. But that’s not what it means at all. It means saying no to the hundred other good ideas that there are. You have to pick carefully. I’m actually as proud of the things we haven’t done as the things I have done. Innovation is saying no to 1,000 things.” -Steve Jobs
Reflect: are you living in a frenzy? Most of us are, and although it's nice to get that dopamine hit from checking off your boxes, how many of those were actually worth your while? Focus on what is important.
“Living in frenzy is a sign we’ve squandered too much.” -Niklas Goke
Think Like a Programmer
“Everyone in this country should learn to program a computer, because it teaches you to think.” — Steve Jobs
Rather than diving in and repeating with trial and error until you luck out, we can try this: start with a framework and practice it. So first, choose the right framework. Here are some basic step we can all agree are good: Understand, do you clearly understand the task and can you explain it? Plan, create a plan before oyu hack away, think, "given x how do I get output y?" and comment the crap out of it in your editor Divide, break your problem into smaller bites, solve, and reconnect.
“If I could teach every beginning programmer one problem-solving skill, it would be the ‘reduce the problem technique.’ For example, suppose you’re a new programmer and you’re asked to write a program that reads ten numbers and figures out which number is the third highest. For a brand-new programmer, that can be a tough assignment, even though it only requires basic programming syntax. If you’re stuck, you should reduce the problem to something simpler. Instead of the third-highest number, what about finding the highest overall? Still too tough? What about finding the largest of just three numbers? Or the larger of two? Reduce the problem to the point where you know how to solve it and write the solution. Then expand the problem slightly and rewrite the solution to match, and keep going until you are back where you started.” — V. Anton Spraul
IF you hit a snag Take a deep breath, because here is where you get smarter. Yay for you! Debug Take it step by step and talk to the duck. Reassess, try a new perspective, change your point of view. Sometimes we are too familiar with what we are doing we need to step back to see better. Research, Google it.
Repeat!, Practice, practice, practice! Good Practice makes perfect!
Problem-solving with 5 Whys and 5 Hows*
This is a method for peeling away the symptoms to get to the true root of the problem by asking "why?" 5 times, and then formulating the solution through asking "how?" 5 times. Caveat: you need to ask the right questions.
"If you don’t ask the right questions, you don’t get the right answers. A question asked in the right way often points to its own answer." -Edward Hodnet, a British poet
How do we do this? At the top of a page, put your goal (the problem or solution you are exploring) in a box. From there, write out 5 whys and corresponding 5 how and flesh them out.
*Needs more practice.