Why I No Longer Code Past 9 PM

Recognizing Cognitive Limits and Their Consequences

Ken's Programming Musings • Things I've Learned Hard Way
21:00

cutoff time that changed everything

There's something almost romantic about late-night coding sessions, isn't there? world grows quiet, distractions fade away, and it feels like you're communing directly with machine. For years, some of my most productive hours happened between 10 PM and 2 AM, when Oregon Coast was wrapped in fog and my ADHD brain could finally focus without ping of notifications pulling me in seventeen different directions.

But romance, as it turns out, has a way of blinding us to reality. And reality is this: tired programmers write terrible code.

Night That Changed Everything

It was a Tuesday in February. I'd been wrestling with a particularly stubborn authentication bug for most of day, and as evening crept in, I felt that familiar pull. "Just a few more hours," I told myself. "I'm so close to cracking this."

By 11:47 PM, I was convinced I'd found solution. By midnight, I was implementing what felt like elegant, clean code. By 1:30 AM, I was pushing to production, satisfied with a job well done.

next morning, I woke up to seventeen Slack messages and a email subject line that made my stomach drop: "Authentication system completely broken - users can't log in."

What I had written in my sleep-deprived state wasn't elegant code. It was a digital disaster masquerading as a solution. I had somehow managed to introduce three new bugs while fixing one, created a security vulnerability that made our CISO's eye twitch, and written comments that read like ramblings of someone who had clearly lost touch with reality.

Science of Tired Brains

That disaster sent me down a research rabbit hole (because yes, even my learning happens through rabbit holes - thank you, ADHD). What I discovered about cognitive fatigue and programming performance was both fascinating and horrifying.

Cognitive Load Reality Check

  • ~ Working Memory Capacity: Drops by up to 40% when we're cognitively fatigued
  • ~ Problem-Solving Ability: Becomes increasingly rigid and narrow-focused
  • ~ Error Detection: Our ability to spot our own mistakes plummets dramatically
  • ~ Code Review Skills: We start seeing patterns that aren't there and missing ones that are

For someone with ADHD, these effects are amplified. My brain, which already struggles with executive function and attention regulation, becomes even less reliable when running on fumes and caffeine. It's like trying to perform surgery with oven mitts on.

False Economy of Night Coding

Here's what I thought was happening during those late-night sessions:

Midnight Myth

  • ~ I was getting 3-4 hours of "pure" coding time
  • ~ Fewer distractions meant higher productivity
  • ~ I was making significant progress on tough problems
  • ~ code I wrote was innovative and clever

Here's what was actually happening:

Dawn-After Reality

  • ~ I spent 2+ hours next day fixing what I'd "accomplished"
  • ~ My "innovative" solutions were usually over-complicated
  • ~ I introduced bugs faster than I could solve problems
  • ~ next day's productivity suffered from poor sleep
mathematics were brutal: for every hour I gained at night, I was losing 1.5 hours next day. I wasn't getting ahead; I was falling behind with extra steps.

9 PM Rule: My Digital Sunset

After that February disaster, I made a commitment that felt radical at time: no coding after 9 PM. Not "no complicated coding" or "no production deployments." Just... no coding. Period.

My Daily Energy vs. Time

9 PM 6 AM 12 PM 6 PM 12 AM

first few weeks were surprisingly difficult. I'd be in middle of a flow state at 8:45 PM, and that timer would go off, telling me to save my work and step away. Every fiber of my ADHD brain would scream, "But I'm finally focused! This is when magic happens!"

Except it wasn't magic. It was fatigue masquerading as focus.

What Happened Next

Within two weeks, something remarkable occurred. My daytime productivity didn't just improve—it transformed. Problems that would have kept me up until 1 AM were getting solved by 4 PM. Code that used to require extensive debugging sessions next morning was working correctly on first try.

More importantly, I started enjoying programming again. When you're not constantly firefighting your own sleep-deprived mistakes, there's actually space for creativity and thoughtful problem-solving.

ADHD Dimension

Living with ADHD adds an extra layer of complexity to this equation. My brain craves novelty and stimulation, and there's something undeniably stimulating about coding in quiet hours when rest of world sleeps. It feels like I'm part of some secret society of night-dwelling developers.

But ADHD brains are also particularly vulnerable to effects of poor sleep and cognitive fatigue. Our executive function, already running on borrowed time, becomes even less reliable when we're tired. Decision-making becomes more impulsive, attention more scattered, and emotional regulation more fragile.

ADHD Sleep-Code Connection

Research shows that people with ADHD need more sleep than neurotypical individuals to achieve same level of cognitive performance. When I code late, I'm not just borrowing from tomorrow's productivity—I'm taking out a high-interest loan against my brain's ability to function.

