Scaffold Your Solution

One of the keys to working efficiently is to manage cognitive load - the amount of information your brain handles at any given moment. We find there are two very important rules that will help you keep a clear head:

  1. Use cognitive tools like clear code, good habits, useful diagrams, careful planning, and isolation techniques to lighten the load on your working memory.
  2. Don't work on anything you can't hold in your head all at once.
    • If you find there's too much going to keep straight, you probably did a bad job with # 1.

Building a scaffold for your solution before attempting to pass any tests will go a long way towards lightening your mental workload. A well-designed scaffold will:

  • Promote breaking down large challenges into smaller ones
  • Isolate independent elements of your solution
  • Guarantee your solution has the right structure
  • Defend against certain types of logic bugs
  • Enable you to break up your work time without losing track of where you are
  • Writing readable solutions
  • Encourage good design habits by committing to them ahead of time
  • Prepare you for TDD

Designing your scaffolding is tricky, it will require time and experience before you can expect to do it quickly. Here are a few suggestions to get you started:

  • Develop your scaffolding in a Gist, adding a new file for each iteration.
  • Begin by naming your function, writing in all arguments, declaring an empty return value, and returning the empty value.
  • Build your scaffolding in small steps, converting your solution pseudocode into real code whenever you can.
  • Your scaffolding will consist largely of control flow (ie. loops, conditionals, and short procedures)
  • Stop each time you have isolated the lines of code that will implement a test category. Put in a comment indicating what logic goes there for later on.

Resources



results matching ""

    No results matching ""