Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.
596 points by Buttons840 8 months ago | hide | past | favorite | 510 comments
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?




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.


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.


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


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.


I'm 33 and this describes me perfectly too. Some days are clear and sunny while others are dark and cloudy.


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

Where can I obtain this for free energy?


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.


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.


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.


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.


That's right when your eyes change, too. It's so predictable, optometrists can tell you what age you are.


A study https://directorsblog.nih.gov/2019/12/17/aging-research-plas... found some blood protein changes at ages 34, 60 & 78.


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.


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


It's a feature not a bug.


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.


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.


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.


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


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.


> Dexcom CGM

Gen3 app without premium subsciption is very limitied https://youtu.be/c4AVLGwkJHo?t=193


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.


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.


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


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


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.)


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 :(


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.


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’ve had a very successful similar experience with regard to excercise.


Hmm. Do you think we will ever get a pill to replace exercise?


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.


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


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


I’m in the same boat. Sports is a great shortcut but it’s just a lot of mental effort to meet new people.


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.


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


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.


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.


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)


I like the joke "If exercise were a pill, every doctor would prescribe to everyone."


We already have many, the side effects however are... problematic.


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.


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.


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.


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.


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.


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 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!


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.


Yeah old code of ours, reminds me of a now old comic ...

http://notinventedhe.re/on/2011-11-9


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.


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.


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.


I agree - I think cognitive decline is very gradual over life until older age. And experience makes up for it. Some abilities even improve. [1]

Responsibilities seem to multiply. And as you age you sometimes find you're not only caring for kids potentially but aging parents. It's a lot.

1 - https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4015335/#:~:tex....


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.


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?


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.


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.


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


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.


thank you for adding "(if you can)" to suggesting they relax...that is real


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).


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


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.


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.


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.


Without responsibilities your life has no stakes, and no rewards.


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.


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.


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)


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


It could also be attention span problems caused by social media.


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


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.


Or ADHD


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".


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.


> 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'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.


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).


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.


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.


47 years old here, programming daily.

I think what we have to deal with is not just cognitive decline, but more importantly cognitive overload. People in their 40s usually juggle lots of responsibilities, especially if they have a family. At this age you normally also have earned some money, and if you start buying things like a summer house or an apartment for renting out, those things come with maintenance tasks. This can accumulate quickly.

Whatever the reasons are, my approach was to get used to it and work differently. I am terrible at doing multiple things at a time and my short-term memory is bad, so I learned to concentrate on one task at a time and eliminate distractions. I buy large monitors, so that I can have multiple things on the screen at the same time and avoid having to remember (I can easily forget an IP address when switching windows!). I spend money on Apple hardware, because of 5K displays: 5K makes a huge difference, because I can comfortably have THREE columns of code in my fullscreen Emacs instead of two. That means I often have 5 different pieces of code visible, which does wonders for things like APIs, which you mentioned — I can follow the entire path of a call and keep it all on screen.

I also noticed that there are positives that come with age and experience! I find that I'm much better at seeing the "big picture", analytical thinking, design, and predicting potential problems. Most importantly, I'm now much better at knowing what not to do. These skills are invaluable when running your own business.


> if you start buying things like a summer house or an apartment for renting out, those things come with maintenance tasks. This can accumulate quickly.

This is a really good point. I feel like I'm dealing with way more responsibilities now that I have a house and a family, I'm no longer the center of my own universe.


> I can follow the entire path of a call and keep it all on screen.

This seems like a particularly helpful suggestion, both for the original context of the question, but also something I'm likely to use myself. Thanks.


BIG +1 on cognitive overload.

I can still bang out code like nobody's business, even in my late 40's... when I can find 4 uninterrupted hours to get into it. Which is rarely.

It's more about depth of focus, which was so easily available for 10+ hours a day when I was younger.


I can relate so well with the "4 uninterrupted hours to get into it" part.

With family+house responsibilities, I rarely (if ever) have that anymore.


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.


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!


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.


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.


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.


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/


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.


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.


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.


I know the feeling. I'm 62 and I can't go as long or as deep as I once could, but I've changed my strategy over the years and although I'm not as fast as I once was I'm still pretty productive.

What I do is log virtually everything I'm doing in an editor window that I keep open all the time (one file per project/task). If I get disturbed by a call or a colleague, I can do a quick recap and get back to where I was. Likewise if I lose the plot several levels down my stack. It also helps if I need to switch projects for a while, or overnight.

It's like a running log of my thought processes:

- Need to add feature x to module y

- What docs have I got?

  - How to file in d:\projects\docs...

  - Log file from 13/03/2021
- What routines are involved?

- a,b,c...

- Looking at A

   - I'm thinking of adding a new parameter

     - Who else calls this?

       - Routine F

         - The mod would be straight forward there.

       - Routine H

         - This is called by S

           - This needs more thought, it might be chewy

     - What SPs are involved?

       - UpdateCustomerTable(CustName, Address1...)

   - I've backed up the database to ADB_20230110_1501.BAK so I can test.
What it does for me is offload the requirement to remember the previous levels and lets me concentrate on just the one or two things I'm looking at. As I come back up my stack I re-read what I was planning to do next. I use an editor (UltraEdit) which allows me to collapse things I've dealt with so I can see the wood from the trees.

I keep the log files, which go back over 20 years and can be invaluable next time I have to look at the same project months later. Reading the code AND my notes helps me re-build my mental stack much quicker. It also helps with any bugs that I introduce.

Good luck. It is possible to be productive at an advanced age, and still enjoy it too.


I got severely dinged for saying in a standup that I had forgotten what I was doing the previous day.

So I bought an A4 hardback notebook, and started logging everything I did. I wish I had been doing that since I started in this business; it's a really good work habit.


I wish more programmers knew about this!

I keep a lot of journals. Bullet journals for my daily tasks/planning. Long form journals for deep subject matter: maths, graphics, algorithms, etc. Combined with my writing it's definitely been a useful way to see how I've evolved my thinking over time, etc.

Keep at it!


Isn't this what Jira, Azure Boards, sticky notes are for? You reference the sticky note when talking about what you did. If there's no note for it then your planning was probably bad.


I tried paper and log books for a long time (I've got half a filing cabinets worth), but no matter what system I used I couldn't always find what I wanted. (When did I last modify routine xyz, and why?).

Moving to flat ascii files meant it's searchable and has longevity as it doesn't need any specific tool or app. I can also carry the lot around with me - very useful on site.

Cheers.


Well, I never used my log books as an information retrieval system; the prime purpose was to help me remember what I did an hour ago, a day ago, a week ago.

Of course, I have a digital file of timestamped and commented code snippets and pieces of config. But that's just about the activity of coding; I now think a handwritten log is a good idea for anyone, whatever their trade.

The reason I recommend a hardback notebook, is because it offers the best CYA protection (I was caned as a child). It's sorta symbolic - hard evidence, if you like.

[Edit] You can also scribble in your notebook in meetings, while glancing furtively over your spectacle rims, to intimidate the speaker. Hard copy is power.


How do you organize the files? One per day? Task? Project?


I use a heirarchy of folders and within them I create a text file for each main task:

\work\customername\StockSystem

MyCust001 - Interface not updating PickStatus.txt

MyCust002 - Add Stock Check Flag to ScanPullStock.txt

MyCust003 - Look at enhancing Batch Split screen.txt

I use the numbers as a quick reference within all my documents.

\personal\Diving

Diving book recommendations.txt

Diving gas tables.txt

\personal\DIY

Standard screw sizes.txt

Choosing new security lights.txt

Getting new consumer unit fitted.txt

I add the date and time to a line whenever I start, or after a break. (Pressing F7 on UltraEdit does this automatically). I can use this retrospectively to see how long things took.


I'm 46, and while I do think my cognitive speed has declined a tiny bit, my abstract thinking has improved throughout life. The one change I have noticed though is that programming has become insanely complex during the 37 years I have been programming, but more especially during the last 10-15 years. It's at the point now where you can't even create a basic website, to modern standards, without spending months of work to develop it, or without spending 95% of your time on StackOverflow wrestling with bugs and complexities of 7 different pieces of framework that you're trying to get working together. It's utter insanity.

What I suggest for your current situation is to diagram everything. Just buy some big sheets of butcher paper, and draw out the entire nested API structure. Rely on your visual sense so that you don't have to do as many mental gymnastics. Your visual processing center is the GPU of your brain, it has vastly more parallel processing power than the language processing centers of your brain.

Also remember that everyone has different aptitudes. You might not be decreasing cognitively at all, it might just be that this problem doesn't click with you like it does with the other developers.


Don't compare web development with "normal" software development. Writing code for the web is 10,000 layers of added complexity far above and beyond literally any other kind of programming.

"Normal" programming involves writing code that will run on one specific thing with (usually) one specific use case using tools (and often whole languages) made for that purpose. Web programming involves writing code that will run on any number of servers/devices/containers in any number of locations/networks using any number of architectures with arbitrary resources of wildly varying quantities and qualities that serves other servers, desktops, mobile devices, embedded things, and who-knows-what else; also of wildly varying quality/resources and quantities with wildly varying and unpredictable workloads/traffic intensity.

In other words, web development is about 100 orders of magnitude greater complexity than "normal" software development. It has become so bad that "premature optimization" is the norm; because the cost of re-doing things later to support a new feature/device/endpoint or fix an issue (e.g. lacking screen reader support) can be so great that adding a dozen layers of complexity to writing and deploying your code at the start can feel like a bargain in comparison.


> Writing code for the web is 10,000 layers of added complexity far above and beyond literally any other kind of programming.

Video games? Mission-critical real-time embedded code? Operating system development?

I don't want to knock anyone down, but web programming is not the most complex or challenging thing going, it's just software development.

True, it's made more difficult and annoying than it should be, because you need to deal with a jenga-like stack of badly-designed and poorly-documented APIs, forced to use languages and systems with inherent flaws, and have your targets constantly shifting due to the latest fad. But then, that's not unique to web dev, it's just worse.


I agree that web development is complex. I disagree that abstraction layers add complexity. Abstraction layers solve problems. If you don't have the problems that these abstraction layers solve, then you might perceive that as complex, but most people actually do experience these problems.

The web is not just for websites anymore, it's a universal platform for app distribution. This means web apps can instantly be made available to billions of users. You noticed that yourself. This brings all kinds of complexity that these layers solve. They absorb complexity, not add it. So I don't understand why you would say things have gotten "bad". Things were way worse, but individial contributors never noticed.


> I agree that web development is complex. I disagree that abstraction layers add complexity. Abstraction layers solve problems.

True, until there's a bug in abstraction level 6 caused by an upstream change in proprietary abstraction level 3 that's been patched in abstraction level 8, but not for your specific case. Then it becomes complex.


Yes, but in my experience this doesn't actually happen that often as long as you don't rely on external dependencies too much. This happens in any ecosystem btw.


> as long as you don't rely on external dependencies too much. This happens in any ecosystem btw.

I can't think of many 'modern' projects in the web world that do not rely heavily on an often very large number of external dependencies.


> It's at the point now where you can't even create a basic website, to modern standards, without spending months of work to develop it, or without spending 95% of your time on StackOverflow wrestling with bugs and complexities of 7 different pieces of framework that you're trying to get working together. It's utter insanity.

I am interested in your experience and why you think this? It's not true at all from my experience. In the past, making a basic message board would have been pretty difficult. Now it can be done in days. Same with Twitter clones etc.

What type of basic website takes months to develop?


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.


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.


How would DI impact DAU?


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.


I am 40 now and a better programmer/developer than I ever was before. I still encounter similar situations as you but I think you make a mistake by thinking your younger self would have handled this (easily).

The difference is that our younger selves were maybe more optimistic and naive and probably would have just produced a new mess for the next one to scratch his/her head about.

Abstraction is hard and we usually have to much of it in our code bases. You have to break it down and isolate smaller tasks to get started with. Start with some endpoint of the API and try to understand what it exactly does. Usually there also should be an API spec where the ins and outs are defined. Maybe it is easier for you to write this code by adhering to the spec and/or fulfilling existing tests than reading the old convoluted code?!

Probably you know all this and maybe you just hate your task. If this is the case.. sometimes a change is what you need.


I'm 38 and just wanted to comment my experience matches your comment here. I'm probably 20x or more productive now than I was when I first started. Experience does indeed help productivity (to a point).


>The difference is that our younger selves were maybe more optimistic and naive and probably would have just produced a new mess for the next one to scratch his/her head about.

This needs to be highlighted!


Could be burnout, could be ME/CFS, could be Long Covid… could be something else. Have you noticed a limited working memory or loss of enthusiasm? You might notice things like forgetting why you walked into a room, or abandoning hobbies and activities you no longer enjoy. I have ME/CFS from hEDS (far more common than people think, especially here on HN, and double especially those here on HN with ADHD) so I ended up taking a bunch of pharmaceuticals which got me back to work and sharper than ever. One of the core combos I take is a low dose of Modafinil in the morning and Amitriptyline at night, together these act a bit like a triple monoamine reuptake inhibitor but with better timing of action. It’s a reasonably common treatment for depression.

The point is, even if you live a perfectly healthy life with the perfect diet, exercise, and rest, it’s possible that something else is out of kilter and may need serious intervention.

Maybe try a max exertion test for post exertional malaise.


These treatments are legally unavailable to many Americans, due to bullshit moral panics.


They are Rx in the US which makes them harder to get. I’ve not gone down that path so I don’t know how hard, but I’ve read of many Americans using them so it is at least not impossible.

I do think they should be OTC. When I faced the roadblock of not being able to get the medicine I wanted I did go to black market and would do it again in a heartbeat.


I honestly don't think I can, but it might be the best option:

   1. Illegal drugs

   2. Being a head trapped in a jar, hated by all

   3. A bullet
The psychs practically beg you to do it. I was just told to give up ever having a professional career.

Why is nobody talking about this outrageous conduct?

If you mention these concerns, they will suddenly discharge you, and/or treat you like garbage.

All we're doing is creating pipelines to prison. The industry has no problem sending ill people to prison forever. Not only that but droves of people are dying because of these policies.

I'm shopping for a new one, but their initial intake forms are immediately confrontational, and this is someone that seems to have good reviews... I went through several that seemed to have good reputations, and none were taking patients.


I hear you. I've gone on many of rants here and elsewhere on the egregious deficiencies of doctors and medical science. I had plenty of experience with doctors that were unable to diagnose my condition despite it being incredibly obvious so I didn't trust them to treat it from the start.

I just looked it up, Modafinil and Amitriptyline are both Schedule IV drugs for what is OTC in many places, that is pretty extreme.

Marijuana is Schedule I though and plenty of people smoke pot. While it isn't legal the odds are probably in your favor.


I've been thrown to the wolves many times before, having to absorb and trace huge commercial codebases and be productive the same week on making updates and answering questions. Over abstraction is a real thing - real smart developers seem to pride themselves on how much juice they can squeeze out of dependency injection frameworks such as Structure Map and leverage the syntactic sugar of these tools until the solution is almost crystallized with hyper engineering.

I'm telling you this because I don't think it's you necessarily, but that more and more there are codebases that are dense with this kind of thick obfuscating abstraction.

I dropped out of IT when I was 52. I'm 55 now and don't think I could keep up with the constant myriad changes in literally all aspects of tech. Change for change sake is a scourge that lots of companies fall prey to in the name of keeping up which feels to older developers like chasing the rainbow that is just over the next hill...


"the solution is almost crystallized with hyper engineering"

Reminds me of "The grug brained developer" :)

