Also, getting template of 100s of LOC saves time in writing it from scratch even if I know exactly what I'd need to write.
I suspect the typical ChatGPT user is using it for code that's beyond his ability to write. That being the whole point of his using it.
It follows that such code is likely beyond his ability to understand. But worse, beyond his ability to understand he doesn't understand it.
I haven't used any llm for code yet but most code I ever touched was mostly written by others, and I wouldn't have been able to write it from scratch, but was able to modify it, take only chunks out of the whole to use for something else, take only the structure and not the verbatim code and use in some other language, refactor to satisfy my own priorities vs the original, get useful results in languages I don't even know, etc etc.
It doesn't seem like using some pattern-matched uber-autocorrect code would be much different, especially once you understand that understandingless nature of what your getting.
I rarely know exactly what I need to write and writing it usually isn't the problem. Sans LLM, there have always been tools and techniques you can lean on, like syntax highlighting, auto completion, your compiler feedback, or unit tests.
I find that writing code consumes only a small percentage of my time. And while writing code is obviously where bugs originate, it's not where the big problems come from.
Making software good is the easy part, making the right software is where the trouble lies. It's why I spend most time not coding, but talking to people. Figuring out what needs to be done, how, when and why.
What if you could write something like:
@implement_this
def prime_sieve(n: int) -> list[int]:
pass
And the decorator reads the function name and optional docstring, runs it through an LLM and replaces the function with one implementing the desired behavior (hopefully correctly). I remember there was something like this for StackOverflow.https://github.com/Matsemann/Declaraoids
Maybe I should make a LLM version of this.
[0] https://docs.spring.io/spring-data/jpa/reference/jpa/query-m...
https://github.com/PrefectHQ/marvin?tab=readme-ov-file#-buil...
from magentic import prompt
from pydantic import BaseModel
class Superhero(BaseModel):
name: str
age: int
power: str
enemies: list[str]
@prompt("Create a Superhero named {name}.")
def create_superhero(name: str) -> Superhero: ...
I do have plans to also solve the case you're talking about of generating code once and executing that each time.Of course AI data pipelines are a totally different conversation than code solutions.
Because almost every programmer these days has learned by a route that relies on incorporating code on trust. E.g. using someone else's compiler.
> I use code from LLMs on most work days ... not because I trust it, but because I understand it and tested it.
The snag there is that one can rarely verify test coverage is sufficient.
> the same as code from anyone, including from myself six months ago.
But it is not the same. ChatGPT delivers completely untested code. Not even syntax-checked in my case. Would you accept such code from any human?
> Trust doesn't enter into it. Clear and workable solutions do
Plenty of clear and workable solutions are discovered unsafe. I suspect that's much more likely when the code comes from a source such as ChatGPT that delivers code in a completely untested state.
There are way too countless many stories of people successfully accomplishing tasks by getting an llm to give them a starting point or outline or even a complete solution that only needed a few fixups, hardly any different from debugging your own first draft, to say it doesn't or can't work. That's already sailed.
The fact that it doesn't produce finished correct code, or even appropriate outline for every single case, doesn't seem especially remarkable or damning to me. It is what it is, it's not what it's not.
(I haven't used any myself, but I'm not primarily a coder who is obligated to take advantage of every available tool, and don't like how any of the llm companies are training on open source code without either consent or attribution and then selling that. And don't like how ai and even mere speech to text voice interface before that is being added to everything in general.)
I find this take surprising. Leaving AI aside entirely, debugging my first draft seems very different than debugging your first draft.
I grant, maybe that is still quite different.
There is something extra to grasp the theory behind someone else's code sometimes.
Really? You can't understand why people do things based on trust? Do you trust no one?