So asking it to write better code produces code with errors that can’t run?
Only when there's a financial incentive.
Can LLMs write better code if you keep asking them to “write better code”?
91–100 of 461 posts
Re: Can LLMs write better code if you keep asking them to “write better code”?
#92Claude very quickly adds classes to python code which isn't always what is wanted as it bloats out the code making readability harder.
Re: Can LLMs write better code if you keep asking them to “write better code”?
#93Using the tool in this way is a bit like mining: repeatedly hacking away with a blunt instrument (simple prompt) looking for diamonds (100x speedup out of nowhere). Probably a lot of work will be done in this semi-skilled brute-force sort of way.
Automating the feedback loop is key.
Re: Can LLMs write better code if you keep asking them to “write better code”?
#94Earlier quoted context omitted.
You can write maximally modular code while being minimally indirect. A well-designed interface defines communication barriers between pieces of code, but you don't have to abstract away the business logic. The interface can do exactly what it says on the tin.
> The interface can do exactly what it says on the tin. In theory. Do some code maintenance and you'll soon find that many things don't do what it says on the tin. Hence the need for debug and maintenance. And then going through multiple levels of indirection to get to your bug will make you start hating some "good code".
What's worse is trying to navigate an imperatively written 2000-line single-function, untestable module with undocumented, unabstracted routines found in ten other places in the codebase.
This is something I've encountered plenty in my career, always written by people who eschew best practices and misunderstand the benefits of abstraction, or think they're writing good abstractions when it's really just needless indirection without actually reducing coupling.
Understanding the nuance is one of the qualities of a good developer.
Re: Can LLMs write better code if you keep asking them to “write better code”?
#95This aligns with my experience. Claude very quickly adds classes to python code which isn't always what is wanted as it bloats out the code making readability harder.
Re: Can LLMs write better code if you keep asking them to “write better code”?
#96This aligns with my experience. Claude very quickly adds classes to python code which isn't always what is wanted as it bloats out the code making readability harder.
Re: Can LLMs write better code if you keep asking them to “write better code”?
#97 repeat with i = 0 to 9
put i * 10000 into ip
repeat with j = 0 to 9
put j * 1000 into jp
repeat with k = 0 to 9
put k * 100 into kp
repeat with l = 0 to 9
put l * 10 into lp
repeat with m = 0 to 9
put i + j + k + l + m into R[ip + jp + kp + lp + m]
end repeat
end repeat
end repeat
end repeat
end repeatRe: Can LLMs write better code if you keep asking them to “write better code”?
#98Using the tool in this way is a bit like mining: repeatedly hacking away with a blunt instrument (simple prompt) looking for diamonds (100x speedup out of nowhere). Probably a lot of work will be done in this semi-skilled brute-force sort of way.
Once you can basically have it run and benchmark the code, and then iterate that overnight, it’s going to be interesting. Automating the feedback loop is key.
Maybe if it can run sandboxed, with no internet access (but if the LLM is not local, it does require internet access).
Re: Can LLMs write better code if you keep asking them to “write better code”?
#99Define "better"
Re: Can LLMs write better code if you keep asking them to “write better code”?
#100“you are a senior expert”