Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.

596 points by Buttons840 ↗ HN
I'm around 40 and recently I have been asked to port an API from one language to another. The code I'm porting is average code, not terrible, but plenty of little things to complain about.

I feel like my past self could have handled this task, but I am really struggling. Porting this API will require a deep understanding of the existing API, which, of course, has several layers of abstraction.

I can't seem to hold more than about 2 levels of call stack in my head. There's the entry point function which calls other functions, which call other functions, which call other functions, etc. You know how it is, code calls other code, and logically it forms a tree of calls and return values that often goes several layers deep. I struggle to hold more than about 2 levels of this call stack in my head. By the time I'm down in the weeds I've forgotten what I'm doing, what the purpose of the actual API call is.

I don't know how to break this into small enough chunks that I can understand it or make progress on. Imagine I gave you the code for the sha512 algorithm, and a hash, and asked you to find the pre-image (the input). This is how I feel. Where do I even get started? How do I find even a single chunk of manageable work to break off.

The hard part is, several other developers are making progress on porting this API. Why can't I? What happened?

I don't know if this task is just an especially bad fit for me, or if my mental abilities are declining?

533 comments

[ 5.6 ms ] story [ 420 ms ] thread
I've experienced this periodically since my early 20's - generally in hindsight I realise it was: real life getting in the way, burnout, lack of interest (I was interested in the idea, but on some fundamental level - not the activity) - also occasionally just a feeling of Groundhog Day (ie. Some code tasks can just feel a little too familiar - even if novel, and that saps my joy)

Either way, at the time it was quite worrying - even disturbing - especially when there was work to be done, so think I can relate

Generally I was able to reverse it by working on something which really stimulated me - even hacking away on some goofy personal project after hours - and that kind of bootstrapped me back into a place where I could easily attain flow for "harder" tasks. Can't recommend that highly enough, that and realising that I had different stimulus needs to previously - changing up my coding music, or even foregoing it and switching to mynoise.net yielded some excellent results, or reducing distractions (try periodically disabling system notifications)

That said, if you're really concerned probably see a doc just to rule out any funny business

Ps. Best of luck with it, crossing fingers for you

Thank you. Good advice about hacking on some personal projects/experiments. I'm worried that wont rebuild my confidence and abilities fast enough though. I want to make progress on this task today, not next week. Other developers seem to be succeeding, and I'm worried about how I'll look if it takes me weeks do to what others are doing in hours. (This isn't meant to dismiss your advice, to but to give feedback and solicit even more advice.)
In addition to the GP, I'll add there's a certain level of naïveté of being young that makes one feel like they were better than they were. I'm mid-40s and am probably the best I've ever been at writing good code, but sometimes I can get vapor locked knowing all the things I need to account to for. When I was younger I just coded because I didn't know any better.

So when I get stuck now, I just start writing code like I would have when I was early 20s.

Not in my mid-40s yet, but vapor lock is a great term. I also try to do the same, just write crufty code that works, hopefully clean it up some as I go.
> I also try to do the same, just write crufty code that works, hopefully clean it up some as I go.

I account for this in planning. POC -> POC validation -> Finalv2ForReal -> Finalv2ForReal validation

It gives two shakes at a decent solution with some built-in learning. If this looks like too much for business then well I tried I guess I'll do less work for the same amount of money (inevitably the stupid shit that got prioritized goes away). And I documented what I would have done and can point at it when POC as a service is ermmmm ... less than performant.

This. I feel this basically every day now. I really miss the naivete, and I struggle mightily to "just start writing code like I would have".
That is just unrealistic ?

Some days you just feel down and are barely able to function, others you have seemingly unlimited energy, and this can come from a whole host of factors : how did you sleep, what did you eat, what is the weather, how is your personal life going...

And of course things get worse as you age (with quite a lot of variation and personal responsibility in staying healthy).

> I'm worried that wont rebuild my confidence and abilities fast enough though. I want to make progress on this task today, not next week.

I’ve experienced this a bunch of times too. I’m sorry to say this, but burnout for me never goes away on a convenient schedule. The more I make myself wrong for feeling overwhelmed, distracted and unmotivated, the worse it gets. Or in other terms, problems are rarely solved with the same thinking that created them.

For me, I have to really give myself permission to step back, take stock of myself, get some sleep and good food and often take a break from “work” programming tasks for a few weeks. (And I know exactly how inconvenient that last part is).

The more I push myself to feel better already, the longer it takes.

I second GP's recommendations. You stopped working out. Muscles atrophied. A bit more sweat time and you'll be buff again.

"even more advice": Issue is likely mental focus (since you have a finite daily mental, emotional stress budget)

https://www.goodtherapy.org/blog/breaking-the-chains-finding...

- (let go of) mental re(re)view. "This too shall pass".

+ (embrace) "just do it" && "Don't worry, be happy".

! (remember) chemical dependencies, if any, must be brought under control.

Your mind will eventually be back at peak performance, but meanwhile you can use pen & paper to help you with this.

Write down what are the big challenges/problems, try to break them down and write about it, keep dividing it until you start to see that you can tackle the indidual pieces.

I'm 42 and I've been in a mental place similar to yours, but a little more drastic due to a hard time in my life, and it took a while to get back into top shape, but the effort to break down my problems on paper helped me tackle some immediate tasks I had to accomplish.

> Other developers seem to be succeeding, and I'm worried about how I'll look if it takes me weeks do to what others are doing in hours.

That one exact thought is compounding your problem. It's pure anxiety and it makes problem worse, I know from experience. When you think that, try to calm yourself with "yeah, it's just anxiety speaking, it will be fine". Maybe also try magnesium supplements, magnesium citrate helps me (but it typically takes up to a week of supplementation, minimum 2 days).

Often the "hack on something personal" just flicks a switch for me, I'm talking within an hour or two - but sounds like you're feeling a bigger sense of urgency than even that would help.

.. which honestly sounds an awful lot like the stress of the situation (or concern about cognitive decline) - which isn't going to do your focus any favours!

Any kind of reset can help with that: go for a short walk, chuck some binaural beats on headphones and close your eyes for 5 mins, drink a warm (non-caffeinated) beverage and think about something else.

Above all else: probably good to just remember everyone has off days, other engineers aren't going to judge you for a day of lower productivity

Aside from reducing your internal stress, One key ingredient of finding "flow" is a sense of immediate feedback, perhaps allocate 20 mins to some short tasks which give rapid reward; write a couple tests, draw a diagram, etc..

Binaural beats (use "relaxed"): https://mynoise.net/NoiseMachines/binauralBrainwaveGenerator...

Going for a walk is kind of a lightweight "shower effect", random article link: https://buffer.com/resources/shower-thoughts-science-of-crea...

(Sorry, time zone mismatch slowed my response)

Link dump (for reading some other time)

- stress and brain function: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6504531/ - flow state https://en.wikipedia.org/wiki/Flow_(psychology)

I don't think there is anything sustainable that will work this fast.

Good habits and lifestyle changes take time.

The only other option that has worked for me would be drugs like Adderall.

It could also be attention span problems caused by social media.
This is totally killing every focus there is for me. My IQ drops to at least 50% when there is a smartphone close by. Eliminating all source of distraction that I can, is essential to get anything done.
Smartphones don't just reduce your IQ; if you use one while walking, it removes all your situational awareness. I constantly have to step out of the way of some zombie walking along the footway, oblivious to the existence of other pedestrians.

My smartphone stays at home, on permanent charge (the battery life is severely depleted). I use it only to collect SMS 2FA codes from those organizations that assume that everyone has a smartphone. We call them "mobile phones", but that doesn't mean you have to move if you're using one.

That zombie effect applies equally if you're behind the wheel of a vehicle. Please don't ever do that. Of all tasks, driving is the task that requires the greatest situational awareness.

And technology in general. There is a video by HealthyGamerGG that explains how using smartphones or computers turns off a crucial part of the brain that knows what is important and you should focus on.

The longer you're in front of a screen, the more you lose awareness of yourself and what you enjoy. Taking frequent breaks away from screens is important to stay motivated and restore that drive towards meaningful things.

