News for hackers. Stuff that matters.
Re:AI-enhanced development makes me more ambitious with my p... by withinboredom on Friday March 31, 2023 @02:46AM (#35383543)
How do you know it is even close to correct? When I’ve asked it for code, it has been subtly wrong, or worse, correct but missing important edge cases that it doesn’t even seem to be aware of.
Re:AI-enhanced development makes me more ambitious with my p... by ThePhysicist on Friday March 31, 2023 @02:48AM (#35383567)
I can read the code and verify it. Sometimes there are small mistakes but overall the architecture and approach are mostly correct. It won't produce 100 % production-grade code, but that's not expected for a PoC. And personally I also get stuff subtly wrong at times, I just iterate and test to find these cases and fix them. So I guess we're not fully replacable yet.
Re:AI-enhanced development makes me more ambitious with my p... by Thorentis on Friday March 31, 2023 @03:41AM (#35383914)
You can't read API calls and know if they're real, or if the function names are plausible but non existent. This is the problem with GPT. It creates great sounding possible APIs, but has no idea which APIs actually exist.
Re:AI-enhanced development makes me more ambitious with my p... by simonw on Friday March 31, 2023 @03:50AM (#35383977)
That's the great thing about using GPT for code - unlike factual knowledge, it's very easy to confirm if the code it wrote had errors or not: you run it.

The you test it manually with a few more inputs, then you write some automated tests for it (maybe with GPT's assistance).

Re:AI-enhanced development makes me more ambitious with my p... by politician on Friday March 31, 2023 @09:50AM (#35387147)
You can put AI in an iteration loop with a compiler and have it bake a functional test suite overnight. It’s a TDD practitioner’s dream.
Re:AI-enhanced development makes me more ambitious with my p... by withinboredom on Friday March 31, 2023 @09:55AM (#35387213)
Oh. Now that is pretty slick
Re:AI-enhanced development makes me more ambitious with my p... by macintux on Friday March 31, 2023 @12:10PM (#35389241)
“Ran this with no errors, works great” is how you end up with Microsoft exposing everyone’s personal email via Bing.
Re:AI-enhanced development makes me more ambitious with my p... by IanCal on Friday March 31, 2023 @07:34AM (#35385476)
> You can't read API calls and know if they're real, or if the function names are plausible but non existent

Why not? And if I miss them, my editor, compiler or general testing should pick that up.

Re:AI-enhanced development makes me more ambitious with my p... by satvikpendem on Friday March 31, 2023 @09:02PM (#35395898)
Yeah, I think many people are using them for dynamically typed languages like Python or Ruby, not Rust or TypeScript. If it's the latter, your compiler will automatically find the errors for you.
Re:AI-enhanced development makes me more ambitious with my p... by satvikpendem on Friday March 31, 2023 @09:01PM (#35395895)
If you use a dynamically typed language like Python or Ruby, sure. I use it for Rust and the compiler immediately catches any errors. Just one more reason I don't use dynamically typed languages.
Re:AI-enhanced development makes me more ambitious with my p... by graeber_28927 on Friday March 31, 2023 @03:16AM (#35383732)
To me it's a feature. If I ask any human, often I get "no" as an answer, but with ChatGPT I can be confident that it will produce something, whether it's right or wrong. If it constantly said "I'm nut sure, I'd rather decline this one", I'd be tempted to ask it to go on anyway. If it's wrong, it's wrong, but let me decide. It might be close!
Re:AI-enhanced development makes me more ambitious with my p... by worldsayshi on Friday March 31, 2023 @03:33AM (#35383863)
Would be a nice feature if it could add annotations or text coloring to denote uncertainty though!

Edit: Hmm, maybe it can add uncertainty markers if I just ask...

Re:AI-enhanced development makes me more ambitious with my p... by blep_ on Friday March 31, 2023 @04:47PM (#35393403)
I tried it. It took some iteration and explaining to get it to do what I wanted, but here was the final result:

--

Building a bridge over a lake using only toothpicks would be extremely challenging due to the limited strength of toothpicks. (70%) However, it is possible to build a toothpick bridge by using a truss structure. A truss structure involves using triangles to distribute the weight of the bridge evenly across the structure. (80%)

To build a toothpick bridge over the lake, the first step would be to create a design using a truss structure. The design should take into consideration the width of the bridge, the width of the lake, and the strength of toothpicks. (90%) The toothpicks should be laid in layers to increase their strength. (70%)

To estimate how many toothpicks would be needed, we would need to determine the spacing between each toothpick and the number of toothpicks needed to create the truss structure. The number of toothpicks required would also depend on the thickness and quality of the toothpicks used. (80%)

Given the width of the bridge is 20 meters and the width of the lake is 200 meters, the toothpick bridge would require approximately 10 layers of toothpicks to span the distance. However, without a detailed design, it is impossible to estimate the exact number of toothpicks needed to build the bridge. (60%)

Overall, I would say I am 70% confident in the correctness of this answer, as it is based on theoretical principles and assumptions about the strength of toothpicks.

--

It's... okay, not great. The blatantly wrong part is marked 60%, which is the lowest certainty it assigned to anything, but that's still really high for how wrong it is.

Re:AI-enhanced development makes me more ambitious with my p... by lionkor on Friday March 31, 2023 @02:52AM (#35383588)
Always mention your stack before writing stuff like this - people who write js/ts where every problem that could be done has been done will get very different mileage than, say, people who write C and assembly for some obscure architecture
Re:AI-enhanced development makes me more ambitious with my p... by vidarh on Friday March 31, 2023 @04:18AM (#35384168)
It can handle a quite broad range of languages. I've had decent luck with quite obscure stuff. Oberon worked quite well, for example.

But out of curiosity, to give it something harder, I asked ChatGPT w/GPT3.5 to write me an interrupt handler for a simple raster effect for the Commodore 64 in 6502 assembly, and it got tantalisingly close while being oh-so-wrong in relatively basic ways which suggests that it hasn't "grasped" how to handle control flow in a language without clearly delineated units.

GPT4 appears to have gotten it right (it's ~30 years since I've done this myself), though the code it wrote was a weird mix of hacks to save the odd cycle followed by blatant cycle wasting stuff that suggest it's still not seen quite enough "proper" C64 demo code.

Re:AI-enhanced development makes me more ambitious with my p... by anon291 on Friday March 31, 2023 @11:24AM (#35388500)
Unfortunately, this is simply not the case, as much as I hate it. I've worked on several custom ISAs and processors (mostly at companies shipping custom AI accelerators), and after sufficient explanation of the ISA to chat gpt, it was able to write machine learning kernels that did indeed run on our architecture. It is an impressive piece of technology, as much as I hate to admit
Re:AI-enhanced development makes me more ambitious with my p... by awestroke on Friday March 31, 2023 @02:48AM (#35383566)
How do you know your own code is correct? Now supply the same strategy to others code
Re:AI-enhanced development makes me more ambitious with my p... by withinboredom on Friday March 31, 2023 @02:59AM (#35383624)
Haha, that’s actually a good and fair question. I don’t actually know the answer to that. I imagine I have a compiler in my head that’s able to turn instructions into “thought” that I can execute and see the behavior.
Re:AI-enhanced development makes me more ambitious with my p... by roel_v on Friday March 31, 2023 @03:44AM (#35383931)
Make it write a test suite that you can manually verify/expand as necessary, just like code written by humans. I don't understand this 'but how do you know it works' argument. How do you know the code you wrote yourself works? I hope you don't rely on your superior programming skills to just get it right the first time?
Re:AI-enhanced development makes me more ambitious with my p... by layer8 on Friday March 31, 2023 @07:38AM (#35385516)
You build a correctness proof in your head by thinking through all the details. That what takes most of the time, and the AI doesn’t relieve you from that. Of course one doesn’t always get everything right, but testing alone is no substitute for deductive thinking about the code’s correctness. And it’s also less fun having to do that for someone else’s code.
Re:AI-enhanced development makes me more ambitious with my p... by simonw on Friday March 31, 2023 @10:01AM (#35387297)
ChatGPT can help you that process if you ask it to.

I often paste chunks of code into it just to get a detailed line-by-line explanation of exactly what that code is doing. It's really helpful, especially for convoluted code that you're trying to get a good feel for.

Re:AI-enhanced development makes me more ambitious with my p... by layer8 on Friday March 31, 2023 @10:29AM (#35387686)
That’s true, but you still have to follow and think through all the steps of what the code is doing. With regard to new code, I don’t see the sometimes cited 5-10 times increase in productivity if you’re actually diligent about code correctness.
Re:AI-enhanced development makes me more ambitious with my p... by AJRF on Friday March 31, 2023 @04:39AM (#35384283)
I wonder why people say stuff like this. Are people writing code then just blindly shipping it to production?

The process goes;

1. Write some code

2. Get AI assistance with some part

3. Check it's right, make changes

4. Write tests

5. Put up for code review

6. CI runs checks

7. Release Candidate

8. Release Testing

There are many, many chances to catch errors. If you don't have the above in place, i'd focus on that first before using AI assistance tools.

Re:AI-enhanced development makes me more ambitious with my p... by latexr on Friday March 31, 2023 @05:37AM (#35384604)
> I wonder why people say stuff like this. Are people writing code then just blindly shipping it to production?

Yes, yes they are! HN is now inundated with examples and the situation is only going to get worse. People with zero understanding of code, who take hours to convert a single line from one language to another (and even then don’t care to understand the result) are shipping and selling software.

https://news.ycombinator.com/item?id=35128502

Re:AI-enhanced development makes me more ambitious with my p... by politician on Friday March 31, 2023 @09:48AM (#35387110)
This is no different from the NFT hustlers. Scam artists and get rich quick types exist everywhere.
Re:AI-enhanced development makes me more ambitious with my p... by latexr on Friday March 31, 2023 @10:40AM (#35387859)
I agree.¹ And you might agree that making scamming easier is an undesirable outcome.

¹ Last paragraph: https://news.ycombinator.com/item?id=35133929

Re:AI-enhanced development makes me more ambitious with my p... by sumtechguy on Friday March 31, 2023 @10:15AM (#35387485)
People are already cut and pasting solutions off random webpages and stackoverflow. That they would grab stuff right out of chatgpt does not surprise me in the least. I would ask back 'why would this be any different this time?'
Re:AI-enhanced development makes me more ambitious with my p... by latexr on Friday March 31, 2023 @10:47AM (#35387940)
> random webpages and stackoverflow.

Crucially, those have context around them. And as you navigate them more and more you develop an intuitive sense for what is trustworthy or not. Perhaps you even find a particularly good blog which you reference first every time you want to learn something from a particular language. Or in the case of Stack Overflow, your trust in an answer is enhanced by the discussion around it: the larger the conversation, the more confident you can be of its merits and limitations.

When you get all your information from the same source and have no idea what it referenced, you lose the all the other cues regarding the validity, veracity, or usefulness of the information.

Re:AI-enhanced development makes me more ambitious with my p... by waboremo on Friday March 31, 2023 @11:13AM (#35388323)
>Crucially, those have context around them

Often incorrect context, incredibly biased context (no you don't know what you want, here's a complete misdirection), or just plain outdated. So basically the same thing as ChatGPT.

People who blindly copy and paste and ship are always going to do that. Everyone else isn't. It's really that simple.

Re:AI-enhanced development makes me more ambitious with my p... by latexr on Friday March 31, 2023 @11:49AM (#35388918)
> Often incorrect context, incredibly biased context

And as you learn more from different sources, you get better at identifying them.

> or just plain outdated

Which you can plainly see by looking at the date of publication. In the case of Stack Overflow, it is common that popular questions have newer answers which invalidate old ones and replace them at the top.

> People who blindly copy and paste and ship are always going to do that.

Yes, they will. You seem to agree that is bad. So wouldn’t it follow that it is also bad that the pool of people doing that is now increasing at a much larger rate?

Re:AI-enhanced development makes me more ambitious with my p... by waboremo on Friday March 31, 2023 @12:54PM (#35389866)
Sure, but do you have a solution to the problem that doesn't also hinder those who are using both StackOverflow and ChatGPT for "good"?

Without a solution we're just whining about bad actors existing.

Re:AI-enhanced development makes me more ambitious with my p... by sumtechguy on Friday March 31, 2023 @02:40PM (#35391406)
What I can find a bit more 'scary' is do they even need a deep understanding of it? ChatGPT will get it 'pretty close' and probably many times correct (as well as wrong). But if it is 'mostly right' then does it matter? Which is even more philosophical. As long as they can read the code and it does it like 95% right it may be just fine and they can fix it later? Heck they could even ask chatgpt what is wrong with it...
Re:AI-enhanced development makes me more ambitious with my p... by prerok on Friday March 31, 2023 @12:51PM (#35389800)
Agreed. Expecting people to understand context from StackOverflow is the same as expecting people to understand what they were given by ChatGPT.
Re:AI-enhanced development makes me more ambitious with my p... by peoplefromibiza on Friday March 31, 2023 @06:11AM (#35384809)
> Are people writing code then just blindly shipping it to production?

Of course they do.

Ship fast, break things, look cool, cash out, leave someone else to fix the mess you have created, it's the new black.

Re:AI-enhanced development makes me more ambitious with my p... by AJRF on Friday March 31, 2023 @06:57AM (#35385136)
And AI makes this...worse?
Re:AI-enhanced development makes me more ambitious with my p... by layer8 on Friday March 31, 2023 @07:32AM (#35385460)
Yes, it speeds it up considerably. More heaps of messy software produced much faster.
Re:AI-enhanced development makes me more ambitious with my p... by __MatrixMan__ on Friday March 31, 2023 @09:30AM (#35386877)
Doesn't that get the people who aren't doing due diligence fired faster?
Re:AI-enhanced development makes me more ambitious with my p... by bombela on Friday March 31, 2023 @02:26PM (#35391211)
I think not. Based on my experience working with people that have negative productivity continually being promoted and jumping from project to project leaving a mess behind. But hey they always deliver their non-functional crap in time, pleasing upper management short term.
Re:AI-enhanced development makes me more ambitious with my p... by digging on Friday March 31, 2023 @11:45AM (#35388853)
> I wonder why people say stuff like this. Are people writing code then just blindly shipping it to production?

Even if they're not, I find "scouring code I didn't write for potential errors of any magnitude" to be much harder than "writing code". I admit there's a sweet spot where errors would be easy to spot or where the AI is getting you unstuck, but it's not trustworthy enough at the moment for me to take the risk.

Re:AI-enhanced development makes me more ambitious with my p... by tbran on Friday March 31, 2023 @07:25AM (#35385386)
This sounds like how most of us develop anyway. Then we fix that stuff.
Re:AI-enhanced development makes me more ambitious with my p... by notjustanymike on Friday March 31, 2023 @09:30AM (#35386873)
Well that just sounds like StackOverflow with fewer steps.
Re:AI-enhanced development makes me more ambitious with my p... by hombre_fatal on Friday March 31, 2023 @10:24AM (#35387616)
You're apparently not concerned about good developers who can just evaluate the code, so you must be talking about bad developers.

Bad developers don't even know if the code they write themself is close to correct. AI doesn't make that situation any worse. It actually improves the situation.

Re:AI-enhanced development makes me more ambitious with my p... by ripperdoc on Friday March 31, 2023 @10:50AM (#35387981)
I've used ChatGPT a lot lately when developing some half-advanced Python code with async, websockets, etc. And I've been a bit underwhelmed to be honest. It will always output plausible code, but almost every time it will hallucinate a bit. For example, it will invent APIs or function parameters that don't exist, or it will mix older and newer versions of libraries. It never works to just copy-paste the code, it usually fails on something subtle. Of course, I'm not planning to just copy paste without understanding the code, but I often have to spend a fair amount of time checking the real docs to check how the APIs are supposed to be used, and then I'm not sure how much time I saved.

The second shortcoming is that that I have to switch over to ChatGPT and it's messy to give it my existing code when it's more than just toy code. It would be a lot more effortless if it was integrated like Copilot (if we ignore the fact that this means sending all your code to OpenAI...).

Still, it's great for boilerplate, general algorithms, data translanslation (for small amounts of data). It's a great tool when exploring.

Re:AI-enhanced development makes me more ambitious with my p... by furyofantares on Friday March 31, 2023 @12:59PM (#35389940)
Because I can read code.

In fact I read every piece of code I write, right after I write it, and probably more times after. It's a good practice, because as an human, my first take at a piece of code is often subtly wrong, or correct but missing important edge cases.

Speaking of, I didn't deliberately insert that typo in the above paragraph, but I did notice it when I read this post before submitting it, and would normally have corrected it.

Re:AI-enhanced development makes me more ambitious with my p... by burnished on Friday March 31, 2023 @02:00PM (#35390737)
Tests. Do you not write tests?

When I've asked for code it has been very wrong, the sweet spot appears to be things that you don't know off hand but can verify easily.