18 ms·
I think there is a commonly accepted rule of thumb that it is easier to write new code than modify existing code. Right? Why that is there may be several reaso
by galaxyLogic 2y ago
I think there is a commonly accepted rule of thumb that it is easier to write new code than modify existing code. Right?
Why that is there may be several reasons one being that when you try to improve existing code you would need to know all the untold dependencies in it to not break anything. Whereas when you write new code, there are no dependencies you don't know about.
But so, if you take an AI provided implementation, and try to fix it, you are basically doing just that, trying fix old code you don't know much about. You are working on a (AI-provided) legacy code-base in essence.
- te_chris 2y agoThis is an underrated point. And it’s not just an old code base. I find AI generated changes can lead to messy debugging when they don’t work as I didn’t write it first off.
- berkes 2y agoThe hard part about writing code, isn't writing the code. It's writing code that can be read, changed, understood. Today, next month, after ten years of random freelance engineers abusing it. By caffeinated me, tired me, bored me, that way too smart junior and that boneheaded senior.
- danielovichdk 2y agoNo. That's not how it works. Reading code towards refactoring it is harder than writing new code. Lots of fine literature has been written about this, it's all psychology and cognition. What you are trying to propose is that computer generated code should somehow make a programmer feel better about one self because they are given the opportunity to improve something that no one knows where is coming from and without a context. I think you are forgetting that computers can not generate context aware systems or programs. Look at the list by the author - useless in a different context than the one the author lives in. It does not improve anything, it simply adds more things someone else potentially has to worry about. Furthermore it adds to the same cognitive load than any other code - one needs to read it before one can change it, and changing it is really the first step to fully understanding it. You are not fixing anything old with AI generated code. Ask yourself also, where is the upstream you are trying "to fix".
- palata 2y agoAre you sure you replied to the right comment? You seem to have misunderstood it, I would say.
- fulafel 2y agoOn the other hand, you can cheaply have a lot of rewrites iterating with updated requirments now.
- lynx23 2y agoThats a bit like calling the code your intern just handed in "legacy". Modifying AI code doesn't have all the same shortcomings as with a legacy codebase, because the AI code was likely not very good in the first place. It feels like doing code review for a newbie. They come up with nice ideas, but if you take a good look at it, you usually find logic errors.
- galaxyLogic 2y agoI can see your point, AI is in many ways like an intern. And I'm not saying that interns can't be helpful. I wonder though if I have an intern and I tell them what is wrong with their code, they do learn from my feedback. One purpose for having interns write code is for them to learn. But is it the same with AI? Does it really learn from my feedback, or will it then just try something else, until I'm happy with its output? When (and if) AI learns from my feedback, does it then apply it's learning when other people ask it to do similar tasks?
- simonw 2y agoIt doesn't learn from your feedback beyond the current conversation that you are having with it: https://simonwillison.net/2024/May/29/training-not-chatting/ https://simonwillison.net/2024/May/29/training-not-chatting/ The difference between using AI and working with an intern is that the intern learns from you while the AI doesn't... which means that YOU need to learn from your interactions with the AI so you can prompt it more effectively next time. All of my Claude interactions include "(no react)" because I learned from past experience that without that it writes a React component which is much harder to export out and use separately. I've also learned to remind it to use 16px text sizes on input boxes (to avoid a zoom effect when selecting an input field on Mobile Safari), and I habitually say "Add a copy to clipboard button that changes its text to Copied! for 1.5s after you click it" because then I get a better UX for the copy feature.
- lynx23 2y agoIf you want the AI to "learn" something about your methods, you need to put that stuff into the context window, done. Thats basically why "You are a helpful assistant." is not enough for a prompt. You basically need to put in your coding standard, so that the machine knows what style to follow. Whenever you think it should "learn" something new about your methods, extent your system prompt. IOW, put everything you tell your intern, into the system prompt :-)