by nkrisc · 1y ago · 0 comments
Many, many posts of people looking for help fixing AI-generated code because the AI got it wrong and they have no idea what the code even does. Much of the time the problem is simply an invented method name that doesn’t exist, a problem that is trivially solved by the error message and documentation. But they say they’ve spent several days or whatever going back and forth with the AI trying to fix it.
It’s almost a little sad. If they just take the time to actually learn what they’re doing they’ll be able to accomplish so much more.
Now of course people learning the traditional way have these same problems, but they’re debugging code they wrote, not gobbledygook from an AI. It’s also easier to explain the solution to them because they wrote the code, so it tends to be simpler. Several times I’ve pitied someone asking for help with AI code and even when I explained the solution they still didn’t understand it, and I had to just give up on them - I’m not getting paid to help them.
Rule number 1 and the only rule: You need to be a subject matter expert. Be it program logic or be it programming language. AI is only a helper, it will go wrong, frequently, and if you do not understand the reason for the code and the programming language, you will take so much more time than if you did not even use the AI.
Without naming the IDE, but one of the top 3 I guess, I asked it to simplify some code. I had repeated code 8 times. 6 of them were identical, the last 2 had a variation. The AI just did not catch it, and refactored all 8 blocks to use the logic of first block. How can you even do that? The code is similar but different, it looks the same but there are extra lines of code in the last 2 blocks !!
And it took me a while to realize this. I never ingest AI code directly so at first I was marveling at a job well done, and as I read and compared, the horror !! And that was not the first time it happened, but once again I got tricked by the soft spoken well mannered AI to believe that it did a fantastic job when it did not.
Edit: It is just an assistant. You give it a task, it will make a mistake, you tell it to fix the mistake, it will fix the mistake. It still saves you time. Next day, it will make the same mistake - and hopefully that gets reduced as the versions evolve.
Example: I wanted a tool that notifies me of replies or upvotes to my recent Hacker News comments. Grok3 did it in 133 seconds with Think mode enabled. Total time including me giving it the example HTML as attachment and writing the specs + pasting the response to a file and running it? About 5 minutes.
I know perfectly well how to do it myself, but do I want to spend the hour or so to write all the boilerplate for managing state and grabbing HTML and figuring out the correct html elements to poll? Fuck no.
Unless you're using a LLM with really long context, it's prone that some context loss will happen soner or later - when that happens, pointing errors that dropped out of the context will just result in repeated or garbage output.
Claude Code forces you to create a CLAUDE.md to direct how it works, with Cursor you can (and should) write Cursor Rules.
The difference with a good spec + AI vs just vibe coding from scratch is like night and day.
pro AI people sound like someone with an expensive addiction trying to justify it. the free product is bad, so I just need to pay to see the light?
Why would Anthropic let me use a model for free that is going to make me more skeptical of their paid offerings unless it is pretty similar to the paid ones and they think it's good?
Just read the manual and write the code yourself. These toys are a distraction.
It's a force constant, rather than a multiplier. If you're low skilled, asking it to do a low skilled task, it works fine. If you're high skilled, and asked it to do the low skilled task, you saved a tiny bit of time (less than that of the low skilled person).
But it cannot do a high skilled task (at least, not right now). It can pretend, which can lead the low skilled person astray (but not the high skilled person).
Therefore, all AI does is raise the floor of what is achievable by the laymen, rather than multiply the productivity of a high skilled programmer.
But that's a very low level task, where i had already decided on the "how it should be done" part. I find in general that for things that aren't really obvious, telling the llm _how_ to do it produces much more satisfactory results. I'm not quite sure how to measure that force multiplier - I can put in the same amount of work as a junior person and get better output?
Strong disagree. I've been coding for 25+years but never on the front-end side. I couldn't write JS w/ pen & paper with a gun against my head. But I know what to ask and how to make sure a react component does what I want it to do, with these tools.
> Rule number 1 and the only rule: You need to be a subject matter expert. Be it program logic or be it programming language.
You are a subject matter in program logic, just not programming language. You are supporting their point, not disagreeing.
I guess that's the part I disagree on. The programming language is largely irrelevant now is what I'm seeing. And especially the "time to first result" is orders of magnitude smaller when using AI assistants than having to rtfm/google/so every little problem I encounter in an unfamiliar language.
And I am in no way stating that my code will match an expert in that field, of course.
Do you have to maintain the code?
That is the subject matter expertise that many lack.
> is it weird or an anti-pattern to use a timer like this?
The response:
> Yes, using a timer like this is generally considered an anti-pattern in React for several reasons: It introduces non-deterministic behavior (timing-dependent code), It's a workaround rather than addressing the root cause, It can be brittle and lead to race conditions.
I'm sure all those things are true. This is a classic example of the problem with people using AI programming tools but lacking a real understanding of what they're doing. They don't know enough to question the advice they're getting, let alone properly review the code its generating.
The other day, in a Rails app, Claude generated a bunch of code that spawned various threads to accomplish certain things I needed to do asynchronously. Maybe these days, in Ruby 3 and Rails 8, this is safe. But I remember that back in the Rails 2 days, going off and spawning new threads was not a good idea. Plus, I have a back-end async job processor already set up. Again, I questioned the approach. The revised code I got back was a lot simpler, and once I'd reviewed and tested it, I (mostly) used it as-is.
is this the best way to do it or are there other solutions? what are the pros and cons?
are there security problems with this? how could I make this code more secure?
what are some things I should look out for with AI coding(meta question)?
what does this error mean?
just talking back and forth with the AI on the phone you can get a high level understanding of a topic pretty quickly and way more in depth and personalized than a tutorial on the internet.
Traits much less common than you might think among people who want to get into programming.
I spent a solid 2 hours yesterday trying to get an SSDP protocol implementation going because the LLM was absolutely insistent upon using 3rd party libraries that don't exist and UDP client methods defined in Narnia. I had to spoon feed it half-way attempts before I could get it to budge on useful code. This was all before I realized we had a problem with multicast group membership and multiple network adapters.
These models definitely can help (I wouldn't have gotten as far as I did without one), but you need to know what you want every step of the way. Having mere "vibes" about a sophisticated end result will result in unhappy outcomes. I think the model would have made my life much worse if I wasn't as cynical and suspicious regarding every aspect of its operation. I can see how these models would steal learning opportunities from more novice developers. Breaking out Wireshark is the sort of desperation that only arises when you can't constantly ping some rubber duck for shreds of hope (or once you realize there is no hope).
If the AI had access to the AST and could know what functions exist they might be helpful. Then they could write that function they wished existed if it doesn't. However that means they need to know how to understand the code not just the structure.
I’m not sure this is true. Prior to AI you saw a lot of the same behavior, but it was with code copied and pasted from stack overflow, or tutorials, or what have you.
I don’t think AI has changed much in terms of behavior. There has always been a subset of people who have just looked for getting something that “worked” without understanding why, whether that’s from an AI code assistant, or an online forum, or their fellow teammates, and others who want to understand why something works. AI has perhaps made this more apparent, but it’s always been a thing.
90% of the posts are about marketing or are self-help/motivational.
Anything related to art, sound or programming barely gets upvotes.
To paraphrase a meme "best I can do is text editor wars".
Gamedev.net was an amazing hang back in the early 2000s up to the 2010s.
Now it's just a perpetual "how do I do this with Unity" that is super hard to filter.
I just go to meetups now.
> best I can do is text editor wars
Or Unreal vs Unity wars in this case :'D
Hey, trying to translate excel sheet with chatgpt, cant understand what to do (posts screenshot with explanation and example "pip install [package-name]"
You just need to execute specified command in your environment
What is "my environment"?Then why does the AI not solve it anyways?
I think understanding "the code" will eventually be as important as understanding machine code or assembly nowadays - still very important for a small number of devs, important in very rare cases for some other devs and completely irrelevant to the majority of devs.
Because from my experience, sonnet 3.7 can almost always fix issues of that type and if it can't, it's usually not "trivial" at least not by my understanding of the word.
Even if the code it generates works, what happens when you need to change it and no longer have that AI conversation and its state available?
Then there's the security nightmare this is going to be. All this slop-code generated by ignorant hustlers with AIs is going to be a hellscape of security bugs.
The scale may change, but that is likely just because more people code. You couldn't do X but now you almost can!
> Now of course people learning the traditional way have these same problems, but they’re debugging code they wrote,
Really? They've not copied and pasted something from SO? They're that early in their coding journey?
> It’s almost a little sad. If they just take the time to actually learn what they’re doing they’ll be able to accomplish so much more.
Leading a horse to water, etc. but llms are excellent at being a patient teacher of basic coding.
Frankly they can be excellent at lots of things people keep saying they're bad at but some seem to refuse to learn how to use them as a tool. It reminds me of watching people be unable to use Google in the past - how to not just ask a question but search for information.