https://grugbrain.dev


42 and I feel the same. If I dig more into what led to this, I can identify two events:

1. Covid. My number came up in September 2022. The mental fog is real and is not what generally people think it is. For me it surfaced as diminished short term memory (example, write down a phone number you see one a website. Before covid, it’d take one or two looks. After covid 3-4 looks back and forth. Hand in hand with this - affected executive functioning. In other words, you just feel dumber lol

2. Burn out. It starts with lack of energy, low executive functioning and progresses into depression and/or anxiety. If this applies to you - get help. Make changes. This one you can fix.

Somewhat related, 41 was the age I realized I don’t want to drink again. Some people have this moment earlier, some never. 1.5years later, the feeling is freeing and awesome. I was not a heavy drinker before but lately I was less and less enjoyable with more hangover (and irritability) the next day.


Programming requires deep thought and concentration. Are you sure the issue isn't simple distraction? I'm 62 and I feel like the major thing that has changed in 35 years for me is the crazy amount of unrelated things (youtube, HN, phone notifications, you name it) constantly competing for my attention. When I was in my 20's I would literally sit in near-silence working for 10-12 hours at a time. Nothing would interrupt or distract me. Of course the Internet has also tremendously empowered engineers by putting a wealth of information at our fingertips, so it's a prototypical dual-edged bladed weapon.


Thats a really good point. In a similar way the number of available technologies gets bigger and bigger as we age, more choices, more to know and more things to fiddle with.

Decades ago the whole MSDOS machine was mine and my tools were an editor, C compiler and linker. Now you need to know a much larger number tools, frameworks and environments before you write a single line of code.


I agree: I'm 58, and I'm not as sharp as the twenty-year-olds, thirty-year-olds, and even forty-year-olds that I pair-program with. To be more specific, the younger developers seem to have a certain mental elasticity that is now beyond me: they can store more in their short-term memory, and they grok code faster than I do.

My brother, who's 18 months my junior and a developer like me, shares the same sentiment: "It's like I used to have 20 registers, and now I'm down to 12".

It's comforting to believe that age hasn't diminished us, but working directly with my juniors has disabused me of that notion.

I feel that Tennyson put it best when he said, "Though we are not now the strength which in old days moved earth and heaven, that which we are, we are."


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


Good call! Better tools make a job easier. Improve your work environment.

Look at your IDE, desktop, editor, OS, monitor, chair, etc. and see how you could improve it with new options. Tech or otherwise...

Is your desk a space of zen? Got a plant on your desk?


I often notice that people rarely remember properly the capabilities of themselves 5 years ago, much less 20. We often think we were better or worse than we actually were. Sometimes I think, oh boy am I rusty today, then I look at my old stuff and realize that I'm so far beyond that it's sad.

To me, it sounds like you are placing too high an expectation on your own cognitive ability, and not spending enough time sleeping. Any project that requires someone to do 4D chess in their heads to complete it is too complicated and no one will be able to maintain it. Start writing stuff down and making diagrams until the design is easier to understand. You are trying to build a city in your head without creating a plan.

Even a back of the napkin drawing can be enough really. Sometimes flaws become obvious when we do this. The value of older developers is they have the patience to do stuff like this, while all the young'uns go winging off on wild projects that they have to re-write in a month.


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.


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’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.


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.


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.


Ah, yeah, that would suck. I guess it’s really only something you should apply to your own condition, never someone elses.


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.


Here is a concrete thing to try. Maybe it won't be useful, but it's helped me in the past.

Get a blank sheet of paper and a writing utensil. Not a text editor.

Start at the top of your call stack and start making a diagram that resembles a directory tree:

    application_code_function(string arg)
      library_function()
        std_lib_func()
Use arrows, add notes on the side. Whatever helps. Try to get one API call stack.

I don't do this often, but it helps especially when I'm not familiar with the patterns used in the project, or I'm having a groggy day and having trouble thinking "deep". It seems to help to me to try and reason about it away from the distractions of the IDE and the OS.


I came here to say essentially the same thing. It seems like this helps students learn programming, and, in some sense, we're all students of whatever new piece of code we're working with today. Some teachers have worked out a fairly comprehensive diagramming scheme for code [0], if you want to take it that far.

[0] "Memory Diagrams: A Consistent Approach Across Concepts and Languages", Toby Dragon and Paul E. Dickson


At around 40 my interest in actually writing code declined sharply. That was after doing it for 30 years, and after it hadn’t really been challenging for quite some time. At the same time, my interest in the “big picture” increased at least as much.

I found that I was much more interested in how the work impacted customers, how we could work more effectively as a team, building relationships across the company I am at, etc.

At 48 I switched from programming to managing. It was a good move for me. I don’t love managing the way I once loved programming, but I periodically reassess and realize that although it’s fun to take a day and write some code here and there, I would be pretty miserable if I were to go back to it full time. I would constantly have to find ways to motivate myself to get anything done.

I do still take those days sometimes and write code for our product, but keep myself off the critical path at all times.

Management may or may not be for you, but it’s something you may want to consider. I wish I had moved over sooner.

As an aside, I had read in my twenties about a theory that claimed something happens physically in our brains as we age that explains this phenomenon of greater interest in the big picture and less interest in detail-oriented work but I have never gone back and tried to confirm or learn more about that theory.


Same boat but for different reasons. I'm 40 and have a 2.25 yr kid. I was doing fine before the kid was born but my mental capacity deteriorated a lot since then. It's a combination of depression, loss of sleep and increased pressure from work.

That said, I still managed to pull out a few nights of programming (the Synacor Challenge) and debugging, occasionally till 2AM while I barely get much sleep because we are trying to ditch the pacifier.

I have a feeling that humans can still burn extra mental energy when really driven, to certain limit. But in 40s we are driven by far fewer things than in 20s, and we need more rest for these burns. The up side is I know ourselves better now than in our 20s so I can at least achieve something. Back when I was in my 20s I spent most of the time playing games and failed to learn anything properly.


I am 50, (been programming since I was 12) and I know the feeling, I used to get like a brain fog but have found some solutions that helped me to get rid of that feeling most days. What worked for me:

D-Vitamin supplements, ZMA (Zinc, Magnesium), Enough sleep, No coffeein after 3-4, lifting weights and endurance training (crossfit), eat whole food which you prepare yourself with focus on proteins and fats from animals.


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.


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.


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.


I've hit the same walls as you have described and found that it's less about cognitive function and more about a combination of burnout, imposter syndrome, and some quirks of my ADHD. I still love to program but when I get the chance to I largely can't organize my thoughts well enough to make much progress, but its because I left a job about 7 months ago where I had been repeatedly hitting burnout in a really nasty several-year long cycle. Now when I sit down to do it I have a thousand things in my brain and I can't stay focused on it. I switched to managing individuals as well over the last few years since I have some natural giftings there but it's made it so that my skills at just zoning in and coding for hours is effectively atrophied since I am so interrupt-driven as a manager (constant emails/IMs and being mindful of my team who I should be supporting rather than my own personal technical goals)..

I've found I need to stop comparing myself to my late twenties self and understand that my burdens are different and I need to set different expectations of myself. As my responsibilities and noise/interference have grown, my ability to do complex design/development has been inversely effected and waned significantly and _that's ok_. I need better tools and to be better at managing my time and energies to be more targeted/specific and I am much more effective than I was all those years ago. I just have to be more intentional and forgiving of myself.


It took me 2-3 years to fully heal from my burnout. Allow yourself more time if it's only 7 months since you quit your burnout-inducing job. The improvement of my energy, my mental abilities and memory is breathtaking, mentally I feel like 18 again (though I am 35 now).


When you were 25 you lacked the experience to see Porting this API will require a deep understanding of the existing API and, ignoring that obvious complexity, allowed you to move really fast.

Also you get those nagging feelings of futility about doing a mechanical task (translating an API) when you know you (or anything else) will 1) make mistakes and 2) have to do it again in five years anyway.

