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?
As we age, we usually end up with more and more life responsibilities, beyond just the work we are doing. All of that is input to the brain and requires energy in response. The brain is not infinite.
I often feel as you do, but then I have periods where I am as light and agile in my productivity as 20 years ago, maybe even more so, and usually it is my life circumstances that are the culprit.
I remember once about 13 years ago I was working on a mobile game and had a similar problem as you describe; there was one day where the technical work seemed to overwhelm me and I felt inadequate. But I was just a young chap, and it was a passing moment -- I had indeed just taken on some enormous new life responsibilities at that time, which were the likely explanation.
Burnout is real, too, and giving yourself space (if you can) to relax and not think about work for a break can be quite useful to recharge.
Not that I'm good about those things - I do OK but not great. Sometimes (rarely, thankfully) my energy is so low I can't really code at all, sometimes I'm flying. I'd say by far the biggest factor is my overall state of positivity and optimism. And yeah, life definitely gets more complicated as you get older.
This is an amazing insight. I’m almost 46 and feel like I’m at the top of my game, programming-wise, but also, I’m probably at my healthiest. And that’s worked-for health, not the kind that comes for free in your 20s (generally). And I think about and pay attention to energy levels during the day, and just know when I’m toast for the day and time is better spent elsewhere. I take a brief afternoon nap before coffee most days. I pay attention to when my mind is receptive to new information. I let some things bubble away in my subconscious and sometimes make new insights on walks, in the shower, or while making coffee.
Western diets (e.g. the standard american diet... what we actually eat) is fairly bad for our health which impacts our abilities.
I would recommend folks look into the Blue Zones. Where people live the longest and thrive for the longest. Look at their eating and lifestyles. One of those zones is in the US where people have work/life balances similar to folks here.
In my case, changing my diet and activity level caused my energy to go up and mental clarity to improve.
Where can I obtain this for free energy?
I went for many years without an exercise habit. About 5 months ago I started lifting weights. The transformation has defied all my expectations and the biggest unexpected benefit is that my mind has become sharper, faster and more focused. I essentially feel like I've reversed a decade's worth of brain and body aging by going into the gym and lugging some iron around a couple times a week.
Around the same time I started cutting back on alcohol intake and cleaned up my diet a bit. So it could be any of these factors but I think it's a combination of all of them, as you get older, you need to maintain your body or it'll deteriorate and take your mind with it.
In this recent survey of nootropics [1], weightlifting was better than dozens of chemicals. In fact, it was third only to Dexedrine and Adderall. It scored better than Ritalin! And its variance is tighter than most substances, meaning it's one of the most likely means to improve results for anyone who takes it on.
Personally, I agree. After covid sapped some of my energy, it took about 2-3 months to get back to my average gym sessions and now I feel so much better. Happier, tougher, etc. When I am in shape, the geometry of the world around me changes. A distance or effort I might consider looks, feels, and is more in reach after a few weeks of rows, lunges, pushups, hanging, swinging, light cardio, biking, etc.
[1] https://astralcodexten.substack.com/p/link-troof-on-nootropi...
My theory is that when you're young, your body has a much wider margin for error. A few drinks or sloppy exercise routines never seemed to impact my work. As I've aged, the margin has shrunk, and now there's a measurable effect that I can no longer ignore. Aging is in itself a handicap, but now after too many drinks, the next day both my cognitive sharpness and motivation to even care about shoveling bits around a network have declined.
Now I need to actively stack the deck in my favor, rather that engaging in behaviors that further handicap myself. So that means exercise, a sleep routine, zero alcohol most days of the week, reducing stress, all that goddamn stuff I never had to worry about ;)
Another way to think of it is this: at 40 or 50, can you afford to be lugging around a 20% RHR penalty all day? That will surely come home to roost, probably in the form of atherosclerosis. Remember the most common clinical presentation for a heart attack sufferer is not chest pain, but being dead on arrival.
I bring this up because it's worth nothing that our bodies and minds are remarkably good at covering up problems until far too late. When you get those early warning signals (high RHR, feeling of cognitive decline, etc) trust your body, be proactive, and employ countermeasures.
Call me a wimp but I find DOMS can be a little distracting haha.
Since I retired, I have suffered a cognitive decline; everything takes longer. But, you know, I'm retired, and work expands to fill the time available.
and it just makes me tired. While I'd like to retire and think I'll financially get there sooner or later, I'm afraid that there's an underlying structure to work that I'll miss.
This trend seems genuinely goofy to me. If you have daily reports, standups, or whatever, you're going to be spending a lot of your time prepping for those. That's time that you're not spending writing actual code (or whatever you're nominally supposed to be doing).
It may well be that the OP has other load that has crept up on him; until you take a step back it's often difficult to see what's happened over a period of years.
But burnout is a thing, and sometimes you need to take stock, take a break, and maybe even make some big changes. You're only here once, so it's a good idea to give it your best shot, IMO.
As far as anyone can tell.Responsibilities seem to multiply. And as you age you sometimes find you're not only caring for kids potentially but aging parents. It's a lot.
1 - https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4015335/#:~:tex....
Even without burnout, sometimes a problem doesn’t motivate you and therefore you don’t really feel like solving it when there are other things that seem more interesting or more practical.
Either case, once the down period starts it’s a good signal to take some time off and get your head out of it.
But... when I get on some personal project, I'm on fire. I can learn new languages and concepts and systems and build pretty complex things that people are amazed at.
I think it's more job burn out after years of writing code for other people. You write the code and you work towards the deadline like the world is going to end if you don't make it. Then that code is in production for a year or two. Maybe more if you're lucky, and then it's gone, replaced by some new thing. You stop caring quite as much. But you see these new young kids on fire and working all night and you get imposter syndrome and you try to care and you beat yourself up and think you're losing your touch. tmi?
On the other hand: When structuring my day with Pomodoros (https://en.wikipedia.org/wiki/Pomodoro_Technique - especially doing the rest properly, meaning just lying down doing some relaxation technique) and resisting all other harmful stuff like (to much) news or (any) social media, I feel like I'm even sharper than in my younger years. Even remembering stuff better.
So, I think those problems are to be spotted in our changing environment and internal setup more than in an aging process. At least not at 40, 50 or 60.
in short, that assignment sounds de-motivating, so you're predisposed to notice momentum is hard to establish.
and getting coherent blocks of time, to get in a flow as they say, is the challenge that hits me all the time, and which i didn't have when going to an office 20-35 years earlier (including in college i mean).
As somebody who far away from 40, how is one supposed to "look forward" to getting older given this likelihood?
You don't have to take Responsibility A if you don't want to, but you have to live with the consequences of your decision (good or bad). It's a trade off. I want a house. I make that decision for that responsibility. I now own that responsibility knowing the duties that come with home ownership will take a portion of my time and therefore will reduce the availability of time once given to a different responsibility.
Of course, mistakes will be made, but the best part is you can most often correct mistakes in healthy and meaningful ways.
People plan towards retirement which is usually just looking forwards to not having to work anymore.
People look forward to having children and grand children.
I don't know anyone who looks forward to getting older except for the young.
But that's a very sad kind of survivor bias. You were born with your quickness, but you have to earn the experience. Not everyone ends up middle-aged with useful experience. You hear only from the ones who do. And nobody has a time machine.
So look forward to reaping the benefit of experience, but let that be a warning that experience doesn't happen for free. Use your youth to acquire as many lifelong skills as possible. Use those skills in challenging ways to develop judgment. Use your skills and judgment to develop meaningful relationships with people who have chosen similar strategies.
Being able to offer solid skills, judgment, and relationships, rather than the ability to work consecutive 18-hour days, is what you'll have to look forward to.
Such as: owning property, owning car(s), having children, getting married, getting a mortgage, etc.
You can chose to not do any of those things and basically live like you're 20 when you're 80 (in terms of responsibilities).
It's just the mind's way of coming up with problems when there aren't any.
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
The longer you're in front of a screen, the more you lose awareness of yourself and what you enjoy. Taking frequent breaks away from screens is important to stay motivated and restore that drive towards meaningful things.
It's sounds wishy-washy how I explained it here, but the video has a more scientific explanation of this phenomenon.
https://youtu.be/zBgCRJluWTc
So when I get stuck now, I just start writing code like I would have when I was early 20s.
"even more advice": Issue is likely mental focus (since you have a finite daily mental, emotional stress budget)
https://www.goodtherapy.org/blog/breaking-the-chains-finding...
- (let go of) mental re(re)view. "This too shall pass".
+ (embrace) "just do it" && "Don't worry, be happy".
! (remember) chemical dependencies, if any, must be brought under control.
That one exact thought is compounding your problem. It's pure anxiety and it makes problem worse, I know from experience. When you think that, try to calm yourself with "yeah, it's just anxiety speaking, it will be fine". Maybe also try magnesium supplements, magnesium citrate helps me (but it typically takes up to a week of supplementation, minimum 2 days).
.. which honestly sounds an awful lot like the stress of the situation (or concern about cognitive decline) - which isn't going to do your focus any favours!
Any kind of reset can help with that: go for a short walk, chuck some binaural beats on headphones and close your eyes for 5 mins, drink a warm (non-caffeinated) beverage and think about something else.
Above all else: probably good to just remember everyone has off days, other engineers aren't going to judge you for a day of lower productivity
Aside from reducing your internal stress, One key ingredient of finding "flow" is a sense of immediate feedback, perhaps allocate 20 mins to some short tasks which give rapid reward; write a couple tests, draw a diagram, etc..
Binaural beats (use "relaxed"): https://mynoise.net/NoiseMachines/binauralBrainwaveGenerator...
Going for a walk is kind of a lightweight "shower effect", random article link: https://buffer.com/resources/shower-thoughts-science-of-crea...
(Sorry, time zone mismatch slowed my response)
Link dump (for reading some other time)
- stress and brain function: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6504531/ - flow state https://en.wikipedia.org/wiki/Flow_(psychology)
I’ve experienced this a bunch of times too. I’m sorry to say this, but burnout for me never goes away on a convenient schedule. The more I make myself wrong for feeling overwhelmed, distracted and unmotivated, the worse it gets. Or in other terms, problems are rarely solved with the same thinking that created them.
For me, I have to really give myself permission to step back, take stock of myself, get some sleep and good food and often take a break from “work” programming tasks for a few weeks. (And I know exactly how inconvenient that last part is).
The more I push myself to feel better already, the longer it takes.
Some days you just feel down and are barely able to function, others you have seemingly unlimited energy, and this can come from a whole host of factors : how did you sleep, what did you eat, what is the weather, how is your personal life going...
And of course things get worse as you age (with quite a lot of variation and personal responsibility in staying healthy).
Write down what are the big challenges/problems, try to break them down and write about it, keep dividing it until you start to see that you can tackle the indidual pieces.
I'm 42 and I've been in a mental place similar to yours, but a little more drastic due to a hard time in my life, and it took a while to get back into top shape, but the effort to break down my problems on paper helped me tackle some immediate tasks I had to accomplish.
Good habits and lifestyle changes take time.
The only other option that has worked for me would be drugs like Adderall.
I think what we have to deal with is not just cognitive decline, but more importantly cognitive overload. People in their 40s usually juggle lots of responsibilities, especially if they have a family. At this age you normally also have earned some money, and if you start buying things like a summer house or an apartment for renting out, those things come with maintenance tasks. This can accumulate quickly.
Whatever the reasons are, my approach was to get used to it and work differently. I am terrible at doing multiple things at a time and my short-term memory is bad, so I learned to concentrate on one task at a time and eliminate distractions. I buy large monitors, so that I can have multiple things on the screen at the same time and avoid having to remember (I can easily forget an IP address when switching windows!). I spend money on Apple hardware, because of 5K displays: 5K makes a huge difference, because I can comfortably have THREE columns of code in my fullscreen Emacs instead of two. That means I often have 5 different pieces of code visible, which does wonders for things like APIs, which you mentioned — I can follow the entire path of a call and keep it all on screen.
I also noticed that there are positives that come with age and experience! I find that I'm much better at seeing the "big picture", analytical thinking, design, and predicting potential problems. Most importantly, I'm now much better at knowing what not to do. These skills are invaluable when running your own business.
This is a really good point. I feel like I'm dealing with way more responsibilities now that I have a house and a family, I'm no longer the center of my own universe.
This seems like a particularly helpful suggestion, both for the original context of the question, but also something I'm likely to use myself. Thanks.
I can still bang out code like nobody's business, even in my late 40's... when I can find 4 uninterrupted hours to get into it. Which is rarely.
It's more about depth of focus, which was so easily available for 10+ hours a day when I was younger.
With family+house responsibilities, I rarely (if ever) have that anymore.
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.
"It’s probably just that aging changes your mode of thinking. Right now, I have to really concentrate and I might even get a headache just trying to imagine something clearly and distinctly with twenty or thirty components. When I was young, I could imagine a castle with twenty rooms with each room having ten different objects in it. I would have no problem. I can’t do that anymore. Now I think more in terms of earlier experiences. I see a network of inchoate clouds, instead of the picture-postcard clearness. But I do write better programs."[0]
I can believe the part about better programs. Can you imagine working with somebody who can clearly visualize software with 200 sub-components in it? I once worked with software written by someone who had similar powers. He was a hardware designer. His software had very little organization; he wrote imperatively and remembered where everything was. Six months after he handed a program off to me, I spoke with him and told him I was currently trying to figure out where a particular component was initialized, and he told me exactly where, in what part of what file. IIRC, some hardware registers were being initialized in a procedure that was allocating working space for a numerical part of the program, because that's here he happened to open the log file for the first time, and he wanted the logging from the hardware registers to be the first thing in the log file, before he logged the fact that the memory had been allocated successfully. He remembered this with no hesitation, more than six months after he last touched the code, possibly two years after he made the decision to initialize the hardware in that spot.
Someone with less mental horsepower, like me, has to organize their code into modules with clear names and responsibilities.
[0] https://programmersatwork.wordpress.com/programmers-at-work-...
I am insanely jealous of people who can keep everything in their head. Maybe there's a silver lining in that my methods are more resistant to brain-busting situations, depression, cognitive decline, etc., but I'm not sure that I'm convinced.
To be fair (haha) I went from writing super organized code with loads of concise, well-documented files to writing code just as you describe when I started designing hardware and writing more complicated embedded firmwares. For whatever reason, hardware initialization boilerplate doesn't like to be spread out or organized. As soon as you try your code ends up breaking outright or becoming a vastly more complicated, gigantic mess.
It's because the hardware is soooo specific and we as software developers want to make interfaces that are as generic, high-level, and re-usable as possible. Example: You can't just write a function that takes two pin numbers and initializes I2C on them so you can talk with some module. You usually have to know--ahead of time--which two pins you're going to be passing to that function (so the types match; because each pin has its own special type haha) so the function can initialize the correct I2C bus on the chip (in the right way)... Which immediately makes such a function non-generic and kinda pointless since you'll never be able to re-use it in anything else for any other purpose. You quickly get into the habit of saying to yourself, "Why am I making this a separate function again?"
Also, the order of operations matters so much more in embedded stuff than it does in regular software. I could totally see the situation where you want to initialize logging immediately after initializing some hardware because you want the logs to reflect values that you only happen to have available during initialization... You don't need them after initialization so why waste precious memory keeping variables around just so you can log them later? Just setup the logger in the same code, write your variables, and be done with it!
Makes sense, right? Hah! Only in the world of embedded firmware!
Whiteboard markers are too wide and I am left handed so I erase as a write.
And using paper makes it feel like I am wasting paper.
For example, write a quick script to add a panic (nonexistantFunction()) as the first line of each function. Then, call each function in turn. Save the panic's function stack trace, then process them as a combined graphviz file.
This simple and efficient hack will get you all the most important edges in most cases for most languages. It won't get you the internal links, for those you need a more effective parser or more exotic means of obtaining branched call stacks.
[0] http://graphviz.org/
When tracing deep call stacks I can find it helpful to write out the question I am looking for the answer to in a comment. Then I can retrace my thoughts back up the callstack using the very handy shortcut to go back to the previous curson position.
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?
- What routines are involved?- a,b,c...
- Looking at A
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.
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.
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!
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.
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.
"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.
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.
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.
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?
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.
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.
> 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.
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.
This needs to be highlighted!