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
Starwatcher20011 reply#
I know the feeling. I'm 62 and I can't go as long or as deep as I once could, but I've changed my strategy over the years and although I'm not as fast as I once was I'm still pretty productive.

What I do is log virtually everything I'm doing in an editor window that I keep open all the time (one file per project/task). If I get disturbed by a call or a colleague, I can do a quick recap and get back to where I was. Likewise if I lose the plot several levels down my stack. It also helps if I need to switch projects for a while, or overnight.
It's like a running log of my thought processes:
- Need to add feature x to module y
- What docs have I got?

  - How to file in d:\projects\docs...

  - Log file from 13/03/2021
- What routines are involved?

- a,b,c...
- Looking at A

   - I'm thinking of adding a new parameter

     - Who else calls this?

       - Routine F

         - The mod would be straight forward there.

       - Routine H

         - This is called by S

           - This needs more thought, it might be chewy

     - What SPs are involved?

       - UpdateCustomerTable(CustName, Address1...)

   - I've backed up the database to ADB_20230110_1501.BAK so I can test.
What it does for me is offload the requirement to remember the previous levels and lets me concentrate on just the one or two things I'm looking at. As I come back up my stack I re-read what I was planning to do next. I use an editor (UltraEdit) which allows me to collapse things I've dealt with so I can see the wood from the trees.

I keep the log files, which go back over 20 years and can be invaluable next time I have to look at the same project months later. Reading the code AND my notes helps me re-build my mental stack much quicker. It also helps with any bugs that I introduce.
Good luck. It is possible to be productive at an advanced age, and still enjoy it too.

denton-scratch3 replies#
I got severely dinged for saying in a standup that I had forgotten what I was doing the previous day.

So I bought an A4 hardback notebook, and started logging everything I did. I wish I had been doing that since I started in this business; it's a really good work habit.

agentultra#
I wish more programmers knew about this!

I keep a lot of journals. Bullet journals for my daily tasks/planning. Long form journals for deep subject matter: maths, graphics, algorithms, etc. Combined with my writing it's definitely been a useful way to see how I've evolved my thinking over time, etc.
Keep at it!