There are two times you buy a motorcycle - First when you know you can't die and Second when you don't care if you do. Sucks to be in the middle (aged).


I just have to reply to this to tell you this comment changed my perspective on my own perceived productivity in exactly this context, thank you.


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.


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.


WTF, AM I ALREADY DEAD AT 42?


:)

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


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."


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.


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)


Doubtful you are declining mentally but should speak to your doctor if concerned. For me at 43 I noticed that my ability to focus has declined. I have so many things competing for my attention that I can't focus on anything. Essentially context switching is killing my ability to get things done. Too many people at work constantly pinging me. Im in a strange position at work where so many random projects are dumped on me, usually all of them are handed to me behind schedule. I have a report I have to generate each week that takes a full day to create. I have a team of contract developers I lead that are just not very good. All day long I get pinged on email, teams, and slack. I start the day with ~15 emails from offshore teams. Constant meetings. Plus my kids get home at 2 from school. Context switching has completely burned me out. I feel guilty ignoring my family and working late but I think I am really going to have to work until at least 7 several times a week just to stay ahead. That or start working from 5am to 6:30am to get a jump on work before my kids get up.


Burnout happens when you're forced to work without motivation. For me (same age as you), two kids and a "life" often soak up most of the motivation. I look at challenging problems in a different way: time travel. When I get fully absorbed into a tech/coding challenge I find that the entire day will slip away. For me, this used to be fun and now it's frightening because I know that a challenge will eat days of my life. For what upside? We already live comfortably. So maybe there's a part of you that doesn't want to go too deep because it's feeling like a waste of precious time.

