Live data from Hacker News

Be intentional about how AI changes your codebase

aicode.swerdlow.dev

61–70 of 123 posts

Re: Be intentional about how AI changes your codebase

#63

My intentionality is that I'll never let it make the changes. I make the changes. I might make changes it suggests, but only upon review and only written with my hands.

I think this style of work will go away. I was skeptical but I now write the majority of my code through agents.

People like OP are the reason why the demand for software engineers will rise exponentially.

Re: Be intentional about how AI changes your codebase

#64
post #2

I've seen a lot of people talking about how AI is making codebases worse. I reject that, people are making codebases worse by not being intentional about how their AI writes code. This is my take on how to not write slop.

Fully agree. AI or not, it's still the human developer's responsibility to make sure the code is correct and integrates well into the codebase. AI just made it easier to be sloppy about it, but that doesn't mean that's the only way to use these tools.

Re: Be intentional about how AI changes your codebase

#65

"Every optional field is a question the rest of the codebase has to answer every time it touches that data," This is a beautiful articulation of a major pet peeve when using these coding tools. One of my first review steps is just looking for all the extra optional arguments it's added instead of designing something good.

There's nothing specific to AI about this. Humans make the same mistake. To solve this permanently, use a linter and apply a "ratchet" in CI so that the LLM cannot use ignore comments

Is there a Python linter that does this?

Re: Be intentional about how AI changes your codebase

#67

"Every optional field is a question the rest of the codebase has to answer every time it touches that data," This is a beautiful articulation of a major pet peeve when using these coding tools. One of my first review steps is just looking for all the extra optional arguments it's added instead of designing something good.

[dead]

Re: Be intentional about how AI changes your codebase

#68

My intentionality is that I'll never let it make the changes. I make the changes. I might make changes it suggests, but only upon review and only written with my hands.

unfortunately, unless you are god level good (i would say top 100 developers in the entire world), you will be fired eventually.

Lol

Re: Be intentional about how AI changes your codebase

#69

Because of the way that I use AI, I am constantly looking at the code. I usually leave it alone, if I can; even if I don't really like it. I will, often go back, after the fact, and ask for refactors and documentation. It works. Probably a lot slower than using agents, but I test every step, and it is a lot faster than I would do it, unassisted.

I don't think testing the product alone is good enough, because when you give it tests it has to pass it prioritizes passing them at the expense of everything else — including code quality. I've seen it pull in random variables, break semantic functions, etc.

Code quality can also be codified. If you can't express "code quality" deterministically, then it's all just feels.

And if you can define "quality" in a way the agent can check against it, it will follow the instructions.

Re: Be intentional about how AI changes your codebase

#70
post #36

Earlier quoted context omitted.

this always starts out right but over the years the code changes and its documentation seldom does, even on the best of teams. the amount of code documentation that I have seen that is just plain wrong (it was right at some point) far outnumbers the amount of code documentation that was actually in-sync with the code. 30 years in the industry so large sample size. now I prefer no code documentation in general

Are there any good systems that somehow enforce consistency between documentation and code? Maybe the problem is fundamentally ill-posed.

Simon Willison had this idea of "Documentation unit tests" in 2018: https://simonwillison.net/2018/Jul/28/documentation-unit-tes...

It's not a massively complex AI monstrosity (it's from 2018 after all) or a perfect solution, but it's a good jumping off point.

With a slight sprinkling of LLM this could be improved quite a bit. Not by having the agent write the documentation necessarily, but for checking the parity and flagging it for users.

For example a CI job that checks that relevant documentation has been created / updated when new functionality is added or old one is changed.

Post reply on HN