It's sounds wishy-washy how I explained it here, but the video has a more scientific explanation of this phenomenon.

https://youtu.be/zBgCRJluWTc

Is the current API under test?

Your number #1 priority with any port or major refactor is getting the current implementation defined and under test, so any replacement can be tested against the same tests.

Once you've done that you should have a solid foundation and understanding of what the API actually does.

In getting it under test, you'll also build up better mental models of which parts are actually separate and easily testable and which parts aren't.

Then you can get to work replacing and testing each unit, then build them back up on the other side.

You're right, that would make me feel a lot better about this task. Adding tests around the existing API is something I believe I could make progress on, this is a chunk I can break off.
Adding to this:

> By the time I'm down in the weeds I've forgotten what I'm doing, what the purpose of the actual API call is.

If I can craft tests up front in terms of the higher level goals then when I finish a subcomponent or get distracted by something else the higher level test is there for me to fall back on to figure out what to do next.

Great advice, I was going to suggest the same. You shouldn't have to memorize what each layer of a project does, that's what the unit tests and integration tests are supposed to prove.
Is the current API testable? So many times I've taken ownership of code that requires an active connection to a database to even be up and running. Changing the code so it's testable usually changes the code so much it is very hard to have confidence it works the same way as the original implementation.

My old company lived and died by its instrumentation of DAU (daily active users). We would try to refactor the code to an IoC pattern with DI but invariably we'd get blamed for a downturn in the numbers - but never lauded if the reverse was true. It was a losing game - we finally had to get management to commit to the modernization (never, ever say "rewrite") and power through the days of low DAU.

This sounds like terribly boring developer work to do and requires no creativity at all. Is that what's missing when comparing to other types of developer work that might keep you more engaged and focused? I'm not suggesting to push back about why it needs porting, I assume that bridge has been crossed already.

The other thought is that maybe it was poorly written, having multiple layers of abstraction, etc. that are unnecessary? Most API's are CRUD operations on data or calling deeper internal things, like payment processing, in which case you are calling other API's essentially.

I would suggest writing external tests that hit the existing API and in small chunks port features over and incrementally get those tests to pass calling NewAPI. Internal/unit test coverage can help to ensure each module or logical grouping is working the same as the prior work too.

I would second this - as I've got older, my capacity to do boring things has decreased.

Younger me didn't find coding boring - I was still learning things.

Older me, has done a lot of things multiple times. I'm often not learning anything (or, I don't believe I'm going to learn anything).

To be honest, things like Copilot have really helped with this - auto generating boiler plate code removes a lot of the tedium.

1. You're getting old. Start writing everything down on paper.

2. Some people decline mentally faster then others, sometimes in their 40-50. Don't freak out, but do pay attention, ask others you know to pay attention to you.

3. Take it one layer at a time, and again, write everything down, best on paper.

And keep smiling when it is hard.

Was just going to write this but with a minor modification. It might not be getting old part but rather the boring nature of a mundane task, anyway writing things on pen and paper is best and works wonders to help iteratively understand problem and build a solution.
WTF, AM I ALREADY DEAD AT 42?
:)

No, but we mortals age our brain ability does tend to decline.

(comment deleted)
I am closer to 50 and didn’t notice much decline yet, however to pre-empt it, I started journaling. I write down what I did per day, tech solutions, how I got to them, links to git repos, what I cooked with ingredients etc. It is fun to be able to say what I cooked Tuesday 3 September if someone asks ‘that Thai dish you made somewhere in December’ or ‘how did you fix that weird nodejs issue’? And it is inspiration for blog posts, tweets etc.

For me it works wonders. Wish I started it when I was 17.

given that you're asking how to break down a complex task into pieces, it sounds like planning rather than execution is the problem. to wit, it doesnt sound like its mental capacity -- if you knew how to do it before, you'd still know now. i think its quite normal to hit 40, start worrying about aging and attributing things to decline, but chances are you can do much more complicated things than porting an api with your brain and will be able to for a long time yet.

in terms of practical advise: more haste, less speed. ive no idea how the code is organised but consider porting it in layers (e.g. data access, business logic, helper functions) as opposed to API endpoints. Layers should roughly be decoupled things with clear interfaces between them. The stuff on the same layer should have the same concern. That way you can go breadth and not depth first and tackle one function at a time. Once you have a mapping at a function level from the old to the new code base it should be easier to plumb the API.

Sounds like you've identified your problem with the task - you can't hold the entire state of the problem in your head all at once, but maybe you would have been able to in the past.

This seems like something you can overcome. Have you tried writing these function calls out as a flow on a piece of paper, or in a flow chart, document, something like that? A reference which you draw to be able to tell where you are the stack and where you came from.

It sounds like a very crusty task and I doubt I could maintain that many levels of calls in many different contexts. The important thing is finding a mechanism which works for you.

edit: I'd note that it's possible your development environment is older than your colleagues, too. Many modern ones (VS Code, etc) can jump around a codebase automatically - find callers to a function, jump to where the next function is defined, etc. Maybe check their setup and see if it's worth adopting.

IDE code intelligence can help a lot. Anything that makes reduces the cognitive load of navigating within the codebase helps increase the mental capacity you have to keep the context loaded.

When tracing deep call stacks I can find it helpful to write out the question I am looking for the answer to in a comment. Then I can retrace my thoughts back up the callstack using the very handy shortcut to go back to the previous curson position.

This is good advice. Just a few days ago I randomly stumbled upon a youtube video where someone was using — blast from the past, here — a hunk of green bar line printer paper as a big scratch pad to write on. It made me wonder how I ever got out of that habit. That stuff, when it was ubiquitous, was the best scratch paper ever, and I used to do it all the time when I was young and, one would think, at my cognitive peak. Maybe falling out of that habit is part of my percieved decline.
I would want one of these Etch'n'Sketch but with a pen and some higher resolution. The variant where you pull a lever to reset it.

Whiteboard markers are too wide and I am left handed so I erase as a write.

And using paper makes it feel like I am wasting paper.

Those things exist. You press a button instead of pulling a lever. Search for "drawing tablet" or "writing tablet". I've got a 20" one by Xiaomi, but there are lots to choose from, very inexpensive too.
Does that really work out, with regards to waste? I mean, does something with a circuit board, a battery, an LCD screen, a case, a stylus, and a limited lifespan really end up being greener than renewable, recyclable, compostable plant fiber?
Etch'n'Sketch doesn't have batteries right? Or am I remembering wrong.
I do this. I was burning through a lot of paper and ended up going with a reMarkable tablet which is perfect for that sort of thing.
Charles Simonyi said:

"It’s probably just that aging changes your mode of thinking. Right now, I have to really concentrate and I might even get a headache just trying to imagine something clearly and distinctly with twenty or thirty components. When I was young, I could imagine a castle with twenty rooms with each room having ten different objects in it. I would have no problem. I can’t do that anymore. Now I think more in terms of earlier experiences. I see a network of inchoate clouds, instead of the picture-postcard clearness. But I do write better programs."[0]

I can believe the part about better programs. Can you imagine working with somebody who can clearly visualize software with 200 sub-components in it? I once worked with software written by someone who had similar powers. He was a hardware designer. His software had very little organization; he wrote imperatively and remembered where everything was. Six months after he handed a program off to me, I spoke with him and told him I was currently trying to figure out where a particular component was initialized, and he told me exactly where, in what part of what file. IIRC, some hardware registers were being initialized in a procedure that was allocating working space for a numerical part of the program, because that's here he happened to open the log file for the first time, and he wanted the logging from the hardware registers to be the first thing in the log file, before he logged the fact that the memory had been allocated successfully. He remembered this with no hesitation, more than six months after he last touched the code, possibly two years after he made the decision to initialize the hardware in that spot.

Someone with less mental horsepower, like me, has to organize their code into modules with clear names and responsibilities.

[0] https://programmersatwork.wordpress.com/programmers-at-work-...

