Eventually I just gave up. Look, I'm a game programmer. I code because it makes pretty colors move on my screen. I favor the fast over the correct, and I only do things "right" when my inner self remembers the pain of doing it wrong before; so I stick to simple behaviors separated, rip things out immediately if they start to be a headache, build one-off behaviors that aren't scalable, because damnit I don't have time to think about how to build this correctly. I want it to work so that I can use it and move on.
I started my path as an aspiring architect who would write pure, scalable, performant and dare I say beautiful code. My programs would hum like a fugue by Bach and my comments would hang off the page like sweet blackberry bunches, easy to pluck and digest. My hopes were so high for myself!
But today I burn a path to my goal without consideration to the debt or damage it deals, my heart without morals and my mind without regret. Each day I stray further from god. Yesterday I had to rip out a utility function that took an entity and type as its input and searched the hierarchy for a parent of that entity with that type to return it, so that I could message root level objects on collisions with their child objects. What a disgusting beast I had created! What have I become! But I soldier on, unhindered by my evils. I cast code beneath my feet and it crumbles instantly as I take each step closer to hell.
But my game is really fun to play! :D
I somewhat regret spending my time at companies that were ultimately shutdown or acquired and my code being unceremoniously thrown out, but that isn't really about the code but rather lifestyle/career choice of working for startups.
I don't think from a creative or learning perspective I regret any of the actual coding. Sure some of it wasn't great code but that was generally a product of circumstances, generally the value I personally derived from the code was solid.
I did made an explicit career choice early on not to go into aviation/avionics because of it's dual-use. Originally being very interested in UAVs before they were cool I did built my own both fixed wing and quad-copter. After spending some time thinking about how my code would inevitably be used if I joined Boeing, Raytheon or Thales though I decided maybe something else would be better.
i have come to accept that a strong military power can serve as a deterrent to others, and ultimately lead to a more peaceful existence (in the aggregate). i don’t believe that human beings can co-exist peacefully, so this deterrent is necessary (until we have some other means to achieve peace).
i would use a similar thought process to morally justify work on a general AI. given enough time i believe that humanity will destroy ourselves and this planet. in lieu of another solution, we may need an AI to assert control to prevent this from happening (or backfire and bring us fully into a hollywood dystopian future).
at the risk of going on a rant now, i have often found it hard to morally justify working on space travel, as i don’t believe that humanity has demonstrated that it deserves to colonize beyond Earth. that would only enable us to consume and destroy more of the universe.
I put "destroy" in quotes since I think that's ridiculously loaded. The biosphere itself is naturally unsustainable at its current complexity for more than 1 billion years from now[0], the Sun is going to go red giant past the next 5 billion years, and, as far as we know, the universe will end in heat death. Entropy and transformation is inevitable. Humans contribute to that, but doing it in the service of higher cognitive functions by which the universe can know itself should be the noblest reason for it to happen (from a human perspective), no?
Another counterpoint: what if humanity only becomes worthy of spreading itself in civilizations that can only form post-Earth (too far into the future to still be living on Earth)? Should those be condemned to non-existence because humanity's original nucleus didn't bootstrap itself impressively enough to earn a chance at outliving its planet?
0: See https://en.wikipedia.org/wiki/Timeline_of_the_far_future and Ctrl+f "c4 photosynthesis"
Throw people under the bus if necessary. Don’t accept ownership of code that sucks.