News for hackers. Stuff that matters.
Re:When AI Promises Speed but Delivers Debugging Hell by dagw on Sunday January 26, 2025 @07:54AM (#42829791)
AI isn't great at creating software, but it is great at writing functions. I often ask AI to "write a function that takes A, looks up B in a SQL database, and returns C, or write a function that implements the FooBar algorithm in C++" and on the whole that works pretty well. Asking it to write documentations for those functions also works really well. Asking it to write unit tests for those functions works pretty well (although you have to be extra careful, because sometimes the tests are wrong).

What you have to do, and what AI cannot do well, is to decide where in the codebase to put those functions, and decide how to structure the code around those functions. You have to decide how and when and why to call each of those functions.

Re:When AI Promises Speed but Delivers Debugging Hell by javier2 on Sunday January 26, 2025 @07:56AM (#42829802)
When I have to be that specific with it, it would be faster for me to just write it directly in my normal IDE with great auto complete
Re:When AI Promises Speed but Delivers Debugging Hell by dagw on Sunday January 26, 2025 @08:07AM (#42829845)
it would be faster for me to just write it directly in my normal IDE

Then you are a much better developer than me (which you may very well be). I'd like to think I'm pretty good, and I've many times spent hours trying to think through complex SQL queries or getting all the details right in some tricky equation or algorithm. Writing the same code with an AI often takes 2-20 minutes.

If it's faster for me, it might not be faster for everybody, but it is probably faster for many people.

Re:When AI Promises Speed but Delivers Debugging Hell by jprete on Sunday January 26, 2025 @08:42AM (#42830057)
The way to get better is to do it a lot. Every time you dig through a problem to solve it, you're not just learning about that problem - you're learning about every problem near it in the problem space, including the meta-problems about how to get information, solve problems, and test solutions.

In a sense you're slowly building the LLM in your head, but it's more valuable there because of the much-better idea evaluation, and lack of network/GPU overhead.

Re:When AI Promises Speed but Delivers Debugging Hell by javier2 on Sunday January 26, 2025 @08:59AM (#42830131)
Ok i dont know. When I first read it, it sounded like you have to spoon feed details until AI gets it right. Or perhaps your ide could be better!
Re:When AI Promises Speed but Delivers Debugging Hell by Ekaros on Sunday January 26, 2025 @09:15AM (#42830211)
If you have to spend significant amount of time thinking things through how do you know the output from AI is correct and covers all details?
Re:When AI Promises Speed but Delivers Debugging Hell by dagw on Sunday January 26, 2025 @09:28AM (#42830286)
how do you know the output from AI is correct and covers all details?

Same way as any other code. You look at it, ask the 'author' to explain any parts you don't understand, reason through what it's doing and then test it.

Re:When AI Promises Speed but Delivers Debugging Hell by sarchertech on Sunday January 26, 2025 @10:19AM (#42830601)
That’s so much slower than writing it myself though.

The only reason to bother doing that with a junior developer is to teach them.

Re:When AI Promises Speed but Delivers Debugging Hell by dagw on Sunday January 26, 2025 @10:49AM (#42830829)
You have to do all those steps no matter if you write it yourself of if an AI helps you generate the code. Just typing the first thing that comes into your head and not bothering to test it will rarely create good code in all but the most trivial cases.

I find having an AI write out the algorithm and then walking me through the steps and generating test cases for all the corner case much faster than, looking up the algorithm online, trying to understand it, implementing all the details and then writing a test suite for it by hand. But I guess YMMV.

Re:When AI Promises Speed but Delivers Debugging Hell by sarchertech on Sunday January 26, 2025 @11:11AM (#42831051)
Well I was assuming you already understood the domain and the algorithm (or at least a good idea how you’d solve the problem). If you don’t, sure having an LLM cough up something is probably faster than finding and teaching yourself a new algorithm.

I definitely wouldn’t trust an LLM to come up with an optimal algorithm if I didn’t already have an idea of how to solve the problem myself though. There’s too much room for subtle bugs and unknown unknowns.

Tests aren’t a substitute for thoroughly understanding a solution (and thoroughly understanding a solution involves at least having an idea about the tradeoffs of different solutions, which you won’t have if you had no idea how to solve something yourself).

Most functions in line of business software though are going to be something like “loop over each item in this list, transform them from one format to another, then add them all up and save that somewhere.”

Actually typing out the code to do that is in no way a bottleneck for me (unless I’m working in an unfamiliar language and don’t understand the syntax well).

Re:When AI Promises Speed but Delivers Debugging Hell by dagw on Sunday January 26, 2025 @11:41AM (#42831349)
Actually typing out the code to do that is in no way a bottleneck for me

For me it often is. Understanding and solving the problem in the abstract is often the easy part. I might realise that one way to solve this problem is by representing the data X as a graph with properties Y and then use that fact those graphs behave like Z under conditions A. Or I might know that it's possible to get the information I need out of this database using some sort of complex series of joins. Correctly writing the relevant C++ or SQL do actually make the computer solve the actual problem still takes me a lot of time.

I often find that coming up with a good approach to solving a problem is a fast part, and actually typing out the bug free code to implement that idea the slow part, and LLMs at least for me speed up that slow part significantly.

Re:When AI Promises Speed but Delivers Debugging Hell by pydry on Sunday January 26, 2025 @08:12AM (#42829877)
It manages simple functions but Ive tried to get it to do complex ones (e.g. a parser with a bunch of edge cases) and it totally shit the bed.

For the simpler cases I think prompting still took about as long as just writing the damn thing myself if I was familiar with the language.

The coding I have found it useful for is small, self contained, well defined scripts in bash where the tedious part is reminding myself of all of the command switches and the funky syntax.

Re:When AI Promises Speed but Delivers Debugging Hell by ExtremisAndy on Sunday January 26, 2025 @08:30AM (#42829981)
"AI isn't great at creating software, but it is great at writing functions."

This 100%. In my experience (ChatGPT - paid account), it often causes more problems than it solves when I ask it to do anything complex, but for writing functions that I describe in simple English, much like your example here, it has been overall pretty amazing. Also, I love asking it to generate tests for the function it writes (or that I write!). That has also been a huge timesaver for me. I find testing to be so boring and yet it's obviously essential, so it's nice to offload (some of) that to an LLM!