Bitpath

Boss lesson · Unit 02

Why is it like this?

Ask the history before you remove the fence

12 exercisesabout 3 min

What you practise

  • Blame and commit messages as evidence, the fence you should not remove before learning why it is there, reading a series of commits as an argument

Try a question from this lesson

Pick one

You are tidying this paging function. Page numbers start at 1, so its second line looks pointless. What do you do first?

def page(items, n, size):
    n = max(n, 1)
    lo = (n - 1) * size
    return items[lo:lo + size]
function page(items, n, size) {
  n = Math.max(n, 1);
  const lo = (n - 1) * size;
  return items.slice(lo, lo + size);
}
function page<T>(
  items: T[],
  n: number,
  size: number,
): T[] {
  n = Math.max(n, 1);
  const lo = (n - 1) * size;
  return items.slice(lo, lo + size);
}

The idea

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

The fence

An old rule of thumb: you find a fence across a road, with no purpose you can see. Do not take it down until you know why it was put up.

In code the fence is the odd check, the strange default, the retry nobody remembers. Blame and the commit message are how you ask the person who built it.

10 more exercises in the app

  • 2× type the answer
  • 5× multiple choice
  • 1× true or false
  • 1× fill the blanks
  • 1× order the lines

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy