this post was submitted on 21 Sep 2024
83 points (71.3% liked)

Technology

58292 readers
4189 users here now

This is a most excellent place for technology news and articles.


Our Rules


  1. Follow the lemmy.world rules.
  2. Only tech related content.
  3. Be excellent to each another!
  4. Mod approved content bots can post up to 10 articles per day.
  5. Threads asking for personal tech support may be deleted.
  6. Politics threads may be removed.
  7. No memes allowed as posts, OK to post as comments.
  8. Only approved bots from the list below, to ask if your bot can be added please contact us.
  9. Check for duplicates before posting, duplicates may be removed

Approved Bots


founded 1 year ago
MODERATORS
 

Please remove it if unallowed

I see alot of people in here who get mad at AI generated code and I am wondering why. I wrote a couple of bash scripts with the help of chatGPT and if anything, I think its great.

Now, I obviously didnt tell it to write the entire code by itself. That would be a horrible idea, instead, I would ask it questions along the way and test its output before putting it in my scripts.

I am fairly competent in writing programs. I know how and when to use arrays, loops, functions, conditionals, etc. I just dont know anything about bash's syntax. Now, I could have used any other languages I knew but chose bash because it made the most sense, that bash is shipped with most linux distros out of the box and one does not have to install another interpreter/compiler for another language. I dont like Bash because of its, dare I say weird syntax but it made the most sense for my purpose so I chose it. Also I have not written anything of this complexity before in Bash, just a bunch of commands in multiple seperate lines so that I dont have to type those one after another. But this one required many rather advanced features. I was not motivated to learn Bash, I just wanted to put my idea into action.

I did start with internet search. But guides I found were lacking. I could not find how to pass values into the function and return from a function easily, or removing trailing slash from directory path or how to loop over array or how to catch errors that occured in previous command or how to seperate letter and number from a string, etc.

That is where chatGPT helped greatly. I would ask chatGPT to write these pieces of code whenever I encountered them, then test its code with various input to see if it works as expected. If not, I would ask it again with what case failed and it would revise the code before I put it in my scripts.

Thanks to chatGPT, someone who has 0 knowledge about bash can write bash easily and quickly that is fairly advanced. I dont think it would take this quick to write what I wrote if I had to do it the old fashioned way, I would eventually write it but it would take far too long. Thanks to chatGPT I can just write all this quickly and forget about it. If I want to learn Bash and am motivated, I would certainly take time to learn it in a nice way.

What do you think? What negative experience do you have with AI chatbots that made you hate them?

top 50 comments
sorted by: hot top controversial new old
[–] bruhduh@lemmy.world 27 points 5 days ago* (last edited 5 days ago) (3 children)

That is the general reason, i use llms to help myself with everything including coding too, even though i know why it's bad

[–] ikidd@lemmy.world 5 points 5 days ago (2 children)

I'm fairly sure Linus would disapprove of my "rip everything off of Stack Overflow and ship it " programming style.

[–] ZILtoid1991@lemmy.world 1 points 4 days ago

And sometimes that's my only option when interfacing to toehr API.

[–] bruhduh@lemmy.world 1 points 4 days ago

And we still using it brother

[–] dezmd@lemmy.world 4 points 5 days ago

This is a good quote, but it lives within a context of professional code development.

Everyone in the modern era starts coding by copying functions without understanding what it does, and people go entire careers in all sorts of jobs and industries without understanding things by copying what came before that 'worked' without really understanding the underlying mechanisms.

What's important is having a willingness to learn and putting in the effort to learn. AI code snippets are super useful for learning even when it hallucinates if you test it and make backups first. This all requires responsible IT practices to do safely in a production environment, and thats where corporate management eyeing labor cost reduction loses the plot, thinking AI is a wholesale replacement for a competent human as the tech currently stands.

[–] xavier666@lemm.ee 4 points 5 days ago

Based Linus strikes again

[–] helenslunch@feddit.nl 24 points 5 days ago* (last edited 5 days ago) (1 children)

