Lesson 1 · Unit 03
What to look for
Correctness, design, tests, then taste
What you practise
- Correctness, then design, then tests, then readability, then nits
- What automation should catch instead
- The size a review can really cover
Try a question from this lesson
Pick one
The rule: orders of 100 or more get 10 off. You may leave one comment on this function. Which one matters most?
def calc(x):
if x > 100:
return x - 10
return xfunction calc(x) {
if (x > 100) {
return x - 10;
}
return x;
}function calc(x: number): number {
if (x > 100) {
return x - 10;
}
return x;
}Correct answer
An order of exactly 100 gets no discount
Why
The names are poor, and that is worth a later comment. But a customer who spends exactly 100 is charged 10 too much today. Correctness comes first: a wrong result costs users, a vague name costs readers.
TypeScript noteThe annotation number is satisfied by a right and a wrong boundary alike. Types catch the wrong kind of value, never the wrong value.
The idea
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
What to look for, in order
Review attention is limited, so spend it in order of cost.
1. Correctness: wrong results, lost data, security. 2. Design: is this the right place and shape? 3. Tests: do they prove the claim? 4. Readability: names, structure, comments. 5. Taste.
A bug costs users. A matter of taste costs nobody.
10 more exercises in the app
- 1× order the lines
- 4× multiple choice
- 2× type the answer
- 2× true or false
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.