Urgent.News

What's breaking now, across thousands of outlets.

Tech

21 Days to Build a Coding Habit? The Real Study Found 66. Some People Needed 254.

The "21 days to form a habit" rule came from a plastic surgeon watching people get used to their new noses. Not from a lab. Not from a habit study. From a preface. I went looking for it because I'd tried the 21-day thing twice with a daily LeetCode habit, and both times I quit somewhere around week four, feeling like I'd failed a test everyone else passes. Turns out the test was made up. Where 21…

The well-known "21-day rule" for forming a habit originates from plastic surgeon Maxwell Maltz's observations of people adjusting to new features of their bodies. However, this figure did not stem from scientific research, but rather from his preface in a self-help book. The concept gained popularity over time and became a widely accepted belief.

In 1960, Maltz wrote in his book Psycho-Cybernetics that it usually takes about 21 days to create a noticeable change in one's perception. He cited examples such as patients getting used to a new face after surgery, the phantom limb sensation after amputation, and people finding a new house to feel like home.

A more rigorous study conducted by Phillippa Lally and colleagues at University College London aimed to measure the actual time required to form a habit. They recruited 96 volunteers who each chose a small healthy behavior, such as drinking water with lunch or running for 15 minutes before dinner. Participants rated how automatic the behavior felt on a daily basis for 12 weeks.

The results showed a gradual increase in automaticity over time, with a median time of 66 days to reach 95% of the plateau. The range of times varied from 18 to 254 days.

Interestingly, missing a single day did not have a significant impact on the habit formation process. The curve of automaticity continued regardless of missed days. However, approximately half of the participants did not engage consistently enough to reach the desired automaticity level. This study suggests that forming a habit can take anywhere from a few weeks to several months, with the median duration being around two months.

The underlying mechanism behind habit formation involves the brain's adaptation to repetitive actions. In 1999, Ann Graybiel's lab at MIT recorded neurons in the striatum, a brain region, while rats learned a T-maze. Initially, the neurons fired during each run, indicating active engagement. As the runs became automatic, the brain's activity pattern changed, consolidating the routine into a single chunk that could be triggered by context.

This process, called "task-bracketing," allows for faster and more efficient execution of the habit.

In the context of coding habits, the curve of automaticity represents the brain's adaptation to repetitive coding tasks. During the initial weeks, the brain pays close attention to each line of code, akin to line-by-line compilation. Over time, the routine becomes more streamlined, and the brain stops processing the middle steps. This consolidation of the habit process is what the "66-ish" days represent.

To successfully establish a coding habit, the research suggests attaching the practice to a specific cue, such as opening the laptop or finishing a daily task. The cue should be consistent and occur at the same place and time each day. Additionally, the habit should be small enough to be manageable even on bad days, ideally lasting around 10 minutes.

It is essential to plan for a period of two months rather than three weeks, as forming a habit can take longer than initially anticipated. If a day is missed, it is recommended to simply resume the habit on the following day, as a single missed day does not significantly affect the overall process.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

pdfjs-dist standard_fonts Missing in Next.js standalone

The short version pdfjs-dist's standard_fonts/ is read in a way Next.js file tracing cannot follow, so it can go missing from an output: "standalone" build. The effect of the omission is quiet.

  • pdfjs-dist missing standardfonts in Next.js standalone build
  • Causes text extraction from PDFs to break without exception
  • Explicitly state standardfonts in Next.js config to resolve

One clip-path doubled my browser cat's CPU cost in Chrome's GPU process

I made Tabloaf , a pixel cat for Chrome and Firefox. It walks across whatever page you have open, sits on pictures and headings, and chases a ball of yarn.

  • Chrome's GPU process increased from 15-17% to around 7% due to clip-path feature
  • Firefox's page process dropped from 19-20% to approximately 2% after optimizations
  • Optimized Tabloaf maintained consistent 17.5 ms frame time with no frame exceeding 20 ms

More from Thursday 19 November →