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
abavatar#
+1 to all the interesting points here.

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...
https://youtu.be/inwfSkSGvQw
Disclaimer: I’m NOT a medical professional and this is NOT medical advice

usgroup#
given that you're asking how to break down a complex task into pieces, it sounds like planning rather than execution is the problem. to wit, it doesnt sound like its mental capacity -- if you knew how to do it before, you'd still know now. i think its quite normal to hit 40, start worrying about aging and attributing things to decline, but chances are you can do much more complicated things than porting an api with your brain and will be able to for a long time yet.

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.

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

Load more comments