Thanks in part to ADHD, I'm sure, I have severe tunnel vision while reading and writing code. I need to constantly diagram, take notes, and walk through call stacks (and re-walk) just to maintain my mental model.

I am insanely jealous of people who can keep everything in their head. Maybe there's a silver lining in that my methods are more resistant to brain-busting situations, depression, cognitive decline, etc., but I'm not sure that I'm convinced.

The flip side of that is people who can keep everything in their head often write code which reflects exactly that, and that code is very hard for others to scrutinize.

I try to lean into just such a silver lining. I like to write my code for worst-case future-me: what would it take for my sleep-deprived, Monday morning, uncaffeinated brain to make sense of? It definitely helps, especially even considering that approach, I often find I overestimate my future ability to understand past code.

> some hardware registers were being initialized in a procedure that was allocating working space for a numerical part of the program, because that's here he happened to open the log file for the first time, and he wanted the logging from the hardware registers to be the first thing in the log file, before he logged the fact that the memory had been allocated successfully.

To be fair (haha) I went from writing super organized code with loads of concise, well-documented files to writing code just as you describe when I started designing hardware and writing more complicated embedded firmwares. For whatever reason, hardware initialization boilerplate doesn't like to be spread out or organized. As soon as you try your code ends up breaking outright or becoming a vastly more complicated, gigantic mess.

It's because the hardware is soooo specific and we as software developers want to make interfaces that are as generic, high-level, and re-usable as possible. Example: You can't just write a function that takes two pin numbers and initializes I2C on them so you can talk with some module. You usually have to know--ahead of time--which two pins you're going to be passing to that function (so the types match; because each pin has its own special type haha) so the function can initialize the correct I2C bus on the chip (in the right way)... Which immediately makes such a function non-generic and kinda pointless since you'll never be able to re-use it in anything else for any other purpose. You quickly get into the habit of saying to yourself, "Why am I making this a separate function again?"

Also, the order of operations matters so much more in embedded stuff than it does in regular software. I could totally see the situation where you want to initialize logging immediately after initializing some hardware because you want the logs to reflect values that you only happen to have available during initialization... You don't need them after initialization so why waste precious memory keeping variables around just so you can log them later? Just setup the logger in the same code, write your variables, and be done with it!

Makes sense, right? Hah! Only in the world of embedded firmware!

Yesterday's top post linked to this tool: https://www.knotend.com It's a super fast/light flowchart editor. Might be useful!
Use graphviz[0], forget manual graphing. While many tools can generate a call graph, confidence rolling your own is a good superpower to have.

For example, write a quick script to add a panic (nonexistantFunction()) as the first line of each function. Then, call each function in turn. Save the panic's function stack trace, then process them as a combined graphviz file.

This simple and efficient hack will get you all the most important edges in most cases for most languages. It won't get you the internal links, for those you need a more effective parser or more exotic means of obtaining branched call stacks.

[0] http://graphviz.org/

I second the idea to draw out in a simplified flow chart like visio or excel boxes or graph paper. Nothing fancy, no ISO standard schematic, just journal sketches. The context being not the entire system design but for a single call what is the flow. That helps me in the weeds and out of the editor thinking. Also it may be 2h to do it for a simple case but I’ve found spending that drafting time helps think about the problem in entirety and saves time in the editor.
This is my worst nightmare, my plan is to leave this industry when I get really old because I’m scared my mental state will worsen and I will lose my problem solving skills.
I'm 45, have been writing code since 8.

Whatever you lose is more than compensated by experience, you spend less time solving the wrong problems.

A bigger issue is the cycles, and the realization that we don't learn much from history. Ignorance is bliss.

Time to start nootropics
You're up in your own head, and are sensitizing yourself to frustrations you would have brushed off in your (heh) youth. The cortisol isn't helping either. It's also possible that you're just burnt out.

You're going to have stretches where you look back and feel like you're doing the best work of your career, and stretches where you worry that you're done for. It's all normal.

If this project isn't clicking with you, but you have to do it anyways, use this as an opportunity to build some "compensatory" habits. A similar situation (I'm older than you, but this happened in my late 30s) got me big-time into note taking, which has been a long-term win.

I would talk to your doctor and get their input on the situation. Perhaps it's nothing, or perhaps it's something easily treated with medication. Why spend months and years continuing to suffer without doing anything about it.

I'm curious though have you had one or even more than one COVID infection? Brain fog / difficulty concentrating has been known to be a symptom of long term COVID complications. The sooner you identify it as a potential problem the more you can do to work on addressing it with a healthcare professional.

I don't buy for a second that a 40 year old is 'getting old' or that this is normal for your age. I'm 41 and as sharp as ever--I love solving problems and don't struggle with abstractions. Something is up IMHO and it's time to talk to a pro.

I don't know you personally but I doubt cognitive decline has anything to do with this.

As we age, we usually end up with more and more life responsibilities, beyond just the work we are doing. All of that is input to the brain and requires energy in response. The brain is not infinite.

I often feel as you do, but then I have periods where I am as light and agile in my productivity as 20 years ago, maybe even more so, and usually it is my life circumstances that are the culprit.

I remember once about 13 years ago I was working on a mobile game and had a similar problem as you describe; there was one day where the technical work seemed to overwhelm me and I felt inadequate. But I was just a young chap, and it was a passing moment -- I had indeed just taken on some enormous new life responsibilities at that time, which were the likely explanation.

Burnout is real, too, and giving yourself space (if you can) to relax and not think about work for a break can be quite useful to recharge.

Also, our standards improve as we age. I wrote a lot of high-energy seemingly clever code when I was younger, but it was nonsense and terrible to read. Now I would not allow myself such indulgence, and so I work differently, maybe at times more slowly, and it might seem this is due to less abilities, but actually it is due to wiser experience.
It turns out the same dynamic is at play with songwriting - your standards get higher, what seemed novel when you were 20 now seems boring. I’m sure it is the same across disciplines. The irony is, it kills creativity.
Does it though? I often find it's fun to find new and novel ways to create things that are both clear and efficient. Creative problem solving can be leveraged anytime.
I think the problem is you start saying "no" to more things (literally and metaphorically) before you've even worked the idea or given it a shot. This is purely supposition.
That is the gist of it, yeah. You get discouraged because you can't come up with anything interesting, whereas when you were 20 everything you came up with seemed interesting. I'm just generalizing my own experience of course, and there are more things at play than just this - like I think not yet knowing all the rules has something to do with it. I try to be aware of it, and take some advice I heard once at an artist-in-residence talk: sometimes quantity is better than quality. That is, treat making like sports: practice.
> You get discouraged because you can't come up with anything interesting, whereas when you were 20 everything you came up with seemed interesting.

This is so true. I'm 37 now, and I'm struggling with that - I'll come up with a project idea, only to second-guess myself whether it's ambitious or innovative enough, and really worth spending the limited time I have available. I end up questioning whether it would really count, or just serve as frivolous self-entertainment.

When I was younger, it was good enough that ideas were interesting or would help me achieve mastery. Once you have a bunch of well-worn skills under your belt and have plenty of options and the ability to make commitments, everything becomes just a function of effort/time and choosing what to do next becomes the biggest challenge.

I'm trying to cut myself some slack and allow myself some amount of time to pursue frivolous ideas. At least you can intentionally combine them with e.g. new implementation technologies (e.g. a new tech stack or new tools) to get important first-hand experience and maintain relevant skills (and therefore decision freedom).

I'm also hoping that some day, having kids might help me with some of these anxieties :-). If I revisit/retread older ground then perhaps to make it accessible to them at home or teach them by doing little projects together and give them a boost and allow the next generation to take it further. I.e., even doing non-innovative stuff could count, as a fundamentals teaching moment for someone else. Hope they take an interest!

