Sub topic 1
What counts as a habit
Prerequisites
This chapter assumes you are comfortable with everyday routines and goals. You do not need any background in psychology or programming. The short code examples are optional and use plain Python.
What a habit is
A habit is a behavior that you repeat in a similar situation until it starts with little thought or effort. You do not decide to do it each time. The situation triggers it.
Think of reaching for your phone when you sit on the train, or locking the door as you leave home. In both cases the setting prompts the action before you have weighed any options.
Three features mark a habit:
- Repetition. The behavior has been done many times.
- A stable context. It happens in a similar place, time, or situation.
- Automaticity. It starts quickly, with little deliberate effort and often little awareness.
Habit versus goal-directed action
A goal-directed action is chosen for an outcome you have in mind right now. A habit is run by the context. The same behavior can be either one, depending on how it is started.
| Question | Goal-directed action | Habit |
|---|---|---|
| What starts it? | A decision to reach an outcome | A familiar situation |
| How much effort does starting take? | Noticeable | Low |
| Does it change if the outcome stops mattering? | Usually, quickly | Often not, at first |
| Example | Looking up a bus timetable for a new trip | Walking to your usual bus stop |
The last row of the table before the examples matters most. If a habit is strong, you may keep doing it after you stop wanting what it used to give you.
Checking whether a behavior is a habit
Ask these questions about a behavior you already do:
- Do I do it in about the same situation each time?
- Does it start without a fresh decision?
- Would I feel that something was missing if I skipped it?
If you answer yes to most, it is probably a habit. Many behaviors sit in between. A new exercise routine you still have to talk yourself into is not yet a habit, even if you do it often.
The code below describes one habit as a sentence that names its situation, behavior, and payoff. The next chapter breaks this pattern into its three parts.
from dataclasses import dataclass
@dataclass
class HabitLoop:
cue: str
routine: str
reward: str
def describe(self) -> str:
return f"When {self.cue}, I {self.routine}, so that I get {self.reward}."
walk = HabitLoop(
cue="I finish my morning coffee",
routine="walk around the block",
reward="a few minutes of fresh air",
)
print(walk.describe())Exercise
You go to the gym every Monday because you decide each week that it is worth the effort, and you often argue yourself into going. Is this a habit? Give one reason.
Show answer
Not yet. Although it is repeated, it starts with a fresh decision and effort each time instead of being triggered automatically by a stable situation.
Exercise
Name one behavior you do automatically and the situation that starts it.
Show answer
Any behavior that starts without a fresh decision fits. For example, washing your hands (behavior) whenever you come in the front door (situation).