If you're not an experienced developer, it could be used as a crutch rather than actually learning how to write the code.

The real reason? People are just fed up with AI in general (that has no real-world use to most people) being crammed down their throats and having their personal code (and other data) being used to train models for megacorps.

[–] sirblastalot@ttrpg.network 3 points 5 days ago

There are probably legitimate uses out there for gen AI, but all the money people have such a hard-on for the unethical uses that now it's impossible for me to hear about AI without an automatic "ugggghhhhh" reaction.

[–] leftzero@lemmynsfw.com 50 points 6 days ago (7 children)

The other day we were going over some SQL query with a younger colleague and I went “wait, what was the function for the length of a string in SQL Server?”, so he typed the whole question into chatgpt, which replied (extremely slowly) with some unrelated garbage.

I asked him to let me take the keyboard, typed “sql server string length” into google, saw LEN in the except from the first result, and went on to do what I'd wanted to do, while in another tab chatgpt was still spewing nonsense.

LLMs are slower, several orders of magnitude less accurate, and harder to use than existing alternatives, but they're extremely good at convincing their users that they know what they're doing and what they're talking about.

That causes the people using them to blindly copy their useless buggy code (that even if it worked and wasn't incomplete and full of bugs would be intended to solve a completely different problem, since users are incapable of properly asking what they want and LLMs would produce the wrong code most of the time even if asked properly), wasting everyone's time and learning nothing.

Not that blindly copying from stack overflow is any better, of course, but stack overflow or reddit answers come with comments and alternative answers that if you read them will go a long way to telling you whether the code you're copying will work for your particular situation or not.

LLMs give you none of that context, and are fundamentally incapable of doing the reasoning (and learning) that you'd do given different commented answers.

They'll just very convincingly tell you that their code is right, correct, and adequate to your requirements, and leave it to you (or whoever has to deal with your pull requests) to find out without any hints why it's not.

[–] JasonDJ@lemmy.zip 8 points 6 days ago (1 children)

This is my big concern...not that people will use LLMs as a useful tool. That's inevitable. I fear that people will forget how to ask questions and learn for themselves.

Exactly. Maybe you want the number of unicode code points in the string, or perhaps the byte length of the string. It's unclear what an LLM would give you, but the docs would clearly state what that length is measuring.

Use LLMs to come up with things to look up in the official docs, don't use it to replace reading docs. As the famous Russian proverb goes: trust, but verify. It's fine to trust what an LLM says, provided you also go double check what it says in more official docs.

[–] cy_narrator@discuss.tchncs.de 6 points 6 days ago

I can feel that frustrated look when someone uses chatGPT for such a tiny reason

load more comments (5 replies)
[–] simplymath@lemmy.world 45 points 1 week ago (5 children)

People who use LLMs to write code incorrectly perceived their code to be more secure than code written by expert humans.

https://arxiv.org/abs/2211.03622

Lol.

We literally had an applicant use AI in an interview, failed the same step twice, and at the end we asked how confident they were in their code and they said "100%" (we were hoping they'd say they want time to write tests). Oh, and my coworker and I each found two different bugs just by reading the code. That candidate didn't move on to the next round. We've had applicants write buggy code, but they at least said they'd want to write some test before they were confident, and they didn't use AI at all.

I thought that was just a one-off, it's sad if it's actually more common.

[–] nfms@lemmy.ml 2 points 6 days ago (1 children)

OP was able to write a bash script that works... on his machine 🤷 that's far from having to review and send code to production either in FOSS or private development.

[–] petrol_sniff_king@lemmy.blahaj.zone 4 points 6 days ago (1 children)

I also noticed that they were talking about sending arguments to a custom function? That's like a day-one lesson if you already program. But this was something they couldn't find in regular search?

Maybe I misunderstood something.

Exactly. If you understand that functions are just commands, then it's quite easy to extrapolate how to pass arguments to that function:

function my_func () {
    echo $1 $2 $3  # prints a b c
}

my_func a b c

Once you understand that core concept, a lot of Bash makes way more sense. Oh, and most of the syntax I provided above is completely unnecessary, because Bash...

load more comments (3 replies)
[–] bitwolf@lemmy.one 18 points 6 days ago (1 children)

We built a Durable task workflow engine to manage infrastructure and we asked a new hire to add a small feature to it.

I checked on them later and they expressed they were stuck on an aspect of the change.

I could tell the code was ChatGPT. I asked "you wrote this with ChatGPT didn't you?" And they asked how I could tell.

I explained that ChatGPT doesn't have the full context and will send you on tangents like it has here.

I gave them the docs to the engine and to the integration point and said "try using only these and ask me questions if you're stuck for more than 40min.

They went on to become a very strong contributor and no longer uses ChatGPT or copilot.

I've tried it myself and it gives me the wrong answers 90% of the time. It could be useful though. If they changed ChatGPT to find and link you docs it finds relevant I would love it but it never does even when asked.

[–] socialmedia@lemmy.world 7 points 6 days ago

Phind is better about linking sources. I've found that generated code sometimes points me in the right direction, but other times it leads me down a rabbit hole of obsolete syntax or other problems.

Ironically, if you already are familiar with the code then you can easily tell where the LLM went wrong and adapt their generated code.

But I don't use it much because its almost more trouble than its worth.

[–] cley_faye@lemmy.world 24 points 6 days ago* (last edited 6 days ago) (2 children)
  • issues with model training sources
  • business sending their whole codebase to third party (copilot etc.) instead of local models
  • time gain is not that substantial in most case, as the actual "writing code" part is not the part that takes most time, thinking and checking it is
  • "chatting" in natural language to describe something that have a precise spec is less efficient than just writing code for most tasks as long as you're half-competent. We've known that since customer/developer meetings have existed.
  • the dev have to actually be competent enough to review the changes/output. In a way, "peer reviewing" becomes mandatory; it's long, can be fastidious, and generated code really needs to be double checked at every corner (talking from experience here; even a generated one-liner can have issues)
  • some business thinking that LLM outputs are "good enough", firing/moving away people that can actually do said review, leading to more issues down the line
  • actual debugging of non-trivial problems ends up sending me in a lot of directions, getting a useful output is unreliable at best
  • making new things will sometimes confuse LLM, making them a time loss at best, and producing even worst code sometimes
  • using code chatbot to help with common, menial tasks is irrelevant, as these tasks have already been done and sort of "optimized out" in library and reusable code. At best you could pull some of this in your own codebase, making it worst to maintain in the long term

Those are the downside I can think of on the top of my head, for having used AI coding assistance (mostly local solutions for privacy reasons). There are upsides too:

  • sometimes, it does produce useful output in which I only have to edit a few parts to make it works
  • local autocomplete is sometimes almost as useful as the regular contextual autocomplete
  • the chatbot turning short code into longer "natural language" explanations can sometimes act as a rubber duck in aiding for debugging

Note the "sometimes". I don't have actual numbers because tracking that would be like, hell, but the times it does something actually impressive are rare enough that I still bother my coworker with it when it happens. For most of the downside, it's not even a matter of the tool becoming better, it's the usefulness to begin with that's uncertain. It does, however, come at a large cost (money, privacy in some cases, time, and apparently ecological too) that is not at all outweighed by the rare "gains".

load more comments (2 replies)
[–] corroded@lemmy.world 27 points 6 days ago (2 children)

When it comes to writing code, there is a huge difference between code that works and code that works *well." Lets say you're tasked with writing a function that takes an array of RGB values and converts them to grayscale. ChatGPT is probably going to give you two nested loops that iterate over the X and Y values, applying a grayscale transformation to each pixel. This will get the job done, but it's slow, inefficient, and generally not well-suited for production code. An experienced programmer is going to take into account possible edge cases (what if a color is out of the 0-255 bounds), apply SIMD functions and parallel algorithms, factor in memory management (do we need a new array or can we write back to the input array), etc.

ChatGPT is great for experienced programmers to get new ideas; I use it as a modern version of "rubber ducky" debugging. The problem is that corporations think that LLMs can replace experienced programmers, and that's just not true. Sure, ChatGPT can produce code that "works," but it will fail at edge cases and will generally be inefficient and slow.

Exactly. LLMs may replace interns and junior devs, they won't replace senior devs. And if we replace all of the interns and junior devs, who is going to become the next senior devs?

As a senior dev, a lot of my time is spent reviewing others' code, doing pair-programming, etc. Maybe in 5-10 years, I could replace a lot of what they do with an LLM, but then where would my replacement come from? That's not a great long-term direction, and it's part of how we ended up with COBOL devs making tons of money because financial institutions are too scared to port it to something more marketable.

When I use LLMs, it's like you said, to get hints as to what options I have. I know it's sampling from a bunch of existing codebases, so having the LLM go figure out what's similar can help. But if I ask the LLM to actually generate code, it's almost always complete garbage unless it's really basic structure or something (i.e. generate a basic web server using ), but even in those cases, I'd probably just copy/paste from the relevant project's examples in the docs.

That said, if I had to use an LLM to generate code for me, I'd draw the line at tests. I think unit tests should be hand-written so we at least know the behavior is correct given certain inputs. I see people talking about automating unit tests, and I think that's extremely dangerous and akin to "snapshot" tests, which I find almost entirely useless, outside of ensuring schemas for externally-facing APIs are consistent.

load more comments (1 replies)
[–] sugar_in_your_tea@sh.itjust.works 14 points 6 days ago* (last edited 6 days ago) (1 children)

Two reasons:

  1. my company doesn't allow it - my boss is worried about our IP getting leaked
  2. I find them more work than they're worth - I'm a senior dev, and it would take longer for me to write the prompt than just write the code

I just dont know anything about bash’s syntax

That probably won't be the last time you write Bash, so do you really want to go through AI every time you need to write a Bash script? Bash syntax is pretty simple, especially if you understand the basic concept that everything is a command (i.e. syntax is <command> [arguments...]; like if <condition> where <condition> can be [ <special syntax> ] or [[ <test syntax> ]]), which explains some of the weird corners of the syntax.

AI sucks for anything that needs to be maintained. If it's a one-off, sure, use AI. But if you're writing a script others on your team will use, it's worth taking the time to actually understand what it's doing (instead of just briefly reading through the output). You never know if it'll fail on another machine if it has a different set of dependencies or something.

What negative experience do you have with AI chatbots that made you hate them?

I just find dealing with them to take more time than just doing the work myself. I've done a lot of Bash in my career (>10 years), so I can generally get 90% of the way there by just brain-dumping what I want to do and maybe looking up 1-2 commands. As such, I think it's worth it for any dev to take the time to learn their tools properly so the next time will be that much faster. If you rely on AI too much, it'll become a crutch and you'll be functionally useless w/o it.

I did an interview with a candidate who asked if they could use AI, and we allowed it. They ended up making (and missing) the same mistake twice in the same interview because they didn't seem to actually understand what the AI output. I've messed around with code chatbots, and my experience is that I generally have to spend quite a bit of time to get what I want, and then I still need to modify and debug it. Why would I do that when I can spend the same amount of time and just write the code myself? I'd understand the code better if I did it myself, which would make debugging way easier.

Anyway, I just don't find it actually helpful. It can feel helpful because it gets you from 0 to a bunch of code really quickly, but that code will probably need quite a bit of modification anyway. I'd rather just DIY and not faff about with AI.

[–] ikidd@lemmy.world 1 points 5 days ago (1 children)

You boss should be more worried about license poisoning when you incorporate code that's been copied from copyleft projects and presented as "generated".

Perhaps, but our userbase is so small that we'd be very unlikely that someone would notice. We are essentially B2B with something like a few hundred active users. We do vet our dependencies religiously, but in all actuality, we could probably get away with pulling in some copyleft code.

[–] WolfLink@sh.itjust.works 36 points 1 week ago (3 children)
  • AI Code suggestions will guide you to making less secure code, not to mention often being lower quality in other ways.
  • AI code is designed to look like it fits, not be correct. Sometimes it is correct. Sometimes it’s close but has small errors. Sometimes it looks right but is significantly wrong. Personally I’ve never gotten ChatGPT to write code without significant errors for more than trivially small test cases.
  • You aren’t learning as much when you have ChatGPT do it for you, and what you do learn is “this is what chat gpt did and it worked last time” and not “this is what the problem is and last time this is the solution I came up with and this is why that worked”. In the second case you are far better equipped to tackle future problems, which won’t be exactly the same.

All that being said, I do think there is a place for chat GPT in simple queries like asking about syntax for a language you don’t know. But take every answer it gives you with a grain of salt. And if you can find documentation I’d trust that a lot more.

[–] cy_narrator@discuss.tchncs.de 5 points 6 days ago

Yes, I completely forget how to solve that problem 5 minutes after chatGPT writes its solution. So I whole heartedely believe AI is bad for learning

load more comments (2 replies)
[–] john89@lemmy.ca 10 points 6 days ago

Personally, I've found AI is wrong about 80% of the time for questions I ask it.

It's essentially just a search engine with cleverbot. If the problem you're dealing with is esoteric and therefore not easily searchable, AI won't fare any better.

I think AI would be a lot more useful if it gave a percentage indicating how confident it is in its answers, too. It's very useless to have it constantly give wrong information as though it is correct.

[–] OmegaLemmy@discuss.online 7 points 6 days ago

I use ai, but whenever I do I have to modify it, whether it's because it gives me errors, is slow, doesn't fit my current implementation or is going off the wrong foot.

[–] Numuruzero@lemmy.dbzer0.com 5 points 6 days ago (1 children)

I have a coworker who is essentially building a custom program in Sheets using AppScript, and has been using CGPT/Gemini the whole way.

While this person has a basic grasp of the fundamentals, there's a lot of missing information that gets filled in by the bots. Ultimately after enough fiddling, it will spit out usable code that works how it's supposed to, but honestly it ends up taking significantly longer to guide the bot into making just the right solution for a given problem. Not to mention the code is just a mess - even though it works there's no real consistency since it's built across prompts.

I'm confident that in this case and likely in plenty of other cases like it, the amount of time it takes to learn how to ask the bot the right questions in totality would be better spent just reading the documentation for whatever language is being used. At that point it might be worth it to spit out simple code that can be easily debugged.

Ultimately, it just feels like you're offloading complexity from one layer to the next, and in so doing quickly acquiring tech debt.

Exactly my experience as well. Using AI will take about the same amount of time as just doing it myself, but at least I'll understand the code at the end if I do it myself. Even if AI was a little faster to get working code, writing it yourself will pay off in debugging later.

And honestly, I enjoy writing code more than chatting with a bot. So if the time spent is going to be similar, I'm going to lean toward DIY every time.

[–] Soup@lemmy.cafe 3 points 6 days ago

Because despite how easy it is to dupe people into thinking your methods are altruistic- AI exists to save money by eradicating jobs.

AI is the enemy. No matter how you frame it.

[–] wewbull@feddit.uk 4 points 6 days ago (2 children)
load more comments (2 replies)
[–] obbeel@lemmy.eco.br 2 points 6 days ago* (last edited 6 days ago)

I have worked with somewhat large codebases before using LLMs. You can ask the LLM to point a specific problem and give it the context. I honestly don't see myself as capable without a LLM. And it is a good teacher. I learn much from using LLMs. No free advertisement for any of the suppliers here, but they are just useful.

You get access to information you can't find on any place of the Web. There is a large structural bad reaction to it, but it is useful.

(Edit) Also, I would like to add that people who said that questions won't be asked anymore seemingly never tried getting answers online in a discussion forum - people are viciously ill-tempered when answering.

With a LLM, you can just bother it endlessly and learn more about the world while you do it.

[–] Banked3-Visa9@fedia.io 2 points 6 days ago

People are not "mad" or "hate" about AI, more like "concerned."

load more comments
view more: next ›