Starwatcher20012 replies#
I tried paper and log books for a long time (I've got half a filing cabinets worth), but no matter what system I used I couldn't always find what I wanted. (When did I last modify routine xyz, and why?).

Moving to flat ascii files meant it's searchable and has longevity as it doesn't need any specific tool or app. I can also carry the lot around with me - very useful on site.
Cheers.

bherb1 reply#
How do you organize the files? One per day? Task? Project?

Continue this thread — 1 reply

denton-scratch#
Well, I never used my log books as an information retrieval system; the prime purpose was to help me remember what I did an hour ago, a day ago, a week ago.

Of course, I have a digital file of timestamped and commented code snippets and pieces of config. But that's just about the activity of coding; I now think a handwritten log is a good idea for anyone, whatever their trade.
The reason I recommend a hardback notebook, is because it offers the best CYA protection (I was caned as a child). It's sorta symbolic - hard evidence, if you like.
[Edit] You can also scribble in your notebook in meetings, while glancing furtively over your spectacle rims, to intimidate the speaker. Hard copy is power.

gardenhedge#
Isn't this what Jira, Azure Boards, sticky notes are for? You reference the sticky note when talking about what you did. If there's no note for it then your planning was probably bad.
lukehutch2 replies#
I'm 46, and while I do think my cognitive speed has declined a tiny bit, my abstract thinking has improved throughout life. The one change I have noticed though is that programming has become insanely complex during the 37 years I have been programming, but more especially during the last 10-15 years. It's at the point now where you can't even create a basic website, to modern standards, without spending months of work to develop it, or without spending 95% of your time on StackOverflow wrestling with bugs and complexities of 7 different pieces of framework that you're trying to get working together. It's utter insanity.

What I suggest for your current situation is to diagram everything. Just buy some big sheets of butcher paper, and draw out the entire nested API structure. Rely on your visual sense so that you don't have to do as many mental gymnastics. Your visual processing center is the GPU of your brain, it has vastly more parallel processing power than the language processing centers of your brain.
Also remember that everyone has different aptitudes. You might not be decreasing cognitively at all, it might just be that this problem doesn't click with you like it does with the other developers.

riskable2 replies#
Don't compare web development with "normal" software development. Writing code for the web is 10,000 layers of added complexity far above and beyond literally any other kind of programming.

"Normal" programming involves writing code that will run on one specific thing with (usually) one specific use case using tools (and often whole languages) made for that purpose. Web programming involves writing code that will run on any number of servers/devices/containers in any number of locations/networks using any number of architectures with arbitrary resources of wildly varying quantities and qualities that serves other servers, desktops, mobile devices, embedded things, and who-knows-what else; also of wildly varying quality/resources and quantities with wildly varying and unpredictable workloads/traffic intensity.
In other words, web development is about 100 orders of magnitude greater complexity than "normal" software development. It has become so bad that "premature optimization" is the norm; because the cost of re-doing things later to support a new feature/device/endpoint or fix an issue (e.g. lacking screen reader support) can be so great that adding a dozen layers of complexity to writing and deploying your code at the start can feel like a bargain in comparison.

mmcnl1 reply#
I agree that web development is complex. I disagree that abstraction layers add complexity. Abstraction layers solve problems. If you don't have the problems that these abstraction layers solve, then you might perceive that as complex, but most people actually do experience these problems.

The web is not just for websites anymore, it's a universal platform for app distribution. This means web apps can instantly be made available to billions of users. You noticed that yourself. This brings all kinds of complexity that these layers solve. They absorb complexity, not add it. So I don't understand why you would say things have gotten "bad". Things were way worse, but individial contributors never noticed.

clnq2 replies#
> I agree that web development is complex. I disagree that abstraction layers add complexity. Abstraction layers solve problems.

True, until there's a bug in abstraction level 6 caused by an upstream change in proprietary abstraction level 3 that's been patched in abstraction level 8, but not for your specific case. Then it becomes complex.

Continue this thread — 2 replies

teamonkey#
> Writing code for the web is 10,000 layers of added complexity far above and beyond literally any other kind of programming.

Video games? Mission-critical real-time embedded code? Operating system development?
I don't want to knock anyone down, but web programming is not the most complex or challenging thing going, it's just software development.
True, it's made more difficult and annoying than it should be, because you need to deal with a jenga-like stack of badly-designed and poorly-documented APIs, forced to use languages and systems with inherent flaws, and have your targets constantly shifting due to the latest fad. But then, that's not unique to web dev, it's just worse.

gardenhedge#
> It's at the point now where you can't even create a basic website, to modern standards, without spending months of work to develop it, or without spending 95% of your time on StackOverflow wrestling with bugs and complexities of 7 different pieces of framework that you're trying to get working together. It's utter insanity.

I am interested in your experience and why you think this? It's not true at all from my experience. In the past, making a basic message board would have been pretty difficult. Now it can be done in days. Same with Twitter clones etc.
What type of basic website takes months to develop?

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

Buttons840#
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.
jsomau#
Adding to this:

> 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.
If I can craft tests up front in terms of the higher level goals then when I finish a subcomponent or get distracted by something else the higher level test is there for me to fall back on to figure out what to do next.

linuxftw#
Great advice, I was going to suggest the same. You shouldn't have to memorize what each layer of a project does, that's what the unit tests and integration tests are supposed to prove.
aeschinder1 reply#
Is the current API testable? So many times I've taken ownership of code that requires an active connection to a database to even be up and running. Changing the code so it's testable usually changes the code so much it is very hard to have confidence it works the same way as the original implementation.

My old company lived and died by its instrumentation of DAU (daily active users). We would try to refactor the code to an IoC pattern with DI but invariably we'd get blamed for a downturn in the numbers - but never lauded if the reverse was true. It was a losing game - we finally had to get management to commit to the modernization (never, ever say "rewrite") and power through the days of low DAU.

therealdrag0#
How would DI impact DAU?
fileeditview2 replies#
I am 40 now and a better programmer/developer than I ever was before. I still encounter similar situations as you but I think you make a mistake by thinking your younger self would have handled this (easily).

The difference is that our younger selves were maybe more optimistic and naive and probably would have just produced a new mess for the next one to scratch his/her head about.
Abstraction is hard and we usually have to much of it in our code bases. You have to break it down and isolate smaller tasks to get started with. Start with some endpoint of the API and try to understand what it exactly does. Usually there also should be an API spec where the ins and outs are defined. Maybe it is easier for you to write this code by adhering to the spec and/or fulfilling existing tests than reading the old convoluted code?!
Probably you know all this and maybe you just hate your task. If this is the case.. sometimes a change is what you need.

jxm262#
I'm 38 and just wanted to comment my experience matches your comment here. I'm probably 20x or more productive now than I was when I first started. Experience does indeed help productivity (to a point).
caente#
>The difference is that our younger selves were maybe more optimistic and naive and probably would have just produced a new mess for the next one to scratch his/her head about.

This needs to be highlighted!

Load more comments