My recommendation? Focus on tooling. See if you can create a better test infrastructure, a better developer experience for the others. Do you see another way the code can be organized to make it easier to reason about? Is documentation/code-comments lacking? Perhaps your time can be leveraged to help the others. Maybe that perspective shift can unlock your super-powers.


Motivation comes and goes and is unreliable, it's better to be self disciplined and well organized.


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

There could be so many possibilities I'd explore before cognitive decline (at 40??)

1. You are not communicating well enough with team lead / members to get ahead on the task. Maybe they have good advice/feedback that you're not getting because communication is off.

2. You are a bit burned out

3. You ran into some difficulty with this hard task and drove yourself into a state of panic. This panic can feed onto itself and prohibit you from making any progress in a reinforcing loop. Now you're in such anxiety you can barely focus on anything.

4. You're not attacking the problem right. Maybe you can use debug messages, or a debugger, or write diagrams, or a small POC, whatever it is you're doing now maybe you can make some adjustment on how you're trying to solve it.

5. You're not taking care of the basics - sleep, nutrition, exercise. This will basically harm you in countless ways, don't do this.


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, starting at about the same time. Early in our career, we would dig into the details of APIs and patterns and be able to rattle off the details of the changes when a new dot release of an library came out.

As the years have gone on, I've "lost interest" in the details knowing that I can look them up when I need to and have naturally defaulted to generalizing ideas. That is, rather than knowing that we need to change the third parameter in the function call in FOOBAR 3.2 when we upgrade from FOOBAR 2.9 because the details of the memory management changed, I just know that we use the FOOBAR function because it does a specific task that we need.