I like to think of creativity as out of the box thinking, and as we get older and more experienced, the box grows.
That is a great way to phrase it.
I have not heard this take but it does seem plausible. What to do about it ?
Give yourself credit for working at a higher level of quality.
Yes. Also, don't think you are too good to fail, we still learn by failing even at 50. I've said some more in another part of the thread.
If you're not failing, you're not learning!
That definitely matches my experience. I spend so much more time re-writing existing songs than I did when I was younger. It used to be almost entirely creating new material and moving on to create more. I wonder how much is my standards have gone up or lack of novelty in general as opposed to how much I've become attached to some of what I've created and feel it is worth polishing. Some of both I think.
I returned to the first project I made as a software developer after being about ten years away from it. Never do that. Haha. But it was quite educational to see how my problem solving had changed. Fortunately I didn't need to refactor everything because if I did that would have been a nightmare.
I'll second this. Based on my own experience (I'm 50) it's all about energy levels. When my energy is high, I can code like I did two decades ago. Probably better. I guess the difference is that in your twenties, energy is almost for free. As you get older, you've got to be smarter about it - all the usual things - diet, exercise, avoiding stress...

Not that I'm good about those things - I do OK but not great. Sometimes (rarely, thankfully) my energy is so low I can't really code at all, sometimes I'm flying. I'd say by far the biggest factor is my overall state of positivity and optimism. And yeah, life definitely gets more complicated as you get older.

I'm 33 and this describes me perfectly too. Some days are clear and sunny while others are dark and cloudy.
(comment deleted)
I had unlimited energy till about 40 and then I hit some sort of cliff. This coincided with covid and being indoors using high velocity media like reddit/insta. I am not sure how much is age and how much is habits that caused this.
Easy enough to test, get off the high velocity media and do normal things like socialize / get out of the house (if you're aren't already) for 2-3 months and see if things change.
yes!! . I am in colorado for a 3 month work/ski trip hoping to ski 3 days/week. I don't use my phone on the slow ski lifts. Its amazing to be phone free for the whole day out in the mountains.
Recent studies suggest that counter to popular belief our metabolism doesn't change from age 20 to age 60. There are individual factors that can certainly account for your change of energy and I would certainly look for culprits.

I recently did a big change in myself - adjusted sleep, took specific supplements which I was suspect was deficient in and have found my energy to be much fuller. Do not ignore what your body is telling you.

My ex worked on a study that involved testing people's short-term memory. She mentioned a clear and abrupt change around the age of 45, though that wasn't what they studied and of course was not included in the study results. This issue is highly politically charged.
That's right when your eyes change, too. It's so predictable, optometrists can tell you what age you are.
I heard that was related to memory strategy (i.e. the brain focusing on more important methods and information) and not ability. I'd be curious on the results - clearly they aren't published though.
Our metabolism doesn't change in the technical sense, but in the popular sense of the word "metabolism" people absolutely slow down. At 20, missing a night's sleep wasn't even that big a deal. At 50 it is essentially impossible. I don't know what the underlying mechanisms are, but that's what people mean when they (incorrectly, it seems) say "metabolism".
Sleep quality pretty steadily declines with age - your 8 hours of sleep simply count for less than it used to, and you're actually consistently operating on decreased sleep
And that's even without factoring in children!
Out of curiosity how scientific or not of an approach did you take on the supplements. For instance I can't imagine you did double blinds on single supplements but did you start taking a bunch of stuff at once and assess later you felt ok? Tweak one thing at a time? something else?
I think your last sentence is the crucial one. Up until 40, I could pretty much push through whatever tasks I needed to do regardless of how poor my sleep habits or diet had been. Now, as I approach 50, I really feel it on days where I haven't been taking proper care of myself.
My energy levels drop drastically when I'm doing too much "high velocity media" or bottomless wells, be it Reddit, regular news, tv shows, movies, games, etc.

I think it fries your dopamine and other neurological circuits. I don't know the science in depth but I have seen enough anecdotal evidence on myself and others to be persuaded that the relationship is huge.

Do a screen fast for a couple of weeks and check out what happens.

This is turning into a great thread and this comment is the most impactful one for me. I'm going to give it a go. My daughter is 18 and at least half her peer group are in a dreadful state in terms of mental health. You have to wonder if the impact of the modern media environment is way worse than we've comprehended. Of course that's totally unempirical but is the funding there for the studies we need? In any case it's easy to run the personal experiment, as you've suggested.
I used to be able to work 36hrs straight (random work crunch every few years). Hit 40, launched into such a session, 2am hit a wall... "Can't. do. this..." Laid my head down on my desk and slept for 2hrs. Haven't been able to pull an all-nighter since.
If you're male, you might want to check with your physician to see what your testosterone levels are like. You're at the age where it starts declining and it can have a really fatiguing effect.
I've gotten it tested. I am indeed on the lower end of the range. But there is nothing that can be done about it right? I do workout 6 times a week with 3 weight training, eat very decent diet. My weight, bodyfat and muscle tone are in good standing too. All That really hasn't raised my testosterone. I don't want to get on TRT.
Just curious why you don't want to get on TRT?
Even worse: high velocity work distractions, Teams, Slack, etc.
Energy yes, and focus. When an interest is lost, it's harder to focus. Like why the hell would I still have to write this algorithm, it would be exciting when I was younger, now it's meh lets find out if there's a lib for this. And then every piece of software is garbage through lens of experience .. why would I write software at all .. of course because I need a job and money. Now I may think I'm not sharp as my young self.
Diet and physical activity play a huge role in mental clarity and energy level. The diet part of that we're only beginning to really understand in the last 10-15 years after some research breakthroughs in looking at our gut.

Western diets (e.g. the standard american diet... what we actually eat) is fairly bad for our health which impacts our abilities.

I would recommend folks look into the Blue Zones. Where people live the longest and thrive for the longest. Look at their eating and lifestyles. One of those zones is in the US where people have work/life balances similar to folks here.

In my case, changing my diet and activity level caused my energy to go up and mental clarity to improve.

Me too, I'm 37, and I did a radical diet change -- No sugar, no carbs, no dairy, no gluten. Only meat and vegetables and fish and some fruit.

After a year of this I've dropped 20kg, and my mental clarity is back where it was when I was early 20's.

I think it was mostly the no sugar that did it.

Exercise too - I walk 2-5 km a day

Oh and cutting down what I eat too -- I only have 1 meal a day, and a smoothie in the afternoon

That's pretty radical on the diet. Was it difficult to adjust? I'm pretty thin as it is so I'd be worried I'd waste away!
I did a radical diet change, too. I'm wired where I can just do that. I've read most people can't and trying often leads people to failure. If you aren't wired to just pivot on a dime you might try a system that works for you.

My major diet change was to eat like the healthiest of the Blue Zone folks. I wanted great energy now and longevity of it and my life. A diet that gives me energy now but leads to heart disease wouldn't cut it.

For that, I went plant based whole grain.

How much you eat matters, too.

A good technical book on diet is The Proof is in the Plants [1]. It covers what we need in our diets and why. For example, how much selenium do we need and what are sources of it. Despite the book title talking about plants it also covers meat and dairy. Everything covered in the book is based on the latest scientific research. It's written by a dietitian who can reference the studies.

[1] https://www.amazon.com/Proof-Plants-science-plant-based-plan...

Yes it was difficult - giving up sugar was very tough, everything has sugar in it and the cravings were strong.

After a month though my taste buds changed, and I really enjoy the taste of meat and vegetables now.

Yesterday I had the opportunity to eat some vegan ice cream, and I thought I would treat myself to a couple of scoops in a cup thing, and after just 2 bites it was sickly sweet, the amount of sugar made me feel really ill, and it felt like I was eating poison, so I threw it away.

Quite interesting. I do miss some foods (pizza :( ) but the mental clarity alone is worth it.

Vegan processed foods are often just as bad as regular processed foods. So sweet. The vegan label may mean there's no meat or dairy but it doesn't mean it's good for you. Most processed food isn't.

Plant based whole grain is usually a diet of the real foods themselves. Take a bean burrito that someone makes fresh. Or a stir fry using fresh veggies. So different from processed foods.

I still eat pizza. Love them carbs :)

