Ask HN: How to deal with shipping AI-written code you don't understand?
630 pointshttps://www.linkedin.com/posts/ali-hamie_im-an-engineer-at-m...
> I'm an engineer at Meta and I never felt this uncomfortable doing my job. I'm writing code these days and it all feels like a black box. This new standard of shipping with AI is moving so fast that if we're going to spend our time checking each line of code, it's going to take forever. That means you can end up with systems you've built where you don't truly understand how all the code works. You understand the high level, but not every detail. And maybe this is becoming the new standard. It goes against every instinct of being a software engineer. I'm used to understanding what I'm building. Now I'm trying to figure out how much I need to understand before I'm comfortable moving forward. Are other engineers feeling this too?
How are you handling this?
Comments (767) 238 threads
Earlier commentsI am perfectly comfortable prompting AI and then seeing the end result and not questioning any of the code. I've looked at code for nearly 20 years or longer, I can't even keep track how long anymore. Started with QBasic and DOS scripts. I just always accepted it as an annoying necessity, and then the world changed two times. Once when they started paying us good of money for it.
A second time when programmers became an insufferable bunch. It wasn't about the art of the product anymore. It wasn't about working with the other parts of business to understand the customer's needs and building to that. It became this weird gatekeeping bullshit where we turned on each other and started asking people to reverse binary trees and implementing search on a white board after 2 weeks of interviewing. And then rejecting them because "culture fit". Add in all the other misogynistic racist stuff, and yeah, this industry is messed up and it's rotten from the inside.
Ever software is a "I don't know what those previous engineers were doing, it's poop, so we have to refactor and rebuild with this new tech", and repeat endlessly. And quite honestly, every piece of code (mine especially) is garbage.
So I think this is great. Programming was a means to an end. It became over glorified. Now it's dying. I'm here for it and I support it. Now anyone can build an application no matter how complex, and the only thing that really decides success from failure is the actual business around it.
My point is if you don't understand the fundamentals of the underlying code (SQL in the example above), you're more likely to have issues in the future. Or maybe not if that app doesn't reach a usage pattern or complexity where the nuances under the hood matter.
It really depends on what you're shipping. Meta ships social media apps where in the grand scheme of things if something is broken software wise it largely doesn't matter. What's the worst case? lost ad revenue? Users can't do things? If that were software for MRI machines or aerospace where software issues/bugs can result in lives lost then it matters much more in understanding what is going on at all levels of the software and potentially hardware.
* Code is meant for reading, not writing. You will spend more time reading code so optimise for reading. I got this advice from a previous Principal Engineer and it has stuck with me ever since. Yes you can generate slop, but you have to be able to read it. Otherwise, for me, sloppy code becomes the context for the next feature, then the feature after that, until the codebase is really messy and brittle.
* The other principle I work with is that more code means more bugs and more recently security vulnerabilities. We're churning more and more code, and looking less at the code. Another agent can very easily find vulnerabilities in your website or app. Sometimes I feel that this is inevitable with the way folks are doing things
* Then my most recent principle. Always add value, know your customer, know your product, know your business metrics. I'm seeing more and more the statistic of "I merged X PRs in a day/week". Just like before AI, these things are very superficial. How many tokens did it cost? How many dollars did it cost? How much revenue did it earn? How many customers are adopting the feature? This applies to internal and customer facing features. The amount of vanity metrics that AI can create now is astounding, and people are still falling for it regularly.
* In a new project, I start with a few commits to see if the agent understands my desired architecture. Once that passes, everything else falls into place and slowly trust the code more and more. Sometimes when I need to add a complex feature, I would sit more with the design than the implementation, then I would skim the generated code to see if it's adjusting accordingly.
All comments shown.
Couldn't load more comments. Check your connection and try again.