The reason I bring up my friend/coworker is that he never generalizes, he gets stuck in the details. He can't design his way out of a paper bag, but he can write thousands of lines of code over the weekend with full unit tests and there's never any bugs. So we make a great team, he's one that has focused and has every detail at the tip of his tongue. But he never sees the big picture.

So I view getting older in software as (over) training AI. My brain works in the generalization route and the more I see, the more connections I make, but I need to "make room" in my brain by not encoding the details. My friend's brain works differently. He encodes details and can keep a deep call stack but at the expense of ever being able to see the big picture.

I guess that's a long way of saying that maybe you shouldn't be so quick to think it's cognitive decline. It could be just that your brain is encoding things differently after seeing so many examples in your career.

I know I'd fail miserably at porting an API now (I've done that when I was younger very efficiently). But I also know that I can bring a much higher level of design and ideas to the team than I could have 20 years ago.


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.


I'm also turning 40 this year! You may want to look up crystallized intelligence (wisdom) vs. fluid intelligence ("raw" power) (https://psychcentral.com/lib/what-is-emotional-intelligence-...) and let those concepts process for a bit. We tend to move towards crystallized intelligence as we age, which has many advantages that folks are alluding to here. The key could be to recognize the difference and where your current strengths lie without wishing for the past (probably fictionalized) you. You are who you are now, not what you were. Be mindful and appreciate the experience and strengths you have now that you didn't as a younger person. You might try to organize your work, and maybe eventually change your job/position/title, so that your current strengths are aligned with the expectations. In other words, you don't have to keep trying to be a great programmer, but you might become a great mentor, manager, author, oyster diver, etc. It's the reason many move from engineer to manager or musician to producer. You can actually be much more effective and valuable if your experience can help inform many people's code rather than just your own. You may also want to think about how great it could be not to even try being the "best" programmer. What a relief! Now you can focus on what you care about in your field and perhaps turn your focus outward towards helping other people instead of simply building your own resume.

Good luck and get the sleep you need.


I started to notice somewhat similar earlier in my life, around being 37 years old. I am 51 years old now.

I have an advice: walk daily as much as you can, but no more than two hours, ruminating what is bothering and/or factinates you in your work. Thinking around the exercise time can be very helpful. And walking allows you to think while doing some exercise, which is even more benefitial.

More than two hours of walking may result in more than 12 km of walk, which can be taxing. 5-6 km of walk is OK.

Personally, I also do resistance training and intermittent fasting, but my primary tool is walking and was for a long time.

