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?
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.
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
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.
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.
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.
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.
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.
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.
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.
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...
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.
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."
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.
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.
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.
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.
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 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.
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.
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.
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.
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.
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'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.
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).
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.
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.
- 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)
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.
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.
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.
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
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.
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?
Give yourself some breathing room and try to move the code towards something simpler. Find some business logic level mental hooks upon which you can take bites out of the existing implementation.
For pure coding, I am writing simple functions and precise data types only, and actively avoid all the clever abstractions I used to push for in the past. I won’t argue about any styling or naming conventions - configure an on-save linter and done.
And for APIs I‘ll look exclusively at the given spec/schema/whatever - and only grep through legacy implementation code if I suspect edgecase handling there.
It’s not being unable, more like extremely unwilling to immerse in just another messy code pile.
I can relate to this sentiment over the past few years. The other variables, for me, are that the demands of raising a young family have grown, my day job has shifted into more of a maintenance mode with less latitude for creative development, and my family has recently suffered a tragic loss. During this time, I've been astounded how much more difficult it has seemed to accomplish fairly straightforward tasks compared to just three years ago. So I've also wondered if my mental ability has been on the decline.
Yet, this past year I've had two new interests spring up - one possibly a new career path, the other an avocation - and despite having precious little time to devote to them, I have been finding that I'm learning at a rate that I might never have achieved before - even in my 20s. I've somehow found myself with a "beginner mind" again, and at times I feel like I'm on fire. And I'm in my mid 40s. I can't explain where any of it came from (one path quite literally took off after reading a post on HN!) - it all seems spontaneous.
My little piece of advice is to be aware of these kind of nagging thoughts that take hold in your mind. Ask yourself if they are provably true and, whether true or not, they could cause harm. You never know what's around the corner, so it may behoove you to stay open and keep these nagging thoughts out of the way!
A big difference I find between myself as an engineer now (40s) vs myself in my 20s is that I have the education, experience, and wisdom to appreciate elegance and simplicity. When I was younger I would throw myself at a problem and keep adding code until the program did what I wanted. I could only imagine what people meant by "elegance," and "simplicity." These days I rely more on mathematical reasoning and think about the problem before I start writing code. I feel as though I can finally see that simplicity is not effortless.
Barring very specific health complications, cognitive decline is not a major factor for most people in their 40s.
Most programmers are fooling themselves if they think they can keep the state of more than a handful of variables in their head and detect errors or understand the entire control flow. That's a code smell, a problem, something that should be addressed. After all: if you can't understand the code, and the next person has difficulty as well -- if you need to make a change to it, how do you know that the change you've made is correct? Do you know that this code does what it's supposed to?
* the project I'm on is not "mine". I joined a sub team of ~30 programmers who've been working on a 5 year project. I'm not familiar with the code. this in contrast to previous projects where I was a lead / main contributor. I wrote the initial implementation so I had a very clear view of the structure of the project in my head.
* the project I'm on is not a passion project. I got very luck that most of my career I got to work on things I wanted to work on so I had passion to make them great. my current project I don't feel that. I'm sure part of it is coming in late. I think it's great project but my heart isn't in it the same way it was for many past projects.
As a counter example, I got permission to prototype something on my own for a few weeks. I worked ~80 hours of over time those few weeks because I was so into it and I felt super productive because it was 100% my code that I understood, no waiting for code reviews etc... I appreciate code reviews but compared to prototyping without the feeling a productivity without is incomparable.
* my passion for coding seems to have dwindled. maybe this isn't true given the previous paragraph but coding things I used to spend time exploring I have a hard time working up enthusiasm for like I used to.
I can't help but think of Donald Knuth, aged 85, sat in his home office somewhere, still chipping away at some of the hardest problems in computer science.
It sounds like your problem is something more temporal. For instance, someone else here mentioned about other stresses and responsibilities in your life for example. It might be that it's just a boring and arduous task, not everyone excels at tasks that are just not that interesting. Besides, I don't think the vast majority of us are good at remembering layers and layers of calls and abstractions.
My advice is, there's probably nothing wrong with your abilities or your brain, just try to work on small sections at a time and don't be hard on yourself. We're not 100% all of the time, there are so many factors that play a part in how we perform on each task.
I'd also say that, 40 isn't particularly old, it's easy to think that when so many engineers are in their mid-20's, but in the grand scheme of things, your cognitive abilities probably haven't changed all that much since you were twenty-something. Hang in there mate.
But I'm not perfect. I'll miss a detail, I'll get a message in the chatroom, I'll take a stretch break. I'll forget. That's not just me being 40, that's me being human.
There's also the fact that when you're younger your body lets you get away with "murder": Drink lots of coca cola, eat junk food, sit for hours, never hit the gym. An apt metaphor would be that you had a 10k PC for gaming and lots of games that were not optimized properly but run well enough due to the hardware being that good.
The older you get, the more your bad habits bite you. So it's not just age decline but every lack of maintenance and abuse of drinking, smoking, junk food comes to take its toll. You know, the "I can do that while I am young" kind of habits.
What I'm saying is, it's more than aging that it's at fault. We just like to correlate aging with it because it takes years for the side-effects of all the poor habits to manifest themselves to take effect.
I want to work with programmers like you. I really do. I don't want colleagues that can dive through stacks untangling complicated messes effortlessly. I want colleagues that are sensitive to every cognitively burdensome aspect of the codebase and _need_ to fix it to continue working. These are programmers that will be methodical and wholesome in their approach, and will deliver code that is easy to work with. I'll choose a programmer like you over a young-gun-star-code-cowboy every day of the week.
That said, if I were you I'd ask myself if the problems I'm having are inherent in the problem I'm solving, or in the approach I'm taking. I'm somewhat younger than you, but I have horrible working memory (sounds similar to what you're describing), and my self-development as a programmer has been mostly centered around finding ways to make that irrelevant.
Also, you might be interested in the Huberman Lab podcast. He's a neuroscientist and has episodes about ways to improve things focus and creativity.
When I cut glutenous foods from my diet, mental clarity was restored.
NOT saying "gluten-free" is the correct answer. Just saying there could be underlying issues with a symptom of brain fog.
My wife got diagnosed at 42 with sleep apnea, with no prevalent cause (she's not overweight, does not smoke, etc). Turns out it's just her brain that sends the wrong signals to her breathing when she sleeps. It was life changing. She always felt tired and felt like she could not do her job properly. She got a CPAP machine and now she's feeling better than ever.
Slightly tangential, and perhaps abstract, but nevertheless applicable - two counterintuitive ideas that might be helpful:
1. Keats' notion of Negative Capability. We always think of abilities in the positive but often beyond a certain point dealing with the uncertainties is an ability in itself. More at https://www.leadingsapiens.com/developing-negative-capabilit...
2. Maslow's idea of Second Naïveté. Domain mastery can easily turn into increasing cynicism. Have to be on the alert for this. The masters are somehow able to reengage as beginners and push past what others find mundane. More at https://www.leadingsapiens.com/naivete-in-leadership/
TBH I thought all those ads for brain training were a load of BS, but I recently finished reading The Brain that Changes Itself by Norman Doidge, it's an older-ish book at this point but there was a lot of info in there about how the brain works that I didn't know. Neuroscientist Michael Merzenich's https://en.wikipedia.org/wiki/Michael_Merzenich work pioneering brain plasticity with cochlear implants and expanding that research into autism is highlighted at the beginning of the book and it's pretty damn interesting.
BrainHQ was started by Merzenich, and it's cheap. Figured why not give it a shot?
Maybe this will help you too, but I would recommend skipping the intro chapter if you do decide to read it. I almost put it down because the example being given in that chapter was so obviously fake and contrived. But ultimately I am glad that I continued reading it and would recommend it to someone in your situation.
One simple trick that works for me sometimes is to create a "clean room" for the brain: e.g. change work environment and/or isolate for a fixed period pushing all other deadlines further out. Remove the external pressure and allow time to get into flow.
Ofcourse it might be that what you have to do is materially more difficult than previous tasks you handled. Using mental support tools (notes, diagrams etc) might bring it back within reach.
You're having trouble finding the motivation to deeply understand the original API.
So, cheat your brain with busy work:
- find typical use cases (hopefully the original was written around use cases)
- use it in the original language, write toy programs
- look for concepts and symmetry (i.e. open/close, add/remove, handles, whatever) that reduce the cognitive load
- mock a rough translation in the target language (it's not final code, hacky works)
- slowly port your toys
- watch for gaps... wash, rinse, repeat.
In the meantime, sometimes finding something mechanical to pursue that moves the job forward may help.
For example, mocking all API calls in the target language, following the original structure. TDD? Build a tool to make the target API shims?
It takes time to absorb something that's not calling you, but you can get there.
At age 40, there are a lot of responsibilities, and taking care of yourself and your health can get pushed to the side.
Take time to eat healthy and get exercise. It is amazing how much a healthy, fit body invigorates the mind.
Yesterday I realized that a hard-ish problem in my tiny shell script testing library https://github.com/pmarreck/tinytestlib which I had worked on for over a day was completely moot, and ripped it out while facepalming.
Incidentally, I'm looking for work as... well, the above things, although previously I was a solo Elixir dev.
At the downtime I felt like +20 or 30 years older and gone retarded. Can't do any more hard brain work, and felt like I can't do that ever.
But this will pass.
My advice would be to visit your doctor, asks for a general round of blood tests to check everything is okay, B12, liver function, cholesterol, kidneys, etc. Do the lot. If they show something isn't normal then you can focus on dealing with it, but just as importantly, if the results don't show anything you can rule out your physical health as the problem and focus on other potential causes.
I'd place a small wager on learning you have a clean bill of health helping you get out of this slump, or could go a long way to getting your mojo back.
Best of luck!
Also, being older we have a lot more on our mind. So methods to help organize and focus are more useful than ever to me now. Take notes, keep logs, etc.
For maximum effectiveness, do not try to multi task while doing this. Just think about the problem and let your brain sort it out on its own. Major difference with and without is the lack of tiredness of mind when attacking hard problems. Brain keeps hacking at it till a solution is found.
Of course there were other problems that prevented me from doing that like mental instability. But the whole process took a while. A couple of years.
But the reality is that what you're going through is probably more about a need to optimize for boosted cognitive function/ neuroplasticity / mental performance / healing at the cellular level. It's what a lot of us are dealing with as we approach or welcome the big 4-0 age. Me included.
Supplements, lifestyle modifications and behavioral changes are beneficial to help optimize for enhanced cognitive function. Here are some that have worked for me.
-15-30 min of sunlight + going for a walk every morning -Cold showers (can alternate hot + cold... or even better, 10 min sauna + 1 min cold shower cycles) -NMN/NAD -Creatine -Vitamin D3/K2 -Physical activity/exercise daily -- for me, weekly, it's 3 days of weight training, and 3-4 days of yoga/core work/rebounding/walking/etc. -Meditation/mindfullness -Social interaction (in person!) -Time-restricted eating/intermittent fasting
Hope this helps. It sounds like your programming skills are exactly where they need to be/up to par with industry standards, so focusing on the cognitive/mental performance area should help boost your workflow/output. Good luck! Really enjoyed reading this thread. A lot of gold in here.
First was reducing TV, social media, and just scrolling internet news. Doing those things all day was training my brain to have a 1 second attention span. A vacation, if used to just chill out and do boring things for hours at a time can help snap you out. Your body and mind don’t want to live in that frenetic state so your stress will reduce too.
Diet and exercise is also important in making your body run as it was designed and helping your brain to be in a more relaxed, nourished state that will give you more mental stamina. Exercising first thing in the morning is good, but anytime you find your brain conking out is a good time for a run and often i’ve felt better immediately. Cardio helps me, I don’t know about weight training.
Diet is very important, and if you eat lots of carbs, especially late in the day you probably aren’t sleeping well and you might have high blood sugar that is impacting your ability to concentrate. Reducing carb intake, eating good breakfasts and light dinners, and not eating for several hours before sleeping (go to bed hungry, you will sleep much better and feel better in the morning) can make a big difference. If you work remotely and get drowsy after eating and you can take a nap early in the day, go for it!
Also just doing whatever it takes to calm yourself down and sleep long and deep night after night can help a lot.
At this age it is also a very good idea to get blood work done to see if there is any imbalance which could be affecting your well-being.
Finally, like muscles our brain seems to atrophy over time and strengthen as you use it. If you’ve been coasting for a while and haven’t had a real challenge, it might take a couple of weeks of frustration before you rebuild that mental stamina.
All of these life changes are very difficult to do at first, but once you make the change and feel the effects it becomes a lot easier and you feel so much better. I’ve done everything I mentioned here and gotten back my ability to learn and focus to a similar level as my younger self.
Your mental abilities aren't declining. You've got a lot more going on in your life than you used to.
Do you have a lot of attention draining responsibilities? Do them after your programming time.
Are you a coffee drinker? If so, consider adding green tea to your routine. It will help smooth out the peaks and valleys of coffee.
Are you anxious and stressed? That will be very distracting and lead to feeling overwhelmed. Very counterproductive.
As we age, we become more aware of the limited time left to us to realize our goals in life. Suddenly, projects we take on can't be just about learning something new or advancing our careers, they start to be in competition with other values and dreams. Maybe what you're working on isn't able to supply a sense of purpose. That feeling can be very draining.
When all else fails, focus on what you can do, not what you can't. Get the system running and spend some time with it. Find things in the old code that are interesting to you. There are stories hidden in legacy code. Think about yourself relative to the craft and those that came before you. Ask to sit with the productive members of your team for a bit, just to ride shotgun and spend some time with a colleague. Rediscovering some of the sociability of coding can be very restorative. A spirit of comraderie can be the difference between apathy and enjoyment.
Also, you might not be getting enough physical excercise. Probably the best anti-depressive/stimulant there is.
I'll be 60 in three years, and it's much easier today for me to learn a new programming language, paradigm, API, etc, than it was twenty years ago. The reason is because: I spend a lot of personal time constantly learning new things, specifically focusing on things that seem scary and uncomfortable, not necessarily complex. If you already know Java, learning C# isn't much of a challenge for your brain. But if you've only programmed using Object-Oriented Programming, try a different paradigm entirely, an environment that's very different, including a different text editor.
Too many developers are too focused on sticking with what they know and optimize for learning the least possible. This is good and bad. It doesn't train your brain to deal with change -- very big change.
So if you've never used vim, force yourself to use vim on a project for six months. If you've only used vim, used Emacs. If you only develop on Linux with Tmux for cloud apps, go get yourself a cheap laptop with Windows, install Visual Studio, and try creating a WPF desktop app. or a Mac with an iPhone.
Back to vim. In my day-job I use Visual Studio. I have some side-projects that I work on that are entirely different environments. One is all NodeJS based using VS-Code. The other is Clojure using the repl. A third is using C and VIM, using raw gnu make that I hand-update. I also use both a Mac and Windows every day, which also adds the challenge of different common keyboard shortcuts on each.
So next time you got a problem to solve for yourself, write a commaand-line utility that is useful to you using C and VIM. Take it slow. Spend an few hours a week. You'll find that you'll have to get much better at context-switching, so you have to leave notes for yourself on what you're doing, where you left off, etc., much more than you do now.
The key is to force your brain to be uncomfortable, especially as you get older, even after you retire.
p.s. I seem to recall hearing John Carmack on some podcast talking about things like, where he recreated Wolfenstein 3D in Haskell, or tried using VI (not even VIM) on a project. I'm not sure what his reasons are, but hey if a strategy is good enough for Carmack, ....
> The code I'm porting is average code, not terrible, but plenty of little things to complain about.
There might be a third option: struggling is a signal that API is convoluted. The code might be alright, but the design is bad.
You seem to be focusing a lot on API implementation (how it's done in another language), not the interface (what the API is doing).
Ask yourself: can you easily explain what should happen when each entry point is called?
If you can, why are you so attached to the old implementation? You should write it from scratch without relying on the old code. Old code is there to expose past knowledge (e.g. edge cases you might have missed), but not as a base for new implementation.
If you cannot, then API has a bad design. It might be alright for computers, but not for humans. Obviously accepting that it is bad doesn't solve your problems.
I had a similar case when I was ~28. What worked for me, is having a picture of how I would build it today, if I were to do it from scratch. This picture is usually much simpler and easy to keep in your head. Then, understanding the diffs between old and new design. The diffs essentially are the flaws of the old design, but now they are also the requirements you have to implement (assuming fixing API interface is not an option).
GO TO THE FUCKING DOCTOR!!!
If you're noticing something wrong or different with your body, go to the doctor to rule out something medical. Then continue your investigation. A doctor wouldn't try to diagnose you based on what you've written in your original post, so I wouldn't weight too heavily the opinions of a bunch of NON-DOCTORS with zero skin in the game.
For me - it helps to step away from work. I mean, really step away to the point I completely forget about work. Go play pickleball, take a day trip, hike, swim, camp, try something entirely new that you have never done before (skydiving, SCUBA lessons, cross-country skiing), etc. The goal is to become immersed in your environment to the point it requires a great use of your mental capacity - in a way that is engaging and fun.
Even if I don't feel like stepping away from work and I disagree with myself that the issue is actually becoming too immersed in my work for too long, I have learned to simply default towards leaning on experience and getting away for a while.
By the time I come back to the same problem if I haven't already gathered a good idea as to how to go about it, I will at least have a new perspective; it's a win-win.
Please take care of your mental health, take care of yourself and don't be too hard on yourself. Give yourself a second chance, draw things out, get out of the office, take a break, and come back and approach the problem after you've refreshed yourself!
We only have so much working memory, life at times can take up much of it. No need to try to force our brains to do so much when you can do your thinking on the paper.
Paper notes are also great for being able to get up and come back to a subject. You can get up at any point and come back with a save state of what you were doing, and how you got there.
> I do have memory issues compared with when I was younger, but I've been coding so long that the total set of stuff I know about is huge comparatively. I'm also much less intimidated by technical challenges since I have a lot more techniques I've successfully worked with and I'm more patient with problems.
> I'm definitely not the same programmer as I was in my 20s, I can't do weeks of 12 hour days in front of the computer like I could then, but now I have a much better and more intuitive understanding of what needs to be done, so I waste a lot less time.
https://news.ycombinator.com/item?id=33530972
Older athletes can't compete with younger athletes on pure physicality, so they have to use other skills: intuition, patience and wisdom are three things that come to mind.
You aren't the same programmer you were when you were young.
Good.
Life would be boring if you were.
Maybe the right role for you here is to establish a good, clear test suite for the transformation to ensure that the API transition maintains semantics. That should also teach you the subtleties of the API, making the work easier to deal with.
Another piece of advice I have for people dealing w/ their CPU slowing down is: just go. Hesitation because we aren't as good as we once were kills a lot of older developers productivity and knocks a lot of good developers out of the game. Just go.
If the problem is serious, by all means do see a physician. He should be able to diagnose burnout, if nothing else -- which I believe is the most probable cause. There are many programmers in their fourties and older that do fine. Don't believe the agists.
First thing you should do is figure out what's wrong. Refer to what other people here are saying. Additionally, see if your family history includes a history mental illness or degenerative medical conditions (including dementia and Alzheimers). Everyone knows someone with this, you're looking for a pattern. For example, multiple people in my maternal grandfather's family had been institutionalized and most of the family had bipolar and schizophrenia diagnoses.
And now, how to still get your job done... :)
At one point in my career, my mental facilities became so compromised, I couldn't follow abstraction. Instead of seeking help, I figured out a system to overcome this.
What I did was externalize my memory. Quite literally, I would write everything I needed to paper: variable names, notes on their contents, call stacks.
Once the entire set of function calls where on paper, I could see the structure and continually shuffle things in and out of very limited working memory as I worked to understand and fix issues.
It's slow, but not as slow as you would think.
In my twenties, I can churn out things pretty much non-stop. I think I was trying to "prove it" and I could clock extras in the evening and weekends to move ahead. I could do something repeatedly until it was better than the last. I also tend to take on other people's tasks a lot.
In my thirties, I was still shuffling, not just me and my task but many other people too. I loved the messiness of deadlines, the near-misses, taking on new things, and being in the front of the battle, fighting in it and not flying over it.
I have now hit my forties; I realize I like to take time but do it right the first or second time. I also want to selectively do things with an outsized return on my time invested.
In short, I would have liked a Gatling gun in my younger days, but now I want precise sharpshooters. I'm of the opinion that it is OK to slow down, breathe, and take more targeted precision strikes.
Second, what you are doing is one of the most boring work there is. Try to find automated translator that can speed up the process (a least the boring parts). Writing one is not an easy task for most folks so I am not advising DIY. If you are doing this work for a 2 weeks or more maybe you are just bored?
Did you notice mental decline in other tasks? LeedCode & stuff? Chess? Forgetting words? If this is only work related it may be burnout. If not, you may try to revisit your lifestyle: did you recently gained weight? are you eating healthy food? do you have enough exercise? In any case it may be a good time to make an MD appointment.
Of course the code can also be particularly convoluted with some domain-specific knowledge that you may not necessarily be an expert on, so in that case, I'd find someone to ask questions or or an intro book until you can get to an 80/20 situation, where you feel like you understood most of the domain context.
If it's not the code, take a break. Long walks in a place with trees helps clear the mind. Longer sleep, exercise to get the blood flowing, no alcohol. All the usual healthy stuff.
You could also try to draw the data flow on a whiteboard, in a "follow the money" kind of way.
Alternatively, if time permits, try to reimplement the algorithm or solve the problem yourself, in your own preferred language/environment. This will get you sufficient knowledge about the functional requirements where you'll be able to see what the author of the code you're porting was thinking, since they likely encountered the same challenges as you.
If nothing else works, you can just be honest with your manager and try another project that feels like it would be easier or more fun.
Good luck!
I think its a problem with the way we write software. I think all code we write should be visualizable at different levels of granularity, and should be able to show data flowing through it inline. We have all these principles about writing good software such as it should be testable, performant, self-documenting...but I would argue the most important thing is that it should be visualizable! And easily debuggable.
---
I would suggest using a visual debugger and an IDE with static call hierarchy features (sometimes called find usages or find all references).
You should think about how you would build it from scratch. Then fit the existing API to your own mental model of how you would build it. Then it will be easier to understand why people did things a certain way. Many times I will see someone's code and wonder why they came up with such a complicated abstraction layer, but then when you build it yourself you see how it comes very naturally. The problem is for most projects you are looking at the end result of someone else's journey of building from scratch and refactoring along the way as needed.
You didn't mention tests. How do you know their 'progress' is actually correct or even good?
I'm presuming the 'several other developers' are younger than you, hence your concern about age. Without some measuring stick to know if what they're doing is correct, you can't tell if they're just doing more work or actually doing it correctly.
> How do I find even a single chunk of manageable work to break off.
How is anyone else finding work to break off? Is this a free for all, or are there any planning sessions to identify things? Without that, you might be overwriting or reworking something someone else already did.
You may want to ask for some pairing with someone else who you think is doing this better/faster than you, and just ask to work with them for a couple hours.
Talking through the problems with someone else might help turn a corner with respect to mental models. How are they reasoning about current code? How are they tracing through the paths? Someone else deep in this problem may be able to come up with language or examples that resonate with you in a way that random HN people can't.
If you keep thinking that you can't then you won't.
I recommend you to stop worrying and do the work. In time you will find ways to accomplish your tasks. In any case you can't go buy a new brain so why spend time worrying?
Looking at it differently: Even if a young you had greater mental ability, did young you have the same skills, experience, knowledge etc.?
I just sat down and was typing a much older passphrase despite having used the current one daily for over a year. That was probably the scariest part is that I remember the past few weeks as if I were using a different passphrase than I actually was (down to having typos on my phone that are impossible with my actual passphrase)
Are you depressed? are you burning out? Are you eating well? Are you exercising? Are you disengaged? Are you socially engaged? Are you anxious?
You need to step back from the tasks you’re finding difficult and look at yourself not as a programming machine but as a biological entity with a complex giant dna mutation brain that can easily get thrown off track due to any number of factors. Most likely unless you’re developing some sort of early onset brain disease you are depressed, anxious, burning out, or simply aren’t interested in what you’re doing. By 40 things get complex because the newness of “OMG IM AN ADULT” wears off and just simply working isn’t enough, especially in a task that requires “flow” of intentful mindful engagement.
I suspect you need to step back for a bit and look inside yourself very critically and examine what’s going on. To me it sounds like probably a mixture of all of the above, leading to a growing burnout. My suggestion that worked for my burnout is take up a rigorous practice of vipassana meditation, regular exercise, managed diet, and rigorously constraining work focus to when it’s appropriate and otherwise entirely letting go of the pressure to perform. Then when working not engaging in second guessing your output - we have ups and downs, the important part is enjoying the process of programming. But YMMV, I would start with taking those questions above and asking the people closest to you them and take their answers seriously, see a doctor and explain your challenge, and see a psychologist and explain your challenge, and spend time seeing yourself for who you are not who you think you are.
Good luck!
Here's a verbatim example from my notes that I think is similar to your use-case:
```
* Clones `std::vector ```
Just to cover all bases and include external factors, use of Statins could cause reversible cognitive decline (source: https://www.fda.gov/drugs/drug-safety-and-availability/fda-d... )
Statins is a big business for Pharma, and they continue to push these for “managing” high cholesterol. The risks associated with statins is far higher than the benefits obtained from consuming one.
If you are being prescribed Statins, please review these videos
https://nutritionfacts.org/video/are-doctors-misleading-pati...
Disclaimer: I’m NOT a medical professional and this is NOT medical advice
in terms of practical advise: more haste, less speed. ive no idea how the code is organised but consider porting it in layers (e.g. data access, business logic, helper functions) as opposed to API endpoints. Layers should roughly be decoupled things with clear interfaces between them. The stuff on the same layer should have the same concern. That way you can go breadth and not depth first and tackle one function at a time. Once you have a mapping at a function level from the old to the new code base it should be easier to plumb the API.
I also had that difficulty when I was a younger developer. The difference now is that the novelty of learning how to program at a professional level, learning a new language, and learning a new framework, isn't there.
Instead, the novelty comes from convincing others not to make the mistakes I would have made 20 years ago; and not making those same mistakes myself.
I was in your shoes, things I'd find frustrating are:
- The original version was working fine; a rewrite just isn't justified.
- Some team members are writing poor quality code, and I just can't convince them to do it right.
- The original version has style / habits that make it fragile or hard to understand.
- The original version has behavior that's generally not understood.
¯\_(ツ)_/¯
p.s. thank you for sharing these concerns - it's brave of you to talk about mental worries in an industry where "smart" is a superpower. Good on you, brother.
Now we may be 40 and find such traces, but this issue is also growing rapidly with younger folks today, as their rate of consumption has further increased in the information jungle.
To forget is human, but occasionally we also tend to forget some crucial info that we sure knew some time ago, and that's when it bugs. This is what motivated me to create a solution for this universal issue, and started developing a system that seamlessly works alongside as a personal extended brain (our own coprocessor) that just cannot forget. If this is something of interest, it'd be great to hear from you (@shrix).
Others have already mentioned this but I think it's important to reiterate sleep quality. I learned I was not getting enough oxygen at night due to congestion when I went to the doctor for problems with tiredness and brain fog. Taking nasacort each night before bed completely changed my life.
I don't know if this would help, but I'm in my later 20's. I didn't actually know how much my mental health played into how I performed, cause I felt fine. I went to a therapist it turns out I've been *redlining* anxiety most of my life I just got used to constantly operating at that level, and I was wondering why I wasn't getting the performance I thought I could give when doing fun non-stressful environments. It just snuck up and built up over years and that became a normal for me.
It may be time for a change. It's probably a programmer's version of a midlife crisis. You notice that your remaining (productive) time is limited and running out quickly. While porting code from one language to another can be fun, I doubt this fun extends to mindlessly porting APIs. Your brain may just be rebelling.
Also try using GitHub Copilot in the unfinished project with all the relevant files loaded into the current project. Then try writing code comments explaining what the following function does. Basically, try supplementing your own human intellect with the machine intelligence. It’s already unbelievably good and is going to get so much better in the next 1-2 years, and then you will already have a head start on how to leverage it to the maximum extent. Good luck!
Today it'd take me much longer, and the end result would be better. This is experience, because I know many of the ways in which a port could go sideways. The way I deal with massive bodies of work would be to handle it in well tested small pieces. If you're having difficulty figuring out how to arrive at these small pieces, then that's the challenge right there. You'll get good at it by working towards it.
I know that, despite my age (44), its not cognitive decline. It's experience and the end result of my work is simply better.
I'm in good health but I do have less energy, like a higher horsepower engine with a smaller tank. I don't have a problem with the tradeoff...
Here's what I did and it seems to help tremendously:
1. Get plenty of sleep.
2. Get fit. As part of this, get your weight down to a health level.
3. Eat right.
4. Get your weight down to a healthy level. I don't know if it's related to circulation or respiratory or what, but my body/mind function better when my body weight is lean.
5. Reduce inputs, such as podcasts, HN, Reddit, etc. Don't stop entirely, but take occasional days or weeks off from one or all of the above.
6. Spend more time doing nothing, being bored, in thought, like we did before the Internet.
7. Be at peace and work on the top 6 the best you can, and forgive yourself when you can't, and get back on track ASAP.
You will fall off the wagon on your goals. Recognize it when you do and immediately forgive yourself and get back on track. Immediately.
As I've gotten older (and overall more competent) my threshold for novelty / interest has gotten higher. Drudge work, that once might have been fresh for a younger version of myself, now feels repetitive. I already "know how" to do something, since I've done things like it before, and as soon as I sketch out the high level overview in my mind grinding through the implementation bores me. It's simply become harder to find projects I have an interest in.
This manifests in my work. The stuff I find boring/lame I am terrible at - when I sit down to work, my mind wanders.
For me, at least, this feels a lot like school. "I know this already. Or at least, I know the broad strokes enough that I can see how I'd go fill in the gaps. Time to zone out and think about something more interesting."
2) Oxygen: past 30 if you do not exercises or do cardio you will probably pay a price. Everyone is different. 30 mins running will make you feel 10 years younger.
3) You may have more perspective and more distractions. In my 20's I didn't even read the news. Who cares? Now, I 'care' about all of those 'issues' and I'm constantly engaging my mind with those materials and it's a distraction. Even children, colleagues, other responsibilities - those wear on your focus. 'Young me' could just sit there and work and literally not give a thought to anything else! That's a luxury. If you can create a silent work environment without distractions maybe that might help.
Get a doctor visit to start addressing your concerns, like you're determined to fix it. And you mean actively fix it, not make a notation in your record and plan to do another checkup in a year.
If you WFH, make sure don't have CO2 or other air quality problems.
Make sure you're exercising, getting solid sleep on a regular schedule, maybe cutting out caffeine, and maybe ask doctor for nutritionist referral.
Also consider that the problem might be motivation. Maybe you see nothing interesting or worthwhile in porting someone else's hugely complicated API bureaucracy from one language to another.
Sometimes it helps me to open a text doc to use as a “thought stack”. Just a bulleted list of items as I descend into a problem. Whether that’s an actual call stack, or just a yak-shaving exercise, it’s nice to have those first few levels written down so I can get myself back out. It also helps for refreshing the context.
Another strategy I’ve used is to write out the architecture in prose, explaining the pieces and how they relate, stream-of-consciousness style. I find it helps my mind break out of thought loops.
I also notice that my mind recoils at anything that is boring, or that seems relatively pointless, to the point where it’s very hard to get into a flow with work like that. I think that used to be easier to push through.
https://www.sciencealert.com/kids-incredible-learning-may-al...
My theory is simple - kids simply have more time to learn and less other bullshit to deal with. Some years they have practically nothing else but learning, exploring, sleeping, eating and pooping. And not to mention that many of the humans around them actively bring all concepts down to their level (and some use babytalk) to explain them. So yea… an adult doesn’t have any of these advantages.
And thinking of patterns, perhaps that is part of what you are up against. I find that trash code is increasingly hard to sort through. Does the API itself make sense? If not, then maybe you are better off thinking about how it should be written. As a starting point.
I'm curious though have you had one or even more than one COVID infection? Brain fog / difficulty concentrating has been known to be a symptom of long term COVID complications. The sooner you identify it as a potential problem the more you can do to work on addressing it with a healthcare professional.
I don't buy for a second that a 40 year old is 'getting old' or that this is normal for your age. I'm 41 and as sharp as ever--I love solving problems and don't struggle with abstractions. Something is up IMHO and it's time to talk to a pro.
How high up there is this on your list of things that you would like to be doing today? I'm guessing it's not very high. It would be pretty low on my list.
Start fiddling with ChatGPT and get it to convert it for you.
You're bored, not brain dead.
Note the science on this is messy. Jaeggi's paper suggested transfer to fluid intelligence, then another paper questioned that, then she wrote a better designed follow up, then another paper questioned that.
Anecdotally I think it worked for me. I personally think the difference in study outcomes may have been driven by differences in how diligently study participants stuck to the regime, or perhaps even how well they understood what they were supposed to do.
A second recommendation is to read John Medina's book 'Brain Rules for ageing well' which has lots of tips for combating cognitive decline.
But I could "see" better. I could see more clearly what was code that was likely to become problematic. I could see what was architecturally "smelly", and what was a better alternative.
Did that change make me less valuable? Or more? I think more.
So you may be feeling the start of that. Maybe you're becoming more valuable than just cranking out a port. Maybe this is a good task for younger you, but no longer a good task for who you are becoming.
And maybe you can talk to your manager about where you could be more valuable.
Are you sleeping well?
Are you doing early time restricted eating? I.e. intermittent fasting
Hows your diet? Any alcohol or nicotine?
Those can have profound effects, and, though not an expert myself, they can be synergistic with each other
Exercise spurs neural growth in the hippocampus, which is key to short term memory
As you age sleep quality naturally deteriorates, starting a rapid decline at around age 45 if I remember correctly. Meanwhile, phsycal activity and sunlight exposure to your eyes during the day improves sleep quality. In addition, time restricted eating can have a powerfull effect on sleep quality
Intermittent fasting also increases neural growth and energy
On diet: Read a book called "Biohack your Brain" by Dr. Kirsten Willeumier
With the experience you have built, you know which problems can occur, which architectures work well, which traps appear in the code you read, ... so when you have to take on something, you may be more interested in turning it around, but it's a tough task, and sometimes not even possible due to your company, so you end up being depressed
On thing I have become good at with time is refactoring, but when I can't do it properly, don't have enough information, not interested by the subject, or the team, I end up mostly giving up.
I think this is kind of being more wise and doing things that matter (to ourselves), instead of just writing some piles of code.
On the converse my primary programming skills have never been sharper. There is a caveat to this. I feel like I am an expert in what I do, which means I am confident in what I know and what I don't know. It also means there is a lot I have unlearned or intentionally avoided because such practices are anti-patterns or decrease productivity. Some of these things I deem "poor choices" are extremely common conventions which may indicate I am only a beginner from the perspective of a less practiced person who cannot live without such "poor choices".
I believe my programming skills are sharp because I am doing things outside of work that nobody else is doing. I have now reduced my OS GUI to a load time of around 165ms in Edge (130ms in Chrome). I saw a code package from Google on Github on the front page of HN either yesterday or the day before describing a means of file transfer cross-os. My personal JavaScript application has been doing that for years. Soon that personal JavaScript application will have a command terminal that executes in a web browser that works on both the local device and remote computers cross OS.
I once read about this in a book. I cannot remember if that was Blink, Outliers, or Good to Great. Performance follows practice, but the practice must be strenuous, such that you are continuously solving ever more challenging problems. Its the difference between a hobbyist whose skills will degrade over time, a professional whose skills are actively maintained but not advancing, and an expert whose skills continue to increase. As an example most senior developers I have met believe they are awesome because they are doing the same things they were doing 5 or more years ago, but now they are so much faster at it. That isn't awesome, its steady state.
Also anecdata but I'm finishing up a project in which the CTO of the company has a good 15 years on you and seems as sharp as ever.
Maybe there were stresses on your body that youth simply helped you handle better until now.
A few quick questions: do you exercise regularly, and specifically, do you go jogging or running? That usually helps a lot.
For me, it was more a case of high blood sugars and poor diet. My head cleared up a lot once I fixed those.
Here's an old favorite of mine: https://youtu.be/7H7id3to1cg
Other tips: intermittent fasting, get rid of dairy / other allergens.
I’ve found that messy or illogical code slows me down more than other developers. On the upside though, I typically write cleaner code than other developers, because that’s the only type of code that I’m comfortable with.
Just accept that not everything is going to fit well with how your brain works and try to get through it.
I recommend taking detailed notes on everything you find and trying to map out on paper the call tree and different classes involved. This can help greatly when dealing with messy code.
For me, I used to be very good at CSS, but I'd always fall apart when needing to actually sit down and write the code. That's largely still true, but haven't really kept up with the css spec that much in recent years.
My memory is totally shot. I think it faded away through years of insomnia, poor diet and lack of exercise. It became harder to live healthily after I had kids.
When I was young, hungry, eager, I would drive fast and take chances, fail fast often, move fast and break things, you get the idea. I would have ripped apart that API and put it back together in record time, paying no attention to any debt I have accrued.
Years of mistakes have earned me the caution necessary to not deliver products that ruin my nights and weekends, disappoint clients, or make my company look incompetent. It sounds like your experience is correctly preventing you from making those mistakes.
It's not age, I was more capable when I retired in 2021 than I was in the 1980s because I found ways to give my brain enough time away (sometimes getting laid off forces you!) and also switching to completely unrelated programming jobs to provide a new perspective. I never completely burned out by giving my brain something new to focus on.
In my experience, certain tasks are not challenging and I really don't want to do them. I have a system for when things get this mundane. A pad of paper, and 3 pens, blue, red and green. I write down the next 5 or so things I need to do to make progress in blue. Really nitty-gritty when needed ('search list for target value', etc) Optionally, if needed, I put a green dot (instruction pointer lol) next to the current line in the list. When the line is complete I joyously scribble over it in red and get to the next thing. Repeat as needed.
When people say X is bad for you, they're usually right. But how bad is it? Will it affect you 5%, 10%, 50%? When you combine many bad things, they'll gang up on you together to make your life hell. They also affect you more the older you get.
Bad things:
* Lack of sleep
* Lack of exercise
* Social media
* Drinking/drugs
* Interruptions
* Unresolved/ongoing family/friends issues
* Bad and/or irregular diet
* Not doing things you like to do.
The feeling you describe using the contrived SHA-512 task, is of total, utter panic and hopelessness, putting it mildly.
I don't know how deep into this you are but it left unchecked it turns into a vicious cycle. Then those bad things mentioned above are more likely to knock on your door and make the problem worse in the long run.
Throughout my career I've sometimes had to use pen and paper to keep track of my thoughts while reverse engineering (which you are doing) or debugging spaghetti. File/Class names with function names and simple diagrams have been very helpful.
I've found out that trying to save time by not setting up a proper debugging environment is a very bad thing. Ideally you should be able to run both old server and old client on your computer. Write a very, very simple client that speaks to the old client.
Add logging and breakpoints to the old API. Step through it and write notes on paper.
Mental abilities declining? I don't know. I've encountered code that I struggled with at any point it my life. Perhaps the other devs know the code better or have had similar experiences. Perhaps you're working on a more difficult part of the code.
I'm guessing this old API was written over a long time. As such it'll have warts and bug fixes that are not trivial to understand. Do you know the language and framework it's written in? If not, write a very simple API in that lang/framework to understand it.
In my case, it was allergies. I discovered that I had gluten allergy (mild) since birth that somehow stayed out of my radar for 28 years. Only after age 28, its side-effects became so apparent that I had to take action, only to find out that it was there all the time.
It could be that you just need a break or some clever productivity hack etc. Or it could be something serious. Better rule that out first.
What surprises me is I learn much faster now than I used to. But I guess it makes sense. I never stopped learning new things (coding or otherwise) so I've learned to learn. I also have more data points to compare new stuff to.
Are you sure the task really requires going three+ levels deep into what the API is doing??! On the surface, being asked to "port the API" sounds more like a request for a work-alike API not a complete redesign, although with the idiom of the target language of course.
I don't think this has anything to do with age! You should be at the top of your game at age 40, if not still improving, but maybe there are personal/stress factors that are affecting you.
That said, if you do not exercise you should really try for a few weeks. Where your body may have been able to coast with normal effort in the past as you get older you need to give it more focused work to get the same level of outcome. Beyond being good for your health exercise is known to have huge impacts on both mental state and acuity.
Another thing you could do is, become the guy who builds all the documentation for the new codebase + unit tests. If you're confirming the two code bases are "exact" you will need a lot of testing.
Days get shorter, winter gets colder, days blur together. Things change. Fortran was way easier... Pfff objects of objects to keep track of.
Remember what your core strengths are... Where the true wisdom is. And always check back to the requirements document.
You have a detailed one right?
Break what you are required to do into smaller components, but from the other side of the problem, systematically. I find by going smaller and smaller I eventually find a manageable chunk that I can start with.
A rainbow attack on the sha512 can often deliver a fast result.
I have to go yell at a cloud now...
Find someone who worked on it and have them explain it to you like you're a 5 year old. If they can't explain it in simple terms, you'll confirm that it's not the piece of cake you thought it was.
I don't dismiss that you might just need some sleep and are overworked, but since you're asking these type of questions, I'd say you're probably fine.
I find in my 50's that my level of patience for gold plating is less than what it was, and I am less _willing_ to wade through layers of cruft when I know through experience there are simpler and more efficient ways to get things done - efficient in both developer and machine time.
Recently, I found out that stressing my body can "reset" my mental and emotional state when I'm in a bad spot (similar to what you described).
I stress my body by doing a physical activity (like running or cycling) or going on a diet (skipping 1 or more lunch). I'm trying to do the opposite of what I feel I want to do (eating more sugar-stuff and doing nothing).
There might be some setup to make it work with any given editor (including vim) but it's worth it because it provides an immediate productivity boost - if you forget where you are, you can 'pop' the stack, check it, then 'push' back down to where you need to be.
I have a list of passion project ideas. When there's a new hot technology/language I want to learn, I apply it to one of my passion projects and it becomes more directed and focused on a goal and it goes a lot better than just goofing around aimlessly on a new language.
Might it be that the people making progress are less interrupted? Also, this sounds like it might be a place where pair programming would be more efficient than two people working alone.
I have recently tried to raise the bar on my designs and being older is definitely a plus. Not only do you have the previous experiences to user as a reference, but the amount of energy you'll need to fit everything in your head means you'll instinctively accept the effort if you feel like it's worth it.
When I use to eat sugar like a madman, I use to feel just like you, so perhaps there could be other factors impacting your mental sharpness.
I have a few questions for you to answer to yourself:
1 - How fit are you? (Cardio and strength) 2 - How is your sleep? 3 - How often do you practice programming / play with greenfield software projects outside of work?
There could be more questions, I am not a specialist, but I have felt just like you described when I use to eat more sugar-based food than I was supposed to.
First factor: having kids (or replace with any other adult stuff). It takes a lot of mental and physical energy I could just use for other things before.
Second factor: As Oscar Wilde said, "I'm not young enough to know everything". Many years ago I would have an opinion, off the hoof, about everything and everything seemed simple. Nowadays I tend to think things are rarely as simple as they appear.
If you do not believe that is a factor then examine your sleep and physical fitness. These things factor a lot more into brain function as we age.
I had to pick up some work using something called OPA open policy agent, horrible. It took 3 senior devs on a call together something like 4 hours and we were all struggling to understand and debug this code. Horrible to work with and understand. It's taken me double the estimated time to work with it.
For your work I'd probably be looking at the requests and responses then trying to fill it all in from there.
Now, after having attended conferences, after having read the books and admired the best codebases, those developed in companies than care and are proud of their DevEx; now you see it for what it is after all, shovelware.
Then pick an easy endpoint and start to implement the code. Follow this through for the rest and add tests as you go. You'll probably want to adjust some of the app structure and maybe do small refractors to help keep things organized when you get there.
Of course some tasks are bored and we don't want to do so we loose focus that doesn't mean mental ability.
You might have some decline in motivation due to other reasons, not least anxiety about aging!
If your colleagues who are enthusiastically porting that API were the same age as you, you would attribute your lack of focus to something else. There is no reason to latch onto age as the explanation.
I started using paper notebook/pencil to go down function call trees.
It helped me immensely.
I am in my late 40s and as another commenter mentioned this could be because we have more responsibilities and not necessarily cognitive decline.
Your glucose metabolism and aerobic fitness start impacting cognition long, long before officially crossing any diagnostic thresholds, and it's usually the middle age where our frequently poor lifestyles start impacting us.
Sounds cliche, but def a list to keep in mind and check off if you haven't. Even just a single 20-30 min workout makes a sea change in cognitive functions
https://tibleiz.net/code-browser/index.html
That said, I am also currently in a hole, can just not look at code. Make yoga, eat healthy, sleep enough, let the sun shine on your head.
Every time I find myself unable to focus beyond a shallow level I invariably find that I've let my mental and physical environment slowly go to shit and I'm running at 1/3 capacity because of it.
It's not that I can't code, it's that work is just making me not want to code. I'd rather put time into playing fighting games while my fingers still work, if anything XD
It's fine to hold no more than 2 levels of call stack in your head. Most devs have a very hard time tracking more than a couple of variables.
What I can tell you: write lots of notes. Break the problem in smaller ones and take notes about the problem itself. You don't need to "hold" anything in memory, write it down.
Get your blood work done.
I know this may seem unrelated, as we often think of testosterone as related solely to muscle development and sex, but it's far, far more. It is very important for cognition, focus, and mood. Further, the estradiol produced from aromatization is highly neuroprotective.
Check your levels, just in case.
From your description, you want to deeply understand the functionality to make better porting, which is what I expect from a senior developer.
Also, this might be a boring project, not triggering any mental reward for accomplishing it.
I would focus on your learning pace for exciting topics to measure mental abilities.
Be especially weary if it becomes difficult to read an analog clock: https://yourdementiatherapist.com/alzheimers-dementia/what-i...
It's WAY easier to just consult your notes than to try to remember everything.
Instead of porting it as-is, rebuild it with the actual functionality required and throw away the overly abstracted parts.
Oh, and I echo the other guy: make sure you have a test harness that validates everything, so you know if you've done it correctly.
Because seriously, you have a couple of decades to go before you hit real physical performance decline (assuming you don't have early onset alzheimer's or something)
I would also point out, that not really giving a fuck is a much more informed position...
It's possible I'm unique, but I don't think so. I wonder if you're just distracted or perhaps experiencing burnout.
maybe it's just because i listened to that podcast last week, but it sounds like you don't have the theory of the api you're porting. by theory i mean an intuition of what the software is, what motivates its existence, what it ought to do. to define the term "theory" by an example from the paper (or possibly from "the concept of mind" by gilbert ryle, referenced by "programming as theory building"): you don't have newton's theory when you can answer a question that he answered the way he answered it, you have newton's theory when your answer to a question he wasn't ever asked is how he would've answered.
so this notion of theory means, first, you can never record a theory. you can't write it all down. to have the theory means you can apply it to any new circumstance that arises, so you can't just write it all down, because you'd be writing forever. a theory is knowing how to respond. the impliction for software is that the code and documentation can't communicate the theory of the software. a theory can't be communicated at all, it has to be acquired.
so how does one acquire a theory? how'd you learn to read? how'd you learn to write? how'd you learn arithmetic? theory transmission is a social function. people with the theory show you, teach you, guide you in forming the theory for yourself.
the conclusion is that software firms should put a lot of effort into retaining people who have the theory of their software, and put a lot of effort into transmitting that theory to new people. that's not the world we live in, is it?
actually, i think that conclusion applies to any business, yet onboarding is terrible everywhere, and workers are treated as interchangeable.
what i'd be asking myself if i were you is who has the theory of this api you're porting, and how much of their time can i get?
1. Sleep quality 2. Nutrition quality 3. Exercise 4. Lifestyle
First make sure that all the above is in check.
Sleep is a game changer in cognitive abilities and it can swing either way.
Had you have COVID? Some people, including myself, have shown long term cognitive effects after it. It took me about 6 months to get back to normal.
This can also be purely psychological. Talk to a doctor!
You can buy sublingual oral B12 supplements OTC if you want to just try and see. The methylcobalamin form seems to work better than cyano FWIW.
I'm sure you will be okay later on because that has nothing to do with your age or cognitive decline.
You can be physically stronger and "brainly" faster and more effective than any man younger than you as long as you keep exercising/coding.
you should try writing things down! Like, keep a notepad around. I have trouble with this sometimes and writing it down reduces the number of things I have to keep in my head.
Changing my diet dramatically, d3/k2 magnesium, Vit e, omega 3s, and blood thinners cleared up my mind.
Also exercise is absolutely critical.
My bet is Vitamin D deficiency - anything below 30 ng/dL is borderline 80 to 100 is best for longevity and cognition.
It doesn't matter if you never look at your notes again, their use is the short time after you write them
Notion or Obsidian work for me.
A point I haven't yet seen in the comments: how much the advancement of civilization owes to 20-30 somethings. Take The Beatles, Alexander Hamiliton, even Anthony Fauci (who had the rare reprise late in life) as examples. At around 40 I gave up any illusion I might do something illustrious, and accepted that from then on, I would just work for a living. My best work became my children, and I'm happy to have done that.
Many of the other comments line up with my own observations at this sage old age:
* more distractions (my house seems to be aging much faster than me, and taking up much more time to maintain)
* bigger responsibilities (more savings to manage with less time until retirement to fix investment errors, offspring where simple existential needs like food and diapers have been replaced by tuition, aging in-laws with real decline issues like eyesight and bad joints)
* less energy. true, and most especially I can't skip sleep like I could 20 or 40 years ago.
* burnout ( this stuff does get old, and "boring" as noted by one commenter)
* underestimating the value of my experience. Not writing that really clever code when a simpler solution will suffice, for example. The ability to tell people a realistic estimate of work, not my old optimistic "couple of days" estimate that was almost always 10x short
* ADD, not helped by social media (stay off it when working, or always) and a trying to ignore the constant stream of news (except HN of course lol). But a great help in being open to new methods where I find myself evangelizing about git to people half my age.
* exercise, fitness, diet: need to up my game after covid isolation and increasingly creakey joints. It does make a difference. In my case living in The Big Easy doesn't help.
* Did I mention sleep? Why yes I did, forgive my forgetfulness....no, actually I put it here intentionally because it is that important. Exercise helps with getting quality sleep.
I am still writing code and I "provide value" (their words) in that I can solve complex data analysis problems that come to me after co-workers reach the limits of using vlookups and pivot tables in Excel. I'm not the fastest and I'm always fighting imposter syndrome, but that's quashed whenever I catch a glimpse of production code written by pricey consultants and realize they make the same mistakes and use truly ugly workarounds even I wouldn't consider.
Try working for 3 weeks without alcohol or coffee intake and see if that makes a difference. Then slowly reapply.
Its not that the older engine is broken but it does require different maintenance.
There might be other questions worth asking.
The inside of my mouth feels constantly cold. So I know I got an issue, but appointment is in march.
The sleep apnea damage is permanent, but you can stop it from getting worse.
Maybe I’m making myself subconciously incapable of doing it.
My personal thinking is that there's a lot of social malaise and hopelessness that's affecting people mentally right now for these and possibly other reasons that's contributing to this mental fog. People are checked out right now.
> Whether you're very scared of Covid or not the least bit scared, everybody is frustrated with still dealing with it and the measures they have to go through.
> Prices of everything are going up, layoffs are happening, and there's a general sense in the air that the economic calamity that's possible is just getting started and there's nothing you can do about the coming bad times.
> For lots of complex reasons, one of the biggest traditional sources of joy (people creating families) has been plummeting and possibly getting worse in this time period.
> Everybody, regardless of political idealogy, has some big topic to feel hopeless about. Some people think the world is ending due to climate change, some people think the world is ending due to Putin, some people think the world is ending due to economic migration, etc. This is subjective, but there's a limited real aspirational message of hope for the future that most could agree with and see unambiguous positivity from.
This describes me (early 40s but I was always like this) so I just write it down in a notebook. There's no advantage in trying to keep everything in head when we can use well tested tools.
As such, do know that porting API is tough in best of times. It's not easy to just walk into it and understand, let alone replicating the functionalities in other language. You are trying to pull off several things at once.
I'll also repo my earlier comment verbatim[1] where I offered my suggestion to someone in similar situation.
It's beneficial to approach learning about an API top-down and bottoms-up. The context in which the API operates and then the working of the API in itself. Imagine if you were in charge of maintaining a hardware tool. I first want to know how this tool is used by various customers before learning how the tool works.
1. Begin by learning all the end-to-end product flows this API is going to be invoked within. This is the context in which your API is operating in. It also sets the stage for non-functional requirements such as latency, and availability requirements. How will end customer and business be impacted if this API were to misbehave?
2. Next speak to all the customers of this API. How do they produce the data for your API's inputs and how do they consume your API's output. You will be surprised by all sorts of creative ways in which an API gets used, not necessarily what the API was intended to begin with. But you need to support all those clients so better get to know their use cases. Also, understand how they handle your API failures. The consumers tend to make unstated assumptions about input/output validations and invariants. It's not documented anywhere but floats around as tribal knowledge. Extract that knowledge and document it somewhere. Make sure you are very clear about every single input parameter, how it's produced and its expected values as well as every single output parameter and how it's consumed. Don't forget about exceptions. Often times customers treat exceptions as just one of the expected output parameters and so actually depend on the API throwing that exception.
3. Finally, take a look at the API's implementation. Don't get frustrated if you don't understand more than 50% of the code. It's perfectly fine. Make notes of the parts that make sense and also note down those questions. Ask around. Often some parts makes absolutely no sense to you. But it is there for a reason, someone as competent as you put it in the first place. Again, ask around both within your team and the API's clients. Pay attention to the API's downstream dependencies and how their failures are handled and bubbled up to your clients. Your API's SLA depends on your downstream APIs, learn about them and ensure that it matches the expectations.
4. You also have indirect consumers of your API who depend on the side effects produced by it. Make sure you learn about them. If this API causes a side effect (such as DB update, publish a message to Kafka) then learn how those side effects are consumed. Does someone depend on it? If yes, how? Though I've described these steps in sequence I find it useful to approach all of them in parallel and over multiple iterations. At first everything is blurry and after first pass you penetrate through about 10% of cloud cover. After 4th or 5th pass you will have a reasonable understanding (~85%) to make small bug fixes.
best of luck to you
My way to improving has been pretty long (10 years of trying) but ... TLDR: I started to be more physically active, including strength training, completely overhauled my circadian – sleep habits (I sleep 10x better than years before). I suggest to follow Peter Attia and read books from David Sinclair, Satchin Panda, Matthew Walker... It pays off. :) Keep going, you can improve your mental abilities again.
PS: Last year I started to learn Clojure (I am not programmer, I just love it as I feel like functional languages are like poetry:). Yes, it is not easy, but I hope my first simple and useful app will be out and public this year. Just for fun.
interesting book to read: https://smile.amazon.com/dp/0316113514
Anyhow, good luck!