Class one reading notes

code 102 notes


Class one reading notes

How to solve programming problems

Common mistakes

  • improper allocation of time
    • understand the problem before writing code
    • keep it simple
  1. Read the problem completely twice.
  2. Solve the problem manually with 3 sets of sample data.
  3. Optimize the manual steps.
  4. Write the manual steps as comments or pseudo-code.
  5. Replace the comments or pseudo-code with real code.
  6. Optimize the real code.

Read the problem completely twice

  • most important step
  • read the problem many times when necessary
  • if you can’t understand the problem you can’t solve it
  • nothing can be automated that cannot be done manually

How to think like a programmer — lessons in problem solving

  1. Understand
  2. Plan
  3. Divide
  4. Stuck? Practice.

5 Whys: Getting to the Root of a Problem Quickly

  • used for troubleshooting, quality improvement, and problem solving
  • Counterintuitively, 5 whys involves seven steps:
    1. assemble the avengers
    2. define the problem if you can
    3. ask the first why: why is the problem occurring?
    4. For each answer generated during step 3 ask ‘why’ four more times - not unlike a child who asks why repetitively
    5. Unlike the child, know when to stop asking why
  • the five in 5 whys isn’t really important
  • go further than assigning blame
  • develop countermeasures
    1. Address the Root Cause(s)
    2. Monitor your measures

Lecture Notes

Node Runtime

  • Runtime is a place for code to run
    • most of the time JS runs in the browser
    • somethings can be done only in the browser, some can be done in node
  • Node has different concerns than the browser
    • Node gives the developer a lot more power
    • What is my computer doing (and other machines) > what is the browser displaying