Lurker News
I'm around 40 and recently I have been asked to port an API from one language to another. The code I'm porting is average code, not terrible, but plenty of little things to complain about.

I feel like my past self could have handled this task, but I am really struggling. Porting this API will require a deep understanding of the existing API, which, of course, has several layers of abstraction.
I can't seem to hold more than about 2 levels of call stack in my head. There's the entry point function which calls other functions, which call other functions, which call other functions, etc. You know how it is, code calls other code, and logically it forms a tree of calls and return values that often goes several layers deep. I struggle to hold more than about 2 levels of this call stack in my head. By the time I'm down in the weeds I've forgotten what I'm doing, what the purpose of the actual API call is.
I don't know how to break this into small enough chunks that I can understand it or make progress on. Imagine I gave you the code for the sha512 algorithm, and a hash, and asked you to find the pre-image (the input). This is how I feel. Where do I even get started? How do I find even a single chunk of manageable work to break off.
The hard part is, several other developers are making progress on porting this API. Why can't I? What happened?
I don't know if this task is just an especially bad fit for me, or if my mental abilities are declining?

Comments (510) 299 threads

Earlier comments
ranting-moth#
The following are things I've identified myself, in case it's useful for anyone else.

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.

diegoperini#
This may sound entirely irrelevant but certain common diseases that usually show up around middle age cause brain fog, which we usually incorrectly diagnose as "aging". Diabetes is one such disease which highly decreases focus and energy on most people. Luckily, once managed, those effects mostly disappear.

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.

VyseofArcadia#
Stop asking Hacker News and start seeing a neurologist. This is a job for a professional.

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.

pier25#
If anything I'm a much better programmer in my 40s than when I was younger. My cognitive capacity (being able juggle more balls at the same time) is about the same, probably a bit better now. My lateral thinking has definitely improved. And then of course I'm wiser because I have more experience and my instincts are just better.

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.

Load more comments