Hacker News new | ask | show | jobs
by jack_pp 25 days ago
have you tried modularizing / breaking down your code into different files (ideally each having functional code so they don't depend much on anything else) as much as possible?
3 comments

I have. My main 'claim' is that AI isn't naturally inclined to structure code well.

Doesn't mean you can't make it, or rather you must.

That's my biggest issue with it personally, as an academic. Way too much unnecessary indirection that makes it harder to read and understand the assumptions and parameters going into the code, and unnecessary defensive programming for code that is just going to be run a few different ways with strictly controlled inputs.
I knew it. I keep asking people why they're constantly checking if an attribute might be empty.

One particularly bad instance consisted of someone checking for the existence of an attribute on a class they had created themselves.

When I asked why they didn't simply ensure the attribute existed they got defensive.

are you suggesting this because you think I haven't tried it? I'm genuinely confused. We are professional developers working with a team of more than 1 person. Yes we have code in multiple files and have heard of the basic ideas of software architecture.

It's like being asked if i'm using source control? It's kinda a given if you're doing more than hobby projects.

I'm saying lean more into it, to the extreme and instruct your models to do the same
How would that help with the raised issue?
Smaller the function, less ways to screw it up, for humans and llms alike. I suspect humans don't code like this because it is too tedious but LLMs don't have such problems
Less ways to screw up an individual function, more ways to screw up their composition. Still not clear to me that it's better