Lurker News
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?

Comments (510) 299 threads

Earlier comments
sky_fan#
I am turning 40 this year, I have personally gone through this in the last couple of years. I do manage a fairly large team and still code, there are lot of distractions. Few changes helped me to keep coding, I went away from dual monitor to single monitor when I wanted to code, it helped me from not getting distracted. Setting up focussed time for coding also helped and its usually sitting in library. Putting phone or any notifications on the laptop to Going for a run or exercising before I start coding helped to clear my head and focus on coding.
nashashmi#
I ran into this problem after salmonella at the age of 28. Cognitive decline occurred after some serious headaches. I had to re evaluate everything. I had to relearn how I took notes. I had to understand how I remembered things. I could no longer work as radial as I used to. And had to switch to linear mode. I had to break down tasks from "intelligent people only" mode to "anyone with a brain".

Of course there were other problems that prevented me from doing that like mental instability. But the whole process took a while. A couple of years.

mattbdc#
In such a competitive field, with more and more younger devs being integrated -- the world's best and brightest -- it's completely normal to feel that way.

But the reality is that what you're going through is probably more about a need to optimize for boosted cognitive function/ neuroplasticity / mental performance / healing at the cellular level. It's what a lot of us are dealing with as we approach or welcome the big 4-0 age. Me included.
Supplements, lifestyle modifications and behavioral changes are beneficial to help optimize for enhanced cognitive function. Here are some that have worked for me.
-15-30 min of sunlight + going for a walk every morning -Cold showers (can alternate hot + cold... or even better, 10 min sauna + 1 min cold shower cycles) -NMN/NAD -Creatine -Vitamin D3/K2 -Physical activity/exercise daily -- for me, weekly, it's 3 days of weight training, and 3-4 days of yoga/core work/rebounding/walking/etc. -Meditation/mindfullness -Social interaction (in person!) -Time-restricted eating/intermittent fasting
Hope this helps. It sounds like your programming skills are exactly where they need to be/up to par with industry standards, so focusing on the cognitive/mental performance area should help boost your workflow/output. Good luck! Really enjoyed reading this thread. A lot of gold in here.

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

Load more comments