Hacker News new | ask | show | jobs
by kimikimi 3025 days ago
I would be coding now except that I'm travelling in Japan and have not figured out how to replicate my usual "visit Starbucks" pattern yet - they have cafes but not with power outlets, generally, so I have gathered that coming to one tends to mean phone or paper work only.

What I have noticed about my coding habits is that I need a cyclical approach. For a lot of features the task is in fact smaller than I think and just needs an initial direct attack. When it isn't, even if I know what has to be done additionally, I can usually add a stub in the right places and fill it in iteratively. Stubbing often breaks me out of experiencing friction.

This works up until the relevant code stops fitting in my head. Then productivity slows to a crawl and I'm far more likely to wander off. I don't have a direct solution for that. Rewriting the module in question sometimes works, but it seems to work best after I let the existing code "mature". The rewrite tries to preserve the inner parts while changing the context to unlock some more potential.

And there is a hard limit on what I can do before my brain shuts down. There is an aspect of training to it, and energy conservation too. Familiar problems are easy to spam out high quality solutions for - pages of code that just work on the first try. New ones need an R&D phase where the first few attempts reflect a shaky, uncertain approach. At a higher level of evolution - more edge cases, synchronization logic, and state to track - the code tends to require more activation energy, which compounds slowing productivity.

So I currently think explicit iteration might be key: when activation energy feels high, do maintenance work, and if you can't find low-hanging fruit then it might be the right time to do an architectural change(not rewriting the whole program, but changing up the menu of modules and dependencies to reflect current needs). This is especially true if the overall design goals changed along the way because it's hard to change course after you built the features. New designs = new modules.

All of this is a bit different from the work-ethic mode of the article, to which I would point to physical training as the model: You don't go all-out on your training every single day, unless you're a pro with trainers and a good drug regimen that can optimize the recovery time/progression ratio. A more reasonable goal is once or twice a week to push yourself on something you can track easily - lift numbers, time/energy, etc. The rest of the time all goes to recovery or a basic level of maintenance. Distractions during the day mostly reflect wanting to have recovery time, but not having it instituted in a fashion that would do so efficiently - nobody teaches brain work as a thing that needs any kind of rest and recovery period, but the fact of the matter is that making many precise decisions is tiring, high energy stuff. Lowering the precision to "only add stub code right now" is both lower latency and helps conserve energy. Likewise the tendency of code to progress from visual mockup(feature reports itself as working and maybe surfaces an interface but doesn't use the "real" data structures) towards an optimized algorithm reflects an approach of energy conservation.