9 PM rule isn't just about better code; it's about respecting neurodivergent brain I've been given and working with its rhythms rather than against them.

Practical Strategies That Actually Work

Establishing this boundary required more than just willpower. Here are strategies that made 9 PM rule stick:

Gentle Timer

I set a 8:45 PM alarm with a 15-minute warning. Not harsh or jarring—just a gentle reminder that says "start wrapping up." This gives my ADHD brain time to transition without shock of a hard stop.

Handoff Notes

Before closing my laptop, I write 3-4 sentences about what I was working on and what I planned to tackle next. It's like leaving breadcrumbs for tomorrow's Ken.

Transition Ritual

I take a 10-minute walk around block after shutting down. This helps my brain switch from "work mode" to "evening mode" and prevents urge to "just check one more thing."

Evening Alternative

Instead of coding, I read programming books, watch conference talks, or sketch out architectural ideas on paper. I stay engaged with craft without screen.

Unexpected Benefits

What started as a practical decision to write better code ended up transforming more than just my programming. Here's what I didn't expect:

1

I became a better problem-solver during day

When you know you have a hard stop at 9 PM, you get really good at prioritizing most important problems and tackling them when your brain is sharpest.

2

My code reviews became more thoughtful

Well-rested Ken catches things that tired Ken misses. My feedback became more constructive and less nitpicky.

3

I rediscovered hobbies I'd forgotten about

Turns out, when you're not coding until midnight, you have time for reading, cooking, and even—gasp—socializing.

4

My relationship with Toni improved

Shocking revelation: partners appreciate when you're present and not constantly thinking about bug you're trying to fix.

most surprising discovery was this: I didn't lose my passion for programming by setting boundaries around it. I found it again.

When to Break Rule

I'm not completely rigid about this boundary. There are exceptions, but they're rare and deliberate:

Exception Criteria

  • ~ True Production Emergencies: Users can't access system, data is at risk, or security has been compromised
  • ~ Time-Sensitive Deployments: Coordinated releases that can't be delayed (maybe 2-3 times per year)
  • ~ Creative Flow States: Very occasionally, when I'm genuinely in a breakthrough moment on a side project

Key point: "I'm behind on a feature" or "This bug is annoying me" don't qualify as exceptions.

A Letter to My Night-Coding Self

Dear 11 PM Ken,

I know you think you're being productive right now. I know that bug feels like it's almost solved, and you're convinced that if you just push through for another hour, you'll crack it. I know quiet house and glow of your monitor feel like perfect programming environment.

But here's what you can't see from inside your tired brain: tomorrow's Ken is going to spend twice as long untangling what you're about to create. "elegant" solution you're crafting is probably over-engineered. That variable name that seems perfectly clear right now? Tomorrow's Ken won't have a clue what `tempArrForComplexLogic` is supposed to contain.

Save your work. Write yourself a note. Trust that tomorrow's well-rested brain will solve this faster and better than tonight's stubborn one.

With hard-won wisdom,
9 AM Ken

Bigger Picture

This isn't really about a specific time on clock. It's about recognizing that sustainable productivity requires boundaries, especially for those of us with ADHD who struggle with natural stopping points. It's about understanding that our brains are not machines that can run indefinitely, and that respect for our cognitive limits is not weakness—it's wisdom.

In our always-on, hustle-culture world, setting a 9 PM coding boundary might seem almost quaint. But I've learned that programmers who last in this field—who build great things without burning out—are ones who understand that most important code they'll ever write is code that defines their relationship with craft itself.

Programming is a marathon, not a sprint. And nobody runs a good marathon by sprinting through night when they should be sleeping.

So here I am, writing this at 7:30 PM on a Tuesday, knowing that in an hour and a half, I'll close this laptop and step away. Not because I'm lazy or lack dedication, but because I've learned that best code comes from rested minds, and best programmers are ones who honor both their passion and their humanity.

Current time: Loading...

Time until digital sunset:

Key Takeaways

What Works

  • ~ Setting clear, consistent boundaries
  • ~ Creating transition rituals
  • ~ Leaving handoff notes for future self
  • ~ Respecting cognitive limits

What Doesn't

  • ~ Relying purely on willpower
  • ~ Making exceptions rule
  • ~ Ignoring ADHD brain needs
  • ~ Pushing through fatigue

Sometimes most radical thing you can do as a programmer is to close your laptop and trust that tomorrow's problems will still be there—and that tomorrow's brain will be better equipped to solve them.

From our coastal corner of digital world

Keep coding (during reasonable hours),

Ken 🌊

~ Written at 7:47 PM on a Tuesday ~
~ Where constraint breeds creativity ~