Readit News logoReadit News
Posted by u/Buttons840 3 years ago
Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.
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?

jb1991 · 3 years ago
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.

tablatom · 3 years ago
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.

incanus77 · 3 years ago
> 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.

Existenceblinks · 3 years ago
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.
mfer · 3 years ago
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.

shanebellone · 3 years ago
I'm 33 and this describes me perfectly too. Some days are clear and sunny while others are dark and cloudy.
Jorengarenar · 3 years ago
>I guess the difference is that in your twenties, energy is almost for free.

Where can I obtain this for free energy?

mythhouse · 3 years ago
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.
safety1st · 3 years ago
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.

diydsp · 3 years ago
> 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...

hagmonk · 3 years ago
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.

ixtli · 3 years ago
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.
curioussavage · 3 years ago
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.
vogt · 3 years ago
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
FPGAhacker · 3 years ago
I’ve had a very successful similar experience with regard to excercise.
djtango · 3 years ago
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.

jb1991 · 3 years ago
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.
LastTrain · 3 years ago
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.
mnky9800n · 3 years ago
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.
denton-scratch · 3 years ago
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.

Damogran6 · 3 years ago
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.

jb1991 · 3 years ago
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.
justanother · 3 years ago
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.
Turing_Machine · 3 years ago
> 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).

djaychela · 3 years ago
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.

softwaredoug · 3 years ago
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....

ljm · 3 years ago
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.

bit-101 · 3 years ago
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?

asah · 3 years ago
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.
WuxiFingerHold · 3 years ago
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.

alfon · 3 years ago
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.
thorin · 3 years ago
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.
spacemadness · 3 years ago
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.
FlacoJones · 3 years ago
thank you for adding "(if you can)" to suggesting they relax...that is real
jjtheblunt · 3 years ago
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).

MuffinFlavored · 3 years ago
> 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?

cstever · 3 years ago
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.

SnaggyJoker · 3 years ago
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.

sowbug · 3 years ago
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.

fullshark · 3 years ago
Without responsibilities your life has no stakes, and no rewards.
bboygravity · 3 years ago
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).

notyourwork · 3 years ago
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.
xyproto · 3 years ago
Life is more fulfilling, but with more responsibility comes more things to worry about.
WhiteBlueSkies · 3 years ago
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.

pentaphobe · 3 years ago
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

amelius · 3 years ago
It could also be attention span problems caused by social media.
sph · 3 years ago
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

hutzlibu · 3 years ago
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.
P_I_Staker · 3 years ago
Or ADHD
Buttons840 · 3 years ago
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.)
matwood · 3 years ago
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.

eternalban · 3 years ago
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.

yetihehe · 3 years ago
> 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).

pentaphobe · 3 years ago
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)

josephg · 3 years ago
> 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.

BlueTemplar · 3 years ago
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).

htk · 3 years ago
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.

throwaway292939 · 3 years ago
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.

jwr · 3 years ago
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.

t00ny · 3 years ago
> 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.

nati0n · 3 years ago
> 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.

don_neufeld · 3 years ago
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.

disqard · 3 years ago
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.

cr3ative · 3 years ago
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.

dkarl · 3 years ago
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-...

bqmjjx0kac · 3 years ago
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.

riskable · 3 years ago
> 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!

pohl · 3 years ago
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.
rightbyte · 3 years ago
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.

eterpstra · 3 years ago
Yesterday's top post linked to this tool: https://www.knotend.com It's a super fast/light flowchart editor. Might be useful!
contingencies · 3 years ago
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/

shkkmo · 3 years ago
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.

ok_computer · 3 years ago
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.
LastTrain · 3 years ago
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.
Starwatcher2001 · 3 years ago
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.

denton-scratch · 3 years ago
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.

agentultra · 3 years ago
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!

gardenhedge · 3 years ago
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.
Starwatcher2001 · 3 years ago
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.

lukehutch · 3 years ago
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.

riskable · 3 years ago
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.

teamonkey · 3 years ago
> 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.

mmcnl · 3 years ago
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.

gardenhedge · 3 years ago
> 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?

xnorswap · 3 years ago
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.

Buttons840 · 3 years ago
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.
aeschinder · 3 years ago
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.

therealdrag0 · 3 years ago
How would DI impact DAU?
jsomau · 3 years ago
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.

linuxftw · 3 years ago
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.
fileeditview · 3 years ago
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.

jxm262 · 3 years ago
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).
caente · 3 years ago
>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!