logo elektroda
logo elektroda
X
logo elektroda

Vibe coding - does it make sense? A short practical test, will AI create a simple page?

p.kaczmarek2 339 6
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • Screenshot of an interactive AI-generated IoT devices browser with filtering, search, and pagination features for JSON data. .
    "Vibe coding" is a term used to describe programming based entirely on code generated by artificial intelligence. The programmer then just briefly describes his requirements in natural language and the LLM (language model) translates this into code. Proponents of this method praise it because it allows results to be obtained quickly and you can create even without understanding the code you are working on, while opponents point out that no major functional programme is likely to be created this way. In this topic, however, I will not repeat and analyse the arguments of the different sides of the conflict, but try this approach in practice, based on a simple but practical task.

    I've set myself the goal of creating a new browser Electrode database of IoT devices , all on a 'vibe coding' style basis of course, ie:
    - without writing code
    - no code editing
    - yes, without even looking at the code
    - and even without giving the AI any error codes (beginners don't like this).
    I wanted the developed site to be able to conveniently display, filter, browse and search data taken from an existing list of devices in JSON format.

    I used free ChatGPT from OpenAI , planning to fit in a daily query limit for the more powerful model. ChatGPT has the ability to use what is known as Kanwa, an interactive editor where the AI can generate and modify code in real time to create simple pages. The user sees the finished result and can preview the generated code, but does not have to manually change anything in it.

    To start, I developed a prompt, which is a query to the AI written in natural language. In the prompt, I included a link to a simple 'database' in JSON (over 750 entries), a sample of the data format and a brief description of what should be on the page:
    Quote:
    .
    use this link
    https://openbekeniot.github.io/webapp/devices.json
    Preview:
    {
    "version": 0.1,
    "devices": [
    {
    "vendor": "Generic",
    "bDetailed": "1",
    "name": "WiFi DIY Switch",
    "model": "ZN268131",
    "chip": "BK7231T",
    "board": "WB2S",
    "keywords": [
    "switch",
    "relay",
    "AP8506"
    ],
    "pins": {
    "6": "Rel;1",
    "7": "WifiLED_n;1",
    "10": "Btn;1",
    "26": "TglChanOnTgl;1"
    },
    "image": "https://obrazki.elektroda.pl/5120493600_1650616045.jpg",
    "wiki": "https://www.elektroda.com/rtvforum/topic3895572.html#20033093"
    },
    {
    "vendor": "Zemismart",
    "bDetailed": "0",
    "name": "Matter LED Light Bulb RGBCW E27 Dimmable 7W",
    "model": "ZML2-7W",
    "chip": "BL2028N",
    "board": "UAM026",
    "flags": "1024",
    "keywords": [
    "lamp",
    "UHOME",
    "UASCENT",
    "BP2516F",
    "SL421A ",
    "SYWB07",
    "RGBCCT V1.3"
    ],
    "pins": {
    "6": "PWM;5",
    "7": "PWM;4",
    "8": "PWM;1",
    "24": "PWM;2",
    "26": "PWM;3"
    },
    "command": "",
    "image": "https://obrazki.elektroda.pl/9164503800_1741641409.jpg",
    "wiki": "https://www.elektroda.com/rtvforum/topic4111089.html"
    },
    and provide a nice looking, flexible, fully featured gui html browser/searcher/filter/stats page for the linked database, use html and js, maybe bootstrap, with page limits, multichoice, show counts for each type, filter by chip, module, etc

    First result - and it's already pretty good, the browser works, but there are shortcomings:
    Screenshot of a web page showing an AI-generated IoT device database browser with filters, buttons, and a data table. .
    I started to score the model one by one what I wanted it to improve. After each step I verified the result. Here is a summary (my subsequent messages to the AI):
    - number of occurrences in the module/circuit lists
    Quote:
    .
    next to each filter like chip or board or vendor, show how many occurencies there are in total, and sort entries by that
    .
    - filter cleaning buttons
    Quote:
    .
    under each list, add a "Clear filter" button that clears this particular filter. Also separately add a single "Clear all filters" button.
    .
    - pagination fix (because when there were 50 pages, there were 50 buttons with page numbers)
    Quote:

    cool but those page numbers at the bottom of the page are strange if there are many pages, maybe you should just show numbers for first and last page, and also for current , previous and next pages, of course without repeats, and sorted?

    - greater selection of quantities per page
    Quote:
    .
    also allow me to select 50 or 100 or 250 or 500 or 1000 per page...
    .
    - finally, top of the keywords
    Quote:
    .
    also, under search keywords, give me like, idk, 10 clickable top keywords with their number (occurencies) in ( ) , and when clicked, set keyword field to given keyword
    .
    At this stage a problem arose - the code stopped compiling. Fortunately there is an option in Kanwa to automatically have the model fix it....
    Screenshot of an AI-generated IoT device browser showing a device list, filters, and a search bar.
    I can't believe it, he seriously did it! He fixed the error.
    Screenshot of a web page for browsing, filtering, and searching IoT devices from a JSON database.
    So I continued - on in one hut:
    Quote:
    .
    To each entry, add Copy button that copies raw original device JSON entry to clipboard
    .
    Here, however, something strange happened. I had to go as far as looking into the code - Kanwa allows you to preview the changes:
    Screenshot of an IoT device browser interface generated by AI in ChatGPT Canvas, showing filter fields, a device list, and pagination. .
    I went back and corrected the query:
    Quote:
    .
    To each entry, add Copy button that copies raw original device JSON entry to clipboard, do not remove existing features
    .
    I was greeted with an error:
    Screenshot of a web app for browsing an IoT device database with filtering and pagination, generated by AI. .
    However, this time again the AI was able to fix it:
    Screenshot of a website showing an IoT devices browser generated by AI in the vibe coding style. Device list, filtering options, and pagination controls are visible. .
    It even generated an explanation of what was wrong:
    Quote:
    .
    The syntax error was caused by a duplicate and malformed <button> tag inside the device rendering block. It's now fixed - each device entry includes a single working "Copy JSON" button. Let me know if you'd like the copy action to show a tooltip or toast instead of an alert.
    .
    The finished effect can be seen here:
    https://openbekeniot.github.io/webapp/devicesList_test1.html
    I think it came out pretty well.

    In summary , the results in my opinion are very good, especially for the tool used - I deliberately chose the most popular and available model. I did not want to present paid models, as even a small fee could already sift out some users. I also did not want to use tools that require installation (IDE add-ons or entire AI-based environments). Perhaps I will devote a separate topic to them - for example, we will then test GitHub Copilot.
    In this topic I focused on the simplest option, but nevertheless got satisfactory results. Towards the end of the site's development, problems with the scalability of such an approach started to emerge - AI would at times remove sections of code, but a properly worded prompt was able to solve most problems. Also, Kanwa itself automatically offered the option to fix the error.
    Does this mean that AI will also generate us large projects, such as our own Elektroda-style forum engine?
    Of course not. This method only works for smaller projects and very quickly you can run into an impassable wall without any programming knowledge. Nevertheless, I think that even a simple website like the one shown today would have been a good job for a beginner freelancer a few years ago, but today no one is likely to make much money from it.
    Such simple pages can be generated by oneself with a minimum of knowledge, and with increasing knowledge the possibilities grow much faster than they used to....
    For this reason I personally foresee (not to write "see") in the future a great decrease in demand for programmers (especially juniors) combined with a huge amount of low quality code flooding the Internet.
    This was just my opinion though, what do you guys think? Have you already suggested anything useful for yourselves in Kanwa, and if so, what?

    PS: This presentation assumed that all code is in the AI context window. You could improve this way and prompt individual modules separately, e.g. one backend file with the database separately (give the database structure), frontend fragments separately, etc. Then the solution scales much better... .

    Cool? Ranking DIY
    Helpful post? Buy me a coffee.
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 11842 posts with rating 9936, helped 566 times. Been with us since 2014 year.
  • ADVERTISEMENT
  • #2 21581816
    lemgo
    Level 15  
    I've been playing around. Inspired by @khoam's idea from this thread: https://www.elektroda.pl/rtvforum/topic4119086.html and some video by Chrobot, something like this was created: https://github.com/jbanaszczyk/BotForum just as a vibe coding check.
    Toolset: python, pycharm, Jetbrains Coding Assistant, Claude Sonet 3.5 And as the tokens wore off, Copilot. + free time on L4 :) .
    I set myself up as a junior, with all the coding thrown into AI.
    My reflection: from the first shot - he did pretty well. Code of acceptable quality, mostly worked correctly, AI wrote it significantly faster than I would have, even not as a junior. Then some refactoring - configuration from .env to yaml - well here he impressed me, he got it right straight away. And then it was time to "develop the project" - adding more features. And this is where he failed. Roughly speaking - the program reads the user input, or there is some free text. or some slash commands, and I started adding new commands, and he parsed them to wherever. After a joyful 'vibe coding', I took a full day to upload this code to github without shame.

    My conclusions:
    * prompt creation techniques are worth learning. If only to read the "12 prompt techniques" from medium.com
    * copilot sucks, sonnet cacy, but ... tokens from copilot are cheap, from sonet 3.5 expensive.
    * If you can insert the entire(!) functional requirements right into the prompt - that can work out pretty well.
    * AI has the memory of a goldfish. After several prompts, it needs to be reminded: "what are we actually writing, what are the functional requirements, what are the non-functional expectations". For example, every circa ten queries he would forget that "no comments in the code, we code in English and remember SOLID".
    * Refactor - that and static analysis tools could do, when ai wasn't around yet, so for finding questionable bits of code and fixing them - it does a pretty good job.
    * Development - forget it, chaff will come out. It will even work, but it's not suitable for production for now, because it will be an embarrassment.

    That's probably why there's a hype for vibe coding - the first bits of code are coming out of it of really sensible quality, they even work and are created much faster than I would code. So if they work, they're cool, you can make a "but it's good!" video and collect likes. The next ones just work.
  • ADVERTISEMENT
  • #3 21581829
    khoam
    Level 42  
    lemgo wrote:
    AI has the memory of a goldfish. After several prompts it needs to be reminded: "what are we actually writing, what are the functional requirements, what are the non-functional expectations".
    .
    What annoys me the most, on the other hand, is that with the next iteration of code building, the AI starts commenting on its own (and usually less significant) fixes to that code as if they came from me. It doesn't even make new corrections to those fixes, but with the persistence of a maniac presents 'feedback' that I need as much as a pig's parachute. All this in one session. This is not 'classic' vibe coding, but rather an exercise with a student ;) .
  • #4 21581863
    bsw
    Level 21  
    For simple apps ok - even just to see how to do it because sometimes I have no idea how to start - and then you can develop it yourself.
    It's great for programming microcontrollers in the classic way (avrgcc) - normally you have to study the catalogues - timers, registers, interrupts etc. - but here you have code in a snap. - Normally, you would have to study the catalogue notes - timers, registers, interrupts, etc. - but here you have the code in a snap.
    As for unnecessary comments - you have to ask for refactoring and their removal :-) .
    But fact - sometimes one gets fixated on something and amba - corrects the wrong thing....
    And how do I "say" what I mean here?
    Sometimes I scold him but he doesn't get offended :-)
  • ADVERTISEMENT
  • #5 21581942
    khoam
    Level 42  
    bsw wrote:
    Sometimes I call him out but he doesn't get offended
    .
    In these situations I write something like " I understand, the task was too difficult " or " Ok, this problem you are unable to solve ". Strangely enough, this often helps i.e. some 'cogs' jump in the AI and it tries to analyse the solution to the task from the beginning :D .
  • ADVERTISEMENT
  • #7 21582131
    p.kaczmarek2
    Moderator Smart Home
    Nice idea @divadiow , maybe we could introduce a separate json file with keys (keywords) and their links (to descriptions, for example, TuyaMCU would link to https://www.elektroda.com/rtvforum/topic4038151.html ) , and then fetch this JSON as well and use it to insert links for keywords, boards, chips?

    I think being able to iterate and improve so quickly opens a lot of possibilities, I wouldn't have time to normally play around that page, but AI speeds up things a lot.
    Helpful post? Buy me a coffee.
ADVERTISEMENT