3 ms·
> I don't know if this task is just an especially bad fit for me, or if my mental abilities are declining? > The code I'm porting is average code, not terrible
by hbrn 4y ago
> I don't know if this task is just an especially bad fit for me, or if my mental abilities are declining?
> 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).