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
anonyfox#
I noticed a stronger urge to not waste my time by reading bullshit. It got much worse now that I am closer to 40.

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.

caned#
It's hard to give an answer without knowing other variables - namely, what else is happening in your life.

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!

agentultra#
I would doubt the code first. If it is built on layers of indirection that's a sign there's an abstraction that's not being made which could simplify that code. We write code first, and foremost, for other humans to understand. If it's too hard to understand due to all the indirection that's a problem with the way the code is written, not you!

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?

gernb#
For me (late 50s), I find that I don't feel productive as I use to be and can think of several reasons

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

Load more comments