Similar results for me. Was basically stuck in bed most of the day. Finally went AIP diet, which is roughly the same diet. Few months later I was kayaking a couple times a week.
> Based on my own experience (I'm 50) it's all about energy levels. When my energy is high, I can code like I did two decades ago. Probably better. I guess the difference is that in your twenties, energy is almost for free. As you get older, you've got to be smarter about it - all the usual things - diet, exercise, avoiding stress...

This is an amazing insight. I’m almost 46 and feel like I’m at the top of my game, programming-wise, but also, I’m probably at my healthiest. And that’s worked-for health, not the kind that comes for free in your 20s (generally). And I think about and pay attention to energy levels during the day, and just know when I’m toast for the day and time is better spent elsewhere. I take a brief afternoon nap before coffee most days. I pay attention to when my mind is receptive to new information. I let some things bubble away in my subconscious and sometimes make new insights on walks, in the shower, or while making coffee.

>I guess the difference is that in your twenties, energy is almost for free.

Where can I obtain this for free energy?

Another thing is simply that we have lower tolerance as we age for things that are boring. It's hard to get motivated and concentrate on something you don't enjoy. When I was young, I could bend over backwards for stuff I thought was meaningless but now I just shrug and try to avoid the kinds of problems you describe -- and if I had to do one, I'd probably procrastinate and feel lots of negative emotions.
thank you for adding "(if you can)" to suggesting they relax...that is real
> As we age, we usually end up with more and more life responsibilities

As somebody who far away from 40, how is one supposed to "look forward" to getting older given this likelihood?

Pretty sure nobody looks forward to getting older except for the young.

People plan towards retirement which is usually just looking forwards to not having to work anymore.

People look forward to having children and grand children.

I don't know anyone who looks forward to getting older except for the young.

More life responsibilities isn't a bad thing. Life is (or should be) made of intentional decisions by the user (you). And the culmination of these intentional decisions can fill your life with meaning, purpose, and fulfillment.

You don't have to take Responsibility A if you don't want to, but you have to live with the consequences of your decision (good or bad). It's a trade off. I want a house. I make that decision for that responsibility. I now own that responsibility knowing the duties that come with home ownership will take a portion of my time and therefore will reduce the availability of time once given to a different responsibility.

Of course, mistakes will be made, but the best part is you can most often correct mistakes in healthy and meaningful ways.

Those life responsibilities are not mandatory unavoidable things. They're choices.

Such as: owning property, owning car(s), having children, getting married, getting a mortgage, etc.

You can chose to not do any of those things and basically live like you're 20 when you're 80 (in terms of responsibilities).

As someone who has done all the things you listed, my experience is that the grass is always greener on the other side.
They are first world problems and if you read carefully everyone who has gotten responsibilities chose them and they are very happy for it.

It's just the mind's way of coming up with problems when there aren't any.

It just feels like you gradually "give up" a life that was once yours (less responsibilities) and are "slowly forced" into a life that isn't as much yours (get married, buy a house, have children).
Doesn't "slowly forced" imply lack of agency?
> sense of agency refers to the feeling of control over actions and their consequences.

You're damned if you do (give up control) damned if you don't (walk through life unmarried with no kids in an apartment wondering what could've been)

Without responsibilities your life has no stakes, and no rewards.
By enjoying today, tomorrow will come regardless of whether you want to avoid getting older. Best you can do is prepare for tomorrow, health and finances.
Life is more fulfilling, but with more responsibility comes more things to worry about.
Everyone says "I'm not as quick as I was when I was younger, but I have more experience."

But that's a very sad kind of survivor bias. You were born with your quickness, but you have to earn the experience. Not everyone ends up middle-aged with useful experience. You hear only from the ones who do. And nobody has a time machine.

So look forward to reaping the benefit of experience, but let that be a warning that experience doesn't happen for free. Use your youth to acquire as many lifelong skills as possible. Use those skills in challenging ways to develop judgment. Use your skills and judgment to develop meaningful relationships with people who have chosen similar strategies.

Being able to offer solid skills, judgment, and relationships, rather than the ability to work consecutive 18-hour days, is what you'll have to look forward to.

Personal anecdote: I'm around the same age as OP and until recently also felt like my thinking was slowing down over the years.

I went for many years without an exercise habit. About 5 months ago I started lifting weights. The transformation has defied all my expectations and the biggest unexpected benefit is that my mind has become sharper, faster and more focused. I essentially feel like I've reversed a decade's worth of brain and body aging by going into the gym and lugging some iron around a couple times a week.

Around the same time I started cutting back on alcohol intake and cleaned up my diet a bit. So it could be any of these factors but I think it's a combination of all of them, as you get older, you need to maintain your body or it'll deteriorate and take your mind with it.

I’ve had a very successful similar experience with regard to excercise.
Hmm. Do you think we will ever get a pill to replace exercise?
Exercise is a source of enjoyment, why would you want to replace that?
Perhaps the pill we'd need is one to make everyone enjoy exercise at some minimum base level. Plenty of people I've talked to were either not enjoying exercise at all, or did enjoy it while they were doing it, but have a lot of resistance to getting started every time they plan to do something.
Love this idea. As I’m on the couch in my running outfit, avoiding running, I clearly need to pop a Motimove.
The trick is it's not a source of enjoyment for everyone; if it were there probably wouldn't be such an obesity/heart disease problem in this country.

This is kind of where I always have been, I find exercise to be a loathsome and boring chore, a necessary evil that gets in the way of things I would rather be doing.

Same for me, I hate exercise for exercises sake. I always have to make it a side effect of something necessary or fun I'd rather be doing - commuting by bike, mountain biking, standup paddling or windsurfing etc.
I exercise on a strict schedule, both weight lifting and cardio. It is never enjoyable for me. I don’t get runners high, or pleasure from the exertion. I just make myself tired, sweaty, and add on temporary pain to my muscles.

It’s worth it for the global effect on my energy levels and health. But it remains true that for some of us, exercise is never a source of enjoyment, and I understand why many people can’t get through that to do it anyway.

I’m in the same boat. Sports is a great shortcut but it’s just a lot of mental effort to meet new people.
> I don’t get runners high, or pleasure from the exertion. I just make myself tired, sweaty, and add on temporary pain to my muscles

I feel the same way with exercise. People tell me that you feel good after and I never do. People tell me that you feel a "good" soreness in your body and I never do. I just feel sore.

I wonder what's different about people like you and me where we don't enjoy this process the way some other people do? Do you think it's been studied?

I used to struggle to build muscle the same way, until I switched to a paleo diet.
Most of it's less enjoyable than several other things I could do with that time instead. Focused cardio, especially, is miserable enough that I'd rather do a bunch of other things I find unpleasant instead (IMO). The parts I find enjoyable enough that I'd choose to do them over other not-unpleasant things mostly require a bunch of other people (sports) and are hard to schedule, and then become another thing to schedule around for other activities or things that come up. Weight lifting's fun as far as such things go, but takes up space or requires trips to the gym.

The feeling after's nice, though. Would take that in a pill form, for sure.

> Exercise is a source of enjoyment, why would you want to replace that?

I wish I felt like this. Exercise is tolerable when I'm doing something at the same time (walking, chatting, listening to music) but that's enjoyment despite the exercise, not because of it.

Yeah, nothing is going to replace eyes, ears, memory muscle experience. Imagine something would replace table tennis sensing experience?
Probably not to replace excercise, although who can say with gene editing.

Reducing, stopping, counteracting mental decline is a holy grail in medicine. I think there has been some progress here.

And on the general mental acuity note there are things like modafinil.

The best things known work are do what you need to do to get good sleep, and find some way to exercise routinely.

Maybe centuries from now we will be able to replace movement with a bunch of chemicals that confuse the muscles to think they moved, but movement actually causes a lot of hydraulic pumping effects throughout the lymphatic system that physically diffuses toxins into a waste stream.

It’s probably not possible from a physics standpoint to replace motion induced pumping/diffusion with pure chemistry.

You don't necessarily want to mimick muscles moving, but rather the brain effects of said muscles moving

Its possibly people may isolate the two effects separately

I suspect the brain alone cannot do it. At a some point the chemistry needs to happen, and it has to be in the right place (so the physics of moving liquids inside your body is also required).
Maybe not a pill but hopefully we'll have advanced technology that can determine what kind of exercise is exactly right for your goals, take into account any injuries, and tailor your Travelator(tm) Mech Suit to provide you enough resistance for maximum gain with lowest effort as you complete your daily outdoor cobalt mining gathering allotment for LikeCoins.
I like the joke "If exercise were a pill, every doctor would prescribe to everyone."
While we don't have this we do have two simple technologies which massively amplify the benefits of whatever exercise you do: whey protein and creatine (plus a whole host of others where the risk/reward profile is less straightforward)
We already have many, the side effects however are... problematic.
My girlfriend got sick and now I have a part time caring responsibility that’s mostly about doing chores and errands. I’m in better physical shape now and oddly feel more capable at my engineering job.
While the chores isn't as fun as a hike, active rest is better than passive rest. Helps that it seems like you have a positive attitude to the chores.
I've never had an issue doing small chores but in the past i'd basically organized my life such that i avoided having to do as much ancillary stuff as possible. Now, whatever reservations i had before about repetitive shit like washing dishes by hand or running errands are gone because its for an immediate, greater purpose. And she really appreciates it :)
This happened to me with kids. I've always been a lazy slob who plays video games in their spare time. By my late 30s I was starting to feel like a bag of garbage.

But when I had kids it forced me to move and do things. Now I feel better in my '40s than I did in my '30s.

Sharing my own anecdata: my Oura ring shows that on days I drink, RHR is 10bpm higher and HRV about 15ms lower. Exercise has a huge impact on sleep quality too.

My theory is that when you're young, your body has a much wider margin for error. A few drinks or sloppy exercise routines never seemed to impact my work. As I've aged, the margin has shrunk, and now there's a measurable effect that I can no longer ignore. Aging is in itself a handicap, but now after too many drinks, the next day both my cognitive sharpness and motivation to even care about shoveling bits around a network have declined.

Now I need to actively stack the deck in my favor, rather that engaging in behaviors that further handicap myself. So that means exercise, a sleep routine, zero alcohol most days of the week, reducing stress, all that goddamn stuff I never had to worry about ;)

