Live data from Hacker News

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

news.ycombinator.com

81–90 of 534 posts

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

#81
post #17

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…

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.

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

#83
43 year old software engineer here.

- If you drink, curtail it. - Diet is everything. - Get more sleep. - Get quality exercise. - Find another hobby that is interesting but relaxing, but don't try to turn it into a side hustle. (I restore old guitars)

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

#86
> 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.

Couple of solutions:

- Wider screen (I use 50' oled), and the VS Code pin feature, you basically order the tabs to follow the code.

- Note taking support by using nested bullet points, a.k.a outliners, it could be a simple markdown file, Notion, Roam Research, Obsidian ... Then you write what calls what for what reason, and make it kind of nested story.

- Favourite panel in VS Code, rather than seeing the whole tree of files, you can favourite the same files you are pinning, to come back later on, you can have favourite groups by feature if IRC, this might be an extension and not built in.

On the health side, disclaimer: I'm not a Physician!:

- Do you have old injuries that hurt? I'm using my injuries to know when my diet is causing inflammation, I try eating in different ways until the pain goes away, I bet it affects cognitive performance too.

- Mentally having "too many windows open" like the computer decreases our performance, this is worries, fears, stress. Try to unburden those by talking to someone, or find what other healthy needs your are ignoring, like walking, moving, exercise, contact with nature, playing music, doing something creative, laughing ... sometimes we become one dimensional and that's not good for us.

A way to test if you have lost ability or is just crappy code that does not motivate you to follow, is to talk to someone that speaks a lot with side stories, and then see if you can follow all the branches of the conversation and help them coming back to the original branch, if you are able to do so, might give you more confidence. This of course requires to be present, really listening, which is a skill in itself.

And the last advice, would be to implement some kind of meditative practice, and walk long distances while you listen to Andrew Huberman podcast.

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

#87
Your brain is constantly trying to make itself more powerful and better oriented in your environment. It does this by seeking new and stimulating information, information that adds to your understanding of the world. As you get older, your work becomes a less and less rich source of novelty and stimulation. That means your brain doesn't engage automatically the way it used to. It refuses to allocate cycles to the problem. It reduces the mental resources you're working with to a trickle.

Like you, I'm faced with a couple of APIs that I have to understand. In my case, they are third-party SAAS APIs that I need to evaluate as integration targets for a product I work on.

The odds are very low that I'm going to learn anything of lasting technical value from these APIs. Two years from now, I will probably have to wrack my brain to remember if I ever worked with them directly or just heard about them second-hand.

The same is true of most of the programming I do, especially if I do it well. The alternative is to become one of those toxic senior developers who feel entitled to novelty at work and find ways to make simple problems technically stimulating for themselves, and simultaneously unapproachable for many of their teammates.

How do you stay engaged? You have to remember that you can always solve these problems better than you ever have before. Your solution can be more transparent, cheaper to operate, approachable for new devs, easier to hack on without breaking it, better-documented. You can challenge yourself to finish it quickly or to involve junior devs in its development in a way that is constructive to their growth.

If you don't care about making your solution better in those ways, if you only care about solving little puzzles in code, then you will get bored, because you will look at new projects and know that you can solve all the little puzzles in them, and you won't learn anything fundamentally new in the process.

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

#88
Do you have a family? I find that with a family + a young kid, a lot of my mental capacity/ability to focus for longer periods has diminished.

Maybe you can pair with one of the other developers? If they are junior, they could benefit from your experience and insight and you could benefit from their focus and ability to navigate the massive codebase.

Other things you can try (work for me): getting comfy in a small and cozy room, turning the lights off or putting in noise cancelling headphones. Move the phone away and turn off any notifications. Better yet, have a dedicated machine for coding with no logged in accounts.

Ome last thing, you may have undiagnosed ADHD. Mine became progressively worse in early 30s. Self medicating through caffeine no longer worked for me. The doses that were effective were making me severely anxious and sometimes nauseous. ADHD meds have removed the negative side effects of caffeine and helped me feel a little more normal.

Sorry about the long comment: there’s a lot I can share from my perspective, but I don’t know if any of it helps. Feel free to comment back if you’re interested in touching base.

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

#89
As I’ve gotten older I’ve fallen into this problem but also climbed out of it. It is worrisome that it is permanent, but it likely isn’t. There were several things about my life that I changed that helped me regain my focus and deep concentration abilities.

First was reducing TV, social media, and just scrolling internet news. Doing those things all day was training my brain to have a 1 second attention span. A vacation, if used to just chill out and do boring things for hours at a time can help snap you out. Your body and mind don’t want to live in that frenetic state so your stress will reduce too.

Diet and exercise is also important in making your body run as it was designed and helping your brain to be in a more relaxed, nourished state that will give you more mental stamina. Exercising first thing in the morning is good, but anytime you find your brain conking out is a good time for a run and often i’ve felt better immediately. Cardio helps me, I don’t know about weight training.

Diet is very important, and if you eat lots of carbs, especially late in the day you probably aren’t sleeping well and you might have high blood sugar that is impacting your ability to concentrate. Reducing carb intake, eating good breakfasts and light dinners, and not eating for several hours before sleeping (go to bed hungry, you will sleep much better and feel better in the morning) can make a big difference. If you work remotely and get drowsy after eating and you can take a nap early in the day, go for it!

Also just doing whatever it takes to calm yourself down and sleep long and deep night after night can help a lot.

At this age it is also a very good idea to get blood work done to see if there is any imbalance which could be affecting your well-being.

Finally, like muscles our brain seems to atrophy over time and strengthen as you use it. If you’ve been coasting for a while and haven’t had a real challenge, it might take a couple of weeks of frustration before you rebuild that mental stamina.

All of these life changes are very difficult to do at first, but once you make the change and feel the effects it becomes a lot easier and you feel so much better. I’ve done everything I mentioned here and gotten back my ability to learn and focus to a similar level as my younger self.

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

#90

I'm a little bit older than you and have been in the industry for almost 30 years. I have a different perspective than mental decline. I think it's that after seeing code and patterns for so long, you might be defaulting to generalization of ideas. I know that I do that. For example, one of the best developers on my team (a little bit older than me) is "on the spectrum". We've worked together for nearly 20 years, sta…

Interesting perspective, thank you.

Code is the author's though processes made concrete (in a sense), and some people just think differently, some people are just incompatible. Over the years I've seen some codebases considered good that are easy to follow and I like them, and other codebases considered good that just seem to grind my mental gears even though I can't put my finger on any specific problems with the code.

Post reply on HN