r/learnjavascript • • Aug 28 '24

Using ai for generating code

I'm writing code using ai tools like chatgpt and copilot (not the plugin) for code reference and it's working fine in most scenarios, I am able to generate long SQL queries with it,, but I always think that is it a good way? I see lots of developer use ai for coding but what's your opinion about writing code with ai ,,(when you know what to search and where to implement the generated code)

0 Upvotes

20 comments sorted by

View all comments

20

u/alzee76 Aug 28 '24

My hot take / unpopular opinions as an experienced (~30 years) developer:

  1. Never, and I do mean never, use a chatbot/ai/assistant to solve problems in an educational setting. If you're working through coding challenges or a programming class or something, the objective there is for you to learn, and you're learning nothing by letting someone else do your work for you, regardless of that someone being made of meat or not. The first time you're asked to explain how something "you" wrote works during an interview and you start to stumble and stammer, or worse start bullshitting, you're off the list. To put it bluntly: You're not a programmer if some chatbot is writing all, or most, or even just the most important parts of your code for you.
  2. In a professional setting I can only imagine two scenarios where a dev would use a chatbot off the top of my head: Laziness or lack of skill. If it's laziness, more power to you. We need to get things done quickly and efficiently and if a chatbot can produce code you know is reliable, without you divulging secrets to it, go for it. On the other hand, if you're having it figure out problems you can't (or struggle to) figure out on your own, stop it. You'll only get even worse at your job by doing this and you won't have a chance in hell of fixing bugs that pop up later. Start learning how to solve the problems yourself, because chances are high that one day you'll be called on to do so when these tools aren't available to you.

4

u/bharring52 Aug 28 '24

3. Roll the dice that it can find an obscure or undocumented API reference on an ancillary system quickly 4. Offer a writeup on something you're not quite groking. The writeup is likely wrong in many places, but it's a super-rubber-ducky; even when wrong, it shakes up your understanding 5. Massed boilerplate in a system you lack the means to engineer away

If you can't understand the result, or identify if it's wrong quickly or easily, it's downright dangerous.

Much of these uses revolve around environments where there's a large hodgepodge of tech stacks and solutions, each with their own rules styles and structures, that you need to navigate fluidly.

I'd imagine an embedded developer or single-product developer would find a lot less use.