Another way to think of it is this: at 40 or 50, can you afford to be lugging around a 20% RHR penalty all day? That will surely come home to roost, probably in the form of atherosclerosis. Remember the most common clinical presentation for a heart attack sufferer is not chest pain, but being dead on arrival.

I bring this up because it's worth nothing that our bodies and minds are remarkably good at covering up problems until far too late. When you get those early warning signals (high RHR, feeling of cognitive decline, etc) trust your body, be proactive, and employ countermeasures.

My having an Apple Watch opened my eyes on how much alcohol affects my sleep, and thus everything else. Even as little as a single drink can have a disruptive effect that night. A real bender might take a couple of days for the effects to completely wear off.

Last year for unrelated reasons I wound up not drinking at all for a few weeks. All of my heart & sleep metrics were improved by large amounts. When I zoom out for the full year view it's obvious immediately when that was in the aggregate data.

In terms of how this knowledge affects my behavior? I'll still tie one on at about the same frequency. But the casual "sure why not, I'll have a beer" is gone. Whenever I'm about to consume alcohol I think about if the amount of enjoyment I'll be receiving is worth the downside & act accordingly.

Yeah that's a great point, the data really makes you pause and say "is this worth the cost?"

The other wearable that has had an extreme impact on my lifestyle has been a Dexcom CGM through Levels. I could write pages about this, but in some ways it has been more impactful than anything else. Knowing how your body reacts to particular foods, and seeing the immediate feedback is super eye opening.

And it extends into sleep as well, looking at what your blood glucose does overnight based on stress, exercise, what you ate, when you ate it, it's quite amazing to see how this subsystem in your body is reacting.

I'll never forget the first time I ate sushi (which mentally I thought of as a "light" food, even a snack) only to see my blood glucose rocket past 200 mg/dLf.

You can also see the effect of alcohol here. Not just with carbohydrate heavy beers, but with the fact alcohol itself suppresses your blood glucose levels, since it causes your pancreas to spike insulin, which disposes of glucose. So it's yet another way alcohol causes a disturbance in your body's attempts at homeostasis.

Alas, a CGM through levels is quite pricey because of US healthcare bullshit about giving CGMs to people without a diabetes diagnosis, but doing a month or two of CGM once per year I think it's a great investment (approx $200 for three sensors which last a total of 30 days)

Is the Oura a good purchase? I've been really eyeing the health benefits of the Apple watch but there's no way I want a portal into the digital world that's a flick of the wrist away. It's bad enough with the phone pickups.
In terms of wearables, it's quite unobtrusive because it's literally just a ring. There is no display to become distracted with. The inside of the ring will glow when it's taking measurements (red for blood oxygen, green for heart rate) so that might surprise you when the lights are out, but that's about the extent of how "intrusive" it is.

The battery life is very good, I typically get several days to a single charge, which is far better than the Apple Watch. But most importantly it's comfortable to wear during sleep - indeed it takes the majority of its measurements only while you're sleeping. YMMV but there's no way I can wear an Apple Watch to sleep, while the Oura ring works perfectly. I've worn the last two generations of Oura ring and would definitely recommend.

100% recommended as a non-obtrusive sleep tracker. But it's a bit bulky as a ring (and... it's a ring) so I can't recommend it to the same degree for day-time wear.
> lifting weights.

In this recent survey of nootropics [1], weightlifting was better than dozens of chemicals. In fact, it was third only to Dexedrine and Adderall. It scored better than Ritalin! And its variance is tighter than most substances, meaning it's one of the most likely means to improve results for anyone who takes it on.

Personally, I agree. After covid sapped some of my energy, it took about 2-3 months to get back to my average gym sessions and now I feel so much better. Happier, tougher, etc. When I am in shape, the geometry of the world around me changes. A distance or effort I might consider looks, feels, and is more in reach after a few weeks of rows, lunges, pushups, hanging, swinging, light cardio, biking, etc.

[1] https://astralcodexten.substack.com/p/link-troof-on-nootropi...

Would you mind sharing the routine, or a general outline of how you approached weight lifting from “zero” to “one”? I’m approaching 36 and haven’t lifted anything in 10+ years. But reading sentiments like this is motivating me to start again. I’m just scared honestly - my body has atrophied quite a bit the last 4-5 years at minimum
Typical good advice is to do some simple barbell compound lifts like Rippetoe’s Starting Strength. Deadlift, squat, pull-ups, hard to go wrong with that base.

Make sure you ramp load gradually if you have lifted in the past, your muscle memory can return faster than your connective tissue strength leading to injury risk if you stack the weight aggressively.

Make sure you ramp load gradually if you have lifted in the past, your muscle memory can return faster than your connective tissue strength leading to injury risk if you stack the weight aggressively.

