Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.
596 pointsI feel like my past self could have handled this task, but I am really struggling. Porting this API will require a deep understanding of the existing API, which, of course, has several layers of abstraction.
I can't seem to hold more than about 2 levels of call stack in my head. There's the entry point function which calls other functions, which call other functions, which call other functions, etc. You know how it is, code calls other code, and logically it forms a tree of calls and return values that often goes several layers deep. I struggle to hold more than about 2 levels of this call stack in my head. By the time I'm down in the weeds I've forgotten what I'm doing, what the purpose of the actual API call is.
I don't know how to break this into small enough chunks that I can understand it or make progress on. Imagine I gave you the code for the sha512 algorithm, and a hash, and asked you to find the pre-image (the input). This is how I feel. Where do I even get started? How do I find even a single chunk of manageable work to break off.
The hard part is, several other developers are making progress on porting this API. Why can't I? What happened?
I don't know if this task is just an especially bad fit for me, or if my mental abilities are declining?
Comments (510) 299 threads
Earlier commentsThere 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.
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.
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.
Good luck and get the sleep you need.
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! ;)
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
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.
Juice might as well be soda when it comes to sugar.
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!
All comments shown.
Couldn't load more comments. Check your connection and try again.