Live data from Hacker News

Be intentional about how AI changes your codebase

aicode.swerdlow.dev

111–120 of 123 posts

Re: Be intentional about how AI changes your codebase

#111

What changed for me isn’t that AI writes bad code by default, but that it lowers the friction to adding code faster than the team can properly absorb it. The dangerous part is not obvious bugs, it’s subtle erosion of consistency.

[flagged]

Re: Be intentional about how AI changes your codebase

#112

"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.

Optional field can be addressed with good defaults. Well, that is how I think about it. I.e. if they aren't passed in then they are set to a default value.

Re: Be intentional about how AI changes your codebase

#114

Earlier quoted context omitted.

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

Dude I still get contracts in ColdFusion. You guys have no idea how slowly actual businesses actually move.

Ain't that the truth. It's common to see businesses using systems from the 90s in my line of work, or managing crucial business data and workflows in spreadsheets. Once companies establish a workflow they're often very hesitant to change it due to all the dependencies.

Re: Be intentional about how AI changes your codebase

#115

Earlier quoted context omitted.

Dude I still get contracts in ColdFusion. You guys have no idea how slowly actual businesses actually move.

Ain't that the truth. It's common to see businesses using systems from the 90s in my line of work, or managing crucial business data and workflows in spreadsheets. Once companies establish a workflow they're often very hesitant to change it due to all the dependencies.

And in a lot of cases they're making the right call. Change is incredibly expensive and risky and if the only real payoff is "it's slightly faster" that's probably not worth it.

Re: Be intentional about how AI changes your codebase

#116

The velocity problem is real. AI makes it easy to add things faster than you can understand what you added. The intentionality has to come before you prompt, not after you review.

Why? You can ask the agent to make 10 different solutions in the time it takes you to make 0.5. Then you review them based on whatever criteria you feel is right and either throw them all away and do it yourself (maybe with inspiration from the other solutions) or pick one to progress further.

Depends on the system for boilerplate yes, reviewing 10 solutions is faster. But when the code is deeply interconnected, reviewing solutions you don't fully understand just moves the problem downstream you end up with passing tests and broken assumptions.

Re: Be intentional about how AI changes your codebase

#117

This could have been html instead of whatever awful moving pattern it is.

God forbid people use CSS to build something cool

Cool? It’s broken on my iPhone, text appears beneath other text for no discernible reason. The result of AI coding ‘cool’ websites instead of learning how to use CSS properly.

Re: Be intentional about how AI changes your codebase

#119
post #112

"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.

Optional field can be addressed with good defaults. Well, that is how I think about it. I.e. if they aren't passed in then they are set to a default value.

Here is an example of what I mean when I say optional stuff is a sign of failure to design.

I inherited some vibe-coded scripts that dealt with AWS services like Bedrock and S3. These scripts needed create various AWS SDK clients. These clients needed to know which account/region to use.

Had this been well designed, there would have some function/module responsible for deciding what account/region to use. This decision point might be complex: it might consider things like environment variables, configuration files, and command line arguments. It might need to impose some precedence among these options. Whatever these details, the decision would be authoritative once made. The rest of the code base should have expected a clear decision and just do what was decided.

Instead, the coding assistant added optional account/region arguments in many submodules. These arguments were nullable. When left unspecified, "convenient" logic did its own environment lookups and similar. The result was many "works on my machine" failures because command-line arguments affected only certain portions of the program, environment variables others, config files still others.

This is grim stuff. It's a ton of code that should not exist, spreading the decision all over the code.

Re: Be intentional about how AI changes your codebase

#120
post #112

Earlier quoted context omitted.

Optional field can be addressed with good defaults. Well, that is how I think about it. I.e. if they aren't passed in then they are set to a default value.

Here is an example of what I mean when I say optional stuff is a sign of failure to design. I inherited some vibe-coded scripts that dealt with AWS services like Bedrock and S3. These scripts needed create various AWS SDK clients. These clients needed to know which account/region to use. Had this been well designed, there would have some function/module responsible for deciding what account/region to use. This decisi…

I see what you mean. Thanks.
Post reply on HN