This! Dealing with this right now :(

You might look into a trainer for a few sessions. I'm in a similar situation, and just getting back into lifting with a set of at-home weights. Thankfully, one of my company benefits is an in-house trainer who you can sign up with for a few remote sessions. She's putting together a plan for me, then will do a few zoom calls to make sure I'm doing the exercises right, and hopefully that'll take care of things.

Years ago, I used a trainer in a gym to kickstart a plan, and I found it very useful.

+1, I highly recommend getting a personal trainer for a few sessions. They can even do remote video sessions outside of signing up for a gym. A good trainer can recommend exercises that provide just the right amount of challenge - not too low that benefits aren't there, and not too high that the difficulty makes you quit (this is a problem with gym group classes).
I am 34. Start HIIT (high intensity interval training) 10 weeks ago. First time in my life I am in a gym. I also notice the transformative effects.

The way I am managing to build my habit: Only do group sessions. If you want to go fast you go alone, but if you want to go far you go together. I know that group sessions are the only thing that give me enough structure to continue.

So maybe it will help you get started as it did for me? Personally I went to a fairly expensive gym so the groups are small. This to minimise risk of injury. Try it if you can afford it.

I'm not who you asked, but I'll share my experience escaping sedentarism in advice form:

Start with push-ups. They're fast and require nothing but a flat surface. You can always transition to lifting weights later.

Start today, ideally right now. Seriously. It's your only chance. Tomorrow there'll be an even better reason not to.

Don't worry about initial quantity. You can start with two push-ups, that's fine. It'll take ten seconds if as much.

Repeat every day.

When you feel it got too easy, increment by one starting the following day, not at the moment.

This. For me the secret to actually going from total couch-potato to fit was to exercise every. single. day but Sundays.

I tried 3 times a week or whatever, and every day you'll find some excuse to push exercising to the morrow.

But doing exactly the same routine every day was key. Then the routine evolves with time, but it's almost always the same routine. I started with a few pushups, then added burpees, then I bought some weights and added a few movements, then I started running 300m a day the first week, and augmented gradually until I ran 42 km every single week.

Sure! As someone who failed for decades at establishing an exercise habit, a few things were key.

* I hired a personal trainer. Actually, two of them, scheduled on different days, to reduce the chance that I would saddle myself with a bad one and not know it. After 2 months I let go of the least effective trainer. The trainer(s) were huge at first because having an appointment with someone helped me actually get off my ass and show up, my own willpower alone was always insufficient in the past. They also exposed me to a variety of exercises which is how I learned that I really enjoyed weight lifting (and some other exercises, not so much). Nowadays I just have the one guy once a week doing form checks.

* I joined a very nice gym near my office, again as a motivator. It's easier to attach one habit to another habit, and the habit of going to work is pretty ingrained, so "walk across the street for one more appointment" turned getting into the gym from something hard to something that was basically automatic. My workout is my favorite part of the week now because my gym also has a great jacuzzi and afterwards I get to plop into the jacuzzi, veg out and catch up on podcasts.

* In terms of the "technology" around weight lifting specifically. I'll triple emphasize just hiring a good trainer and just following their instructions at first. But once I started engaging my own brain, I found A) Correct protein/macro intake was bigger than everything else in terms of getting results. Get your daily protein to where it needs to be (which is freakishly high) and same goes for calories (depends on your current body type and intake). B) You don't have to push hard on increasing weight at the beginning at all, nor worry much about how many reps you do, just do what is fun and safe and do it regularly. C) For further education the book Starting Strength and the Fitness Wiki maintained by Reddit's r/fitness are really good. They recommend similar beginner workouts and as an out of shape guy, you can basically start on these immediately as long as you're getting regular form checks and sticking to low weights. (I actually was so weak I had to start with just the bar or even dumbbell variants... once I started pigging out on chicken and whey, that changed very fast, increasing how much I was lifting got easier, and within a couple months I had muscles everywhere.)

This. My thinking was getting so bad that I went to a neurologist. At the same time I started walking daily. A month or two later and I feel like a totally different person. Mental clarity has sharply increased. Haven’t even fixed my sleep yet either. Can’t wait to see how much more improvement I can get.
Anyone have experience comparing weight lifting vs other forms of exercise? Curious of how cardio vs weightlifting compares for example. I have heard a lot of podcasts talking about some psychological benefits from low heart rate cardio that are difficult to replace with other forms of exercise, for example.

Call me a wimp but I find DOMS can be a little distracting haha.

I find DOMS kicks in after taking a week off from my lifting routine or when I switch the routine altogether. As long as I keep a week between working the muscle group, DOMS isn't a thing.

When I do expect DOMS to kick in, I drop weights to 50% my max sets (usually dropping weight vs reps). This makes me "somewhat sore" the following day but no more than that. I also put an emphasis on sleep, "clean" nutrition and supplement with electrolytes. Works really well for me.

As for low intensity cardio, I feel it's good for me, but I have to say it can be a struggle to keep it low. The feeling of "I want to push harder" can sometimes be overwhelming.

When I was 40, I think my cognitive capacity and coding ability was pretty good - possibly peak. By the time I was 60, I found learning new stuff (especially languages and frameworks) hard; but that was partly or wholly because I didn't regard learning new tricks at that age to be a good investment of my time and effort, since I'd soon be retiring.

Since I retired, I have suffered a cognitive decline; everything takes longer. But, you know, I'm retired, and work expands to fill the time available.

I'm 53, I'm feeling similar. I see the 7th package manger or the 4th pipeline manager or the 17th linux disto or the 52nd video game where you can craft shit...

and it just makes me tired. While I'd like to retire and think I'll financially get there sooner or later, I'm afraid that there's an underlying structure to work that I'll miss.

big +1 to all this. Also if OP had COVID, check for long COVID symptoms of other kinds, incl cognitive issues with non-programming tasks.
As a 45 year old lead developer, this is the answer that I most align with. Not only are job expectations a bit higher than 20 years ago (ie, back then you could just say "I'm still workin on it" but today you generally have to give progress reports at least daily and have your velocity tracked), but at this age, my time can be strictly regimented (exercise, chores, caring for the animals, appointments, helping in the kitchen, doing actual paid work...) from before-sunrise until almost midnight. I'm not quite sure what happened to the days that seemed like I had a whole ocean of time, but even writing this reply is a bit much. Give yourself some grace. Afternoon siestas are a great idea if you can sneak them in.
> you generally have to give progress reports at least daily

This trend seems genuinely goofy to me. If you have daily reports, standups, or whatever, you're going to be spending a lot of your time prepping for those. That's time that you're not spending writing actual code (or whatever you're nominally supposed to be doing).

Came here to say much the same. I'm older (51), and have felt I was losing my ability to think over the last few years, and also to express myself clearly in conversation. But a great deal of this is to do with a number of huge problems that have happened with my step-children and the near-constant onslaught of having to deal with a variety of agencies and not just run off into the sunset. Plus I decided I could self-build an extension to my home.

It may well be that the OP has other load that has crept up on him; until you take a step back it's often difficult to see what's happened over a period of years.

But burnout is a thing, and sometimes you need to take stock, take a break, and maybe even make some big changes. You're only here once, so it's a good idea to give it your best shot, IMO.

As far as anyone can tell.

Yes, let’s not spread around some idea that mental ability declines at 40. That’s just ridiculous and not backed by science. It sure is backed by ageism though.
i think that's perfectly said, and i'm 55.

in short, that assignment sounds de-motivating, so you're predisposed to notice momentum is hard to establish.

and getting coherent blocks of time, to get in a flow as they say, is the challenge that hits me all the time, and which i didn't have when going to an office 20-35 years earlier (including in college i mean).

I have my problems with burnout and depression and this usually leads to phases where I am hyper productive and can effortlessly take on any challenge, and then the opposite phase where I feel completely incapable and end up overthinking everything.

Even without burnout, sometimes a problem doesn’t motivate you and therefore you don’t really feel like solving it when there are other things that seem more interesting or more practical.

Either case, once the down period starts it’s a good signal to take some time off and get your head out of it.

For someone who has been forced to try countless substances / diet regimens / health strategies due to a pervasive chronic disease, I beg to differ. There's so many things that you can personally do that will alter your cognitive abilities, sometimes to an incredible extent. The tricky bit is that there is indeed no silver bullet, and what works for someone might do nothing or create harm for another. So in my opinion, understanding that there are alternatives to resignation is really the critical component.
I'm 50 and can confirm this. E.g., I'm currently much more concerned about how politicians seemingly driving the country I'm living in and the world as a whole downhills in all regards. These worries are of course a waste of my personal energy.

On the other hand: When structuring my day with Pomodoros (https://en.wikipedia.org/wiki/Pomodoro_Technique - especially doing the rest properly, meaning just lying down doing some relaxation technique) and resisting all other harmful stuff like (to much) news or (any) social media, I feel like I'm even sharper than in my younger years. Even remembering stuff better.

So, I think those problems are to be spotted in our changing environment and internal setup more than in an aging process. At least not at 40, 50 or 60.

I think this is quite true, and I've noticed that my son can remember virtually every pokemon card and football player he's interested in whereas I've started to have to write things down. His world is quite small and now with the Internet etc our focus is very wide. It takes serious discipline to focus on something low level exclusively and not be subject to outside interference.
I concur with a lot of what other people are saying here. Late 50s, programming professionally for around 25 years. But recently switched to management. Really hard for me to focus on details of the companies code anymore.

But... when I get on some personal project, I'm on fire. I can learn new languages and concepts and systems and build pretty complex things that people are amazed at.

I think it's more job burn out after years of writing code for other people. You write the code and you work towards the deadline like the world is going to end if you don't make it. Then that code is in production for a year or two. Maybe more if you're lucky, and then it's gone, replaced by some new thing. You stop caring quite as much. But you see these new young kids on fire and working all night and you get imposter syndrome and you try to care and you beat yourself up and think you're losing your touch. tmi?

(comment deleted)
Bear in mind that the world has been really ratcheting up the "everything's fucked" factor for the last several years. This might not be "I'm 40", it might be "I'm dealing with living in the current state of the world."
40 has nothing to do with it. Every other day I see a Ask HN post from younger people bringing up depression, burnout, and apathy.

Listen, there are 60 year olds that look like our long held image of a 60 year that can barely walk or do anything.

And then there are 60 year olds that go to the gym everyday.

How do you want to play this? I don’t accept your premise that 40 has anything to do with it.

Being a miserable fuck is age-agnostic. Trust me, I’m a professional malcontent.

(comment deleted)
There's a lot of biology in the mix here to that must not be dismissed.

But I like your take. Do everything reasonable to continue forward and maintain your body and mind.

Just don't completly ignore your genetics and biology and be open that they might speak-up and have a say too.

I mean we have good evidence that athleticism at the competitive level has a drop off at a certain age, and even that is mostly only a factor at elite levels. There’s nothing stopping you from being a great basketball player in casual terms at any age.

But cognition constantly being under ageist assault has little to no basis when you consider so many knowledge driven professions employ people well past middle age (academia, doctor, lawyers, scientists, writers, artists). They also do their best work much later in life.

> Just don't completly ignore your genetics and biology and be open that they might speak-up and have a say too.

They may have a say, but ultimately you can only try to deal with the cards you’ve been dealt. At least I wouldn’t just accept that I’m genetically predisposed to misery with no way out.

Just be mindful that the flip side of this perspective is to blame sick people for their condition.
Ah, yeah, that would suck. I guess it’s really only something you should apply to your own condition, never someone elses.
The optimum middle is to try to figure out the most achievable pathway to help people to as much health as possible regardless of where they’re at, while accepting where they’re at, and encouraging persistence in searching for achievable steps out of sickness if none are available.

There’s an incredibly sad but inspiring documentary called “The Boy Whose Skin Fell Off” about a man named John Kennedy that died of a genetic skin condition called EB at 36. He did everything within his power to make the most of his life, and was brilliantly dedicated to squeezing as much meaning and good as possible out of his horrible situation.

Failure to attempt moving away from and transcending sickness is itself possibly the worst form of sickness, and something that can be easily cured by just having someone genuinely loyal and rooting for you, even if only your inner self. What sick people need most, more than simple compassion and accommodations for their problems, are people genuinely rooting for health/trying to find solutions or grieving the difficulty in finding any.

I’m a “biological optimist” and think a lot of what we consider “bad” can be and often is at least somewhat adaptive. Even things like aging and death; there are ways to age and die adaptively to give room to the next generation, to allow societal renewal/avoid sclerosis, etc. My understanding is that aging is thought to be in part an evolutionary adaptation against cancer, and a kind of pattern of creative destruction we see all over the place in both nature and society. There are also maladaptive tragic ways to age without remembering/learning how to live in your context, and maladaptive things like premature aging, disease, etc.

All adaptation is contextual. This picture is probably familiar to a lot of people, and is a perfect illustration of what I’m talking about: https://www.boredpanda.com/athlete-body-types-comparison-how...

There is no universal “better”. At any age, in any environment, in any physical condition, there are contextually appropriate optimums, and always two categories of direction: 1) using whatever tools are at your disposal to adapt as much as you can while accepting (and testing) limitations 2) ignoring what tools you do and don’t have and either giving up or trying to get the world to adapt to you.

The first direction is always better.

You should eliminate bad sleep as a potential cause.
I know how you feel. I'm a bit younger at 38, but I can feel it as well. It started around mid-2020 for me. I'm not sure whether to chalk it up to covid, or depression, or natural aging. I hope it's not natural aging, because I can lose my muscles or my youthful appearance, but I cannot lose my brain.
Any chance you've got little kids or for some other reason are not getting enough sleep? Lack of sleep can be very insidious because you can get to the point where you don't notice it anymore except for maybe a vague feeling that you're losing your edge.
If you're interested in it, you still can do it. And coding required many hours STRAIGHT of uninterrupted time to dive deep. Something that you get less and less of as you get older. Plus the distractions (Hello Hackernews).

I have a list of passion project ideas. When there's a new hot technology/language I want to learn, I apply it to one of my passion projects and it becomes more directed and focused on a goal and it goes a lot better than just goofing around aimlessly on a new language.

Yes! Never underestimate the role of distractions, especially in this day and age. Social media, news sites with a steady flow of 'new' information, 10-15 second videos you can endlessly scroll thru, etc. All of that can be fun, but it will play a role in taxing your cognitive capacity.

Not everyone agrees with it, but I highly recommend checking out the concept of 'deep work' (and the book of the same name). There's nothing new about the concept, but there's a definitive history of folks who have embraced the uninterrupted time approach that have been successful with it.

Stop asking Hacker News and start seeing a neurologist. This is a job for a professional.

It could be that you just need a break or some clever productivity hack etc. Or it could be something serious. Better rule that out first.

Whens the last time you had a check up? There are lots of things that can cause brain fog. Lack of exercise, sleep apnea, etc.
> I can't seem to hold more than about 2 levels of call stack in my head.

If you keep thinking that you can't then you won't.

I recommend you to stop worrying and do the work. In time you will find ways to accomplish your tasks. In any case you can't go buy a new brain so why spend time worrying?

Looking at it differently: Even if a young you had greater mental ability, did young you have the same skills, experience, knowledge etc.?

Don't underestimate the fact you likely don't care about what you are doing.
oof, i feel you. when that happens to me, i tend to wish for the code to magically turn into a graph... which is when i fire up bouml or whatev and try to draw a diagram to help me in my quest

best of luck to you

I am about 15 years older than you and I understand the worry. Things do take a little but longer to sink in and a little bit longer to hold in your head (I need to be a little more intentional about remembering and I love having a notebook or random piece of paper nearby to scribble in).

But I think the biggest difference comes when I care about something or not. The other day I was reading through the material for the Full ham radio license in the UK because it's about bloody time I got the Full one rather than the lower level. And because I was interested I easily recalled the next day that the impedance of coax used by hams is typically 50 ohm, television feeds typically uses 75 ohm and ladder line is 450 ohm.

If you're doing something that doesn't interest you don't be surprised that your brain isn't interested either! Also, if you have a life then tiredness, worries, stress, etc. all kill your coding vibe.

Any number of things can affect your ability to handle abstraction. (Including just not being interested.) Other people in this thread will probably bring up all kinds of ideas for external forces affecting your mental capacity.

First thing you should do is figure out what's wrong. Refer to what other people here are saying. Additionally, see if your family history includes a history mental illness or degenerative medical conditions (including dementia and Alzheimers). Everyone knows someone with this, you're looking for a pattern. For example, multiple people in my maternal grandfather's family had been institutionalized and most of the family had bipolar and schizophrenia diagnoses.

And now, how to still get your job done... :)

At one point in my career, my mental facilities became so compromised, I couldn't follow abstraction. Instead of seeking help, I figured out a system to overcome this.

What I did was externalize my memory. Quite literally, I would write everything I needed to paper: variable names, notes on their contents, call stacks.

Once the entire set of function calls where on paper, I could see the structure and continually shuffle things in and out of very limited working memory as I worked to understand and fix issues.

It's slow, but not as slow as you would think.