Live data from Hacker News

Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.

news.ycombinator.com

1–10 of 534 posts

Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.

#1
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?

Re: Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.

#2
I've experienced this periodically since my early 20's - generally in hindsight I realise it was: real life getting in the way, burnout, lack of interest (I was interested in the idea, but on some fundamental level - not the activity) - also occasionally just a feeling of Groundhog Day (ie. Some code tasks can just feel a little too familiar - even if novel, and that saps my joy)

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

Re: Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.

#3
Is the current API under test?

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.

Re: Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.

#4
This sounds like terribly boring developer work to do and requires no creativity at all. Is that what's missing when comparing to other types of developer work that might keep you more engaged and focused? I'm not suggesting to push back about why it needs porting, I assume that bridge has been crossed already.

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.

Re: Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.

#5

I've experienced this periodically since my early 20's - generally in hindsight I realise it was: real life getting in the way, burnout, lack of interest (I was interested in the idea, but on some fundamental level - not the activity) - also occasionally just a feeling of Groundhog Day (ie. Some code tasks can just feel a little too familiar - even if novel, and that saps my joy) Either way, at the time it was quite…

Thank you. Good advice about hacking on some personal projects/experiments. I'm worried that wont rebuild my confidence and abilities fast enough though. I want to make progress on this task today, not next week. Other developers seem to be succeeding, and I'm worried about how I'll look if it takes me weeks do to what others are doing in hours. (This isn't meant to dismiss your advice, to but to give feedback and solicit even more advice.)

Re: Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.

#6
1. You're getting old. Start writing everything down on paper.

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.

Re: Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.

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

Re: Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.

#8
Sounds like you've identified your problem with the task - you can't hold the entire state of the problem in your head all at once, but maybe you would have been able to in the past.

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.

Re: Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.

#9
post #3

Is the current API under test? 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 an…

You're right, that would make me feel a lot better about this task. Adding tests around the existing API is something I believe I could make progress on, this is a chunk I can break off.

Re: Ask HN: I'm 40 and feel my mental ability declining. Programming seems harder.

#10

I've experienced this periodically since my early 20's - generally in hindsight I realise it was: real life getting in the way, burnout, lack of interest (I was interested in the idea, but on some fundamental level - not the activity) - also occasionally just a feeling of Groundhog Day (ie. Some code tasks can just feel a little too familiar - even if novel, and that saps my joy) Either way, at the time it was quite…

It could also be attention span problems caused by social media.
Post reply on HN