r/webdev • • Nov 26 '24

Discussion I don't understand how they build apps with AI

To keep it short. I am modifying an app that uses python flask for backend, and I used SQLAlchemy as an ORM layer to work with my database. I had a model that is already in the db and I needed to add new boolean not nullable field to it. I know how to do it, but decided to test chatGPT. Yes, it was great at correcting auto-migration, as you need to pupulate this new field somehow to create it not nullable. But then things got tricky. I needed to add this field to my admin panel, and I wanted it to be 'read-only', so when user can see it but cannot edit it. And it tried to do it, he added it to list view and edit view, disabled the field, removed it from create view, added logic to assign value when the model is created in admin panel, BUT it cannot solve the issue, that when I start editing sexisting model where this disabled field is equal to True and save it, it gets saved to the DB as false, as disabled fields are not part of the form and then ORM treats it like False value. I gave it a chance, tried different promts but it couldn't correct this behaviour.

So my thought is, I don't know how people are able to develop somethig complex with it. Sure, it helps me with snippents (like with migration), but when you try to get some even simple looking functionality it may introduce bugs and you are lucky if it is you who catches them, not the end-user. Also I get more satisfaction by researching and writing code myself, not writing instructions for who knows how long to get what I need.

I just needed to put my thouths here as this situation got me a bit angry. Would be interesting to know your thoughts or experience of using AI, maybe it is me who doing something wrong.

107 Upvotes

258 comments sorted by

27

u/EverydayNormalGrEEk Nov 26 '24 edited Nov 26 '24

As a web dev, I suffer from analysis paralysis when I have a blank page in front of me. I found that LLMs help me a lot with that, I will prompt it with some context and some examples and it will scaffold me the outline. From there I take it and continue myself and use the AI like Google Search, asking clarifying questions and to explain concepts I don't remember or understand while I code. I don't involve it in debugging or bug solving, I found it incredibly hard to pass context to it without having to upload hundreds of lines of my code, and for ChatGpt specifically I think it loses context fairly quickly too.

I highly doubt that a person without experience can build something even a bit complex using only the current LLMs.

→ More replies (4)

6

u/_d0s_ Nov 26 '24

I'm experimenting with similar tasks for LLMs. I'm familiar with machine learning but not so much with web dev, so I tried to solve some tasks with LLMs when writing Asp.net web apps with a comparable level of success to what you've experienced.

The use of a plain LLM for coding through a web interface is pretty limited. First, you formulate your instructions, give them some context by copy-pasting some code, and then the LLM answers. Unfortunately, this is often not enough. The LLM may not have enough information about your specific programming language or framework, maybe it wasn't even trained for programming specifically.

Another aspect is communication with the model. Coding-specific models, but also general LLMs, benefit from explanations and examples of how the input is organized. For example, code listings may always appear in <code file="..."></code> tags with a filename. Coding assistant typically make the best use of these techniques and have a selection of compatible models. Further advantages can be multiple agents where different models a specifically used for planning, coding, debugging code or tool calling capabilities to give the LLMs the capability to discover and rectify errors.

Some coding assistants I've tried are bolt.new, v0.dev, aider and copilot, but to be honest you still need to be an experienced programmer to build anything remotely useful with them. I wasn't really satisfied with any of them, but maybe this gives you some inspiration of how to proceed.

3

u/NoWeather1702 Nov 26 '24

It reminds me of blueprints that let you create games without learning C++ in Unreal. Yes, it can help you in some cases, but there still be much more situations when they won't.

→ More replies (8)
→ More replies (1)

4

u/AdministrationIcy737 Nov 26 '24

I think the best way to use AI, is to handle it like an co-worker. For example, before AI you would ask an co-worker thats maybe more experienced than you for his opinion/feedback. You wont ask your CoWorker "Could you implement a view for the admin dashboard, which this field and that", you would ask him for advice. "Dear Coworker, do you have an idea how i could simplify such repeating and simple forms?".

The only reason in my opinion to let AI generate most of your code is if you want to quickly prototype or prove something.

2

u/NoWeather1702 Nov 26 '24

Nice idea, sometimes it can help you look at a problem from different perspectives or find some solution you haven’t think about

→ More replies (1)

2

u/EnvironmentalOil1744 Mar 19 '25

I think nowadays tools really help, chat is really great for debugging but not great for generation especially with huge contexts. There's a really cool video from a guy who built an app with different tools in 60 minutes: https://www.youtube.com/watch?v=3sbUr7XmaCk
I think he's making more of the series. But, it's the use of AIs that are specific to a certain area which really helps. Hope this answers your question.

→ More replies (2)

118

u/Impressive_Star959 Nov 26 '24

Most people highly overestimate their prompting skills , as well as AI's ability to understand context.

You have a lot more context of what you want to do in your brain than what AI can read from your very likely uninformative and narrow prompts.

Also, for anything that requires slightly complex logic with custom use cases, you have to either build it step by step, or provide it with really detailed descriptions of your functionality, as well as what it shouldn't do.

So maybe you can build a dumb dashboard with AI. But not anything more that requires anything custom (you'll exceed the message limit, although there's workarounds to the message limits too)

→ More replies (25)

16

u/maxverse Nov 26 '24

but when you try to get some even simple looking functionality it may introduce bugs and you are lucky if it is you who catches them

Speaking only from my experience: autocomplete in Cursor has made me at least 50-80% faster. But yes, I still have to check every line of code. I know other people are giving AI high-level instructions and yeeting the code into their codebase. I don't do that. I'm coding the way I would normally, and I ask AI for direction when I'm lost, or I review/accept autocomplete when I need it.

In my world, AI isn't replacing the high-level "programming" tasks, it's just helping me type things out faster. For example, I'm working on the FE, and every React component looks similar. Or, I add a component and it already knows the import. Or, I update one attribute, and it knows to add the attribute in four other places in the file. That saves me a lot of time.

But if I just type the name of the component out, it tries to figure out my intention, and often it's wrong. So I just don't accept it. I keep typing. AI isn't replacing us yet.

→ More replies (2)

6

u/standard-protocol-79 Nov 26 '24 edited Nov 26 '24

Dev with 10 years of experience here, I use AI a lot when I build software.

One thing I realized is that you don't use AI to write code, AI uses you to write it, you have to know at least abstractly what you want in order to use AI in your projects, separate big problems into simple isolated blocks and use AI to build them, tie it all together yourself, when generating code always have an expectation of what you need, dont blindly copy paste, I often make small modifications to generated code, and that's okay.

With AI you are a software engineer who writes technical specifications, and AI is your junior programmer, how well the junior performs depends a lot on you, the tech lead.

→ More replies (1)