Right now I am closing the bug that was introduced more than 10 years ago into the system I work with. I have more than four thousands of lines in changeset in more than four hundreds of files, in two unrelated repositories. So I think I am not all that bad at figuring things out.

PS And sleep well! ;)


38 here, I've definitely noticed a bit of a decline in overall power a year ago.

Have you looked into what you're eating and doing for exercise? You definitely cant power through brainfog with caffeine anymore.

try the following to get yourself back on track 1. first meal of the day should be a filet of fatty fish like salmon with skin. if you can't afford this, use a high quality fish oil pill like nordic naturals. keep it refrigerated. omega3 fatty acids are prone to oxidation at roon temperature and there are no official stadards for it in america)

2. limit carbs to whole foods like sweet potatoes, yucca, potatos

3. cut out all sugar outside of whole unprocessed fruit. (juice doesn't count)

4. have a side of greens with each meal

5. start lifting weights, (triggers release of HGH)

6. choose one day per week to do a 24 hour fast.

after 2 weeks, you'll start to feel your brain come back


> first meal of the day should be a filet of fatty fish like salmon with skin.

Kippers!

I don't know if they ever had them in the USA. They seem to be seriously out of fashion in the UK; in the seventies, supermarkets used to sell them in plastic sachets, but nowadays it seems the only way to get them is online (or maybe you live in a town with a real fishmongers).

I don't generally like fish, but I'd eat kippers if I could get them.


> 3. cut out all sugar outside of whole unprocessed fruit. (juice doesn't count)

Juice might as well be soda when it comes to sugar.


I agree,

in retrospect i realize that paren could be read two ways. to be clear, I want to iterate that juice doesn't count as an unprocessed fruit.

Avoid juice like the plague!


Nah, I think your expectations are wrong.

No matter how good you are, nobody is good enough to port an API like you are saying it, by memorising or thinking 9 levels deep. Humans aren't designed for this kind of tasks.

Instead, you should take steps to understand the parts that compromise the abstractions that make up that API and implement it.

Also have good test coverage from both sides, so you make sure you are implemented something that resembles more like a spec.


There's a lot of good, generic advice in this thread, but this is I think the right answer. I specifically scanned for one like this.

What OP is trying to do is quite literally impossible. Not even the best chess players in the world can hold such a big (decision) tree in their heads _at once_. And they might be the most extreme data point we have on this matter.

The way we humans compute needs to be supported by breaking stuff apart and focus on few things at a time on one side, and by abstraction on the other side. Iterating on smaller problems and generalizing the big picture along the way.

Think forest & trees metaphor, or the 7 +/- 2 problem.

Of course as we get older our ability to completely emerge into one task and put all our energy into it generally weakens for a variety of reasons. But there's enough evidence to support the idea that regularly challenging our cognitive ability keeps us sharp and maintains or improves our ability to learn and tackle new things.

What we can't do however is fight our natural limitations and OP seems to try just that.

Additionally, and this might be just as important, this seems to be a very tedious and boring task. The worst tasks are the ones that require a lot of mental effort while also being incredibly boring. It's hard to find a high state of motivation and focus, which contributes to the issue.


I second that. Without taking notes/diagramming no mere mortal can handle nested 9 levels just in the brain. And somehow I doubt that the OP colleagues are doing just that either. The diff between people being stuck and progressing is often how much and how smart they writings things down.

My suggestion would be to try to tackle the low hanging fruits first: find the parts of the lowest complexity, try to understand these and get the simplest things done first. This will also restore your confidence.


I don't know much about your physical state. So, let me just put out some generic advice.

1. Enough quality sleep. 2. Exercises that involves your legs. Somehow leg muscles help the heart to pump the blood back up, keep enough pressure and circulation in your brain.

I'm 35 and I've already experienced the benefit of those 2 and the negative impact of lack of those 2.

Maybe you could be just rusty about that kind of code?


Was going to post this. I become a foggy-headed moron when I don't do these things, and I'm plenty sharp when I do.

My area is blessed with parks and cool places to go for a walk, I hope you and OP have something similar.


I would add that, if both sleep and exercise don’t seem to solve it, then sleep quality (e.g., sleep apnea) could be an issue, especially if a person is overweight or has other health issues (e.g., bad allergies).


Applications are open for YC Winter 2024

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: