5 ms·
I have played around wit AI code from time to time. I do not code routinely but I have pet personal projects that allow me to do some code and this is where I e
by kshacker 2y ago
I have played around wit AI code from time to time. I do not code routinely but I have pet personal projects that allow me to do some code and this is where I experimented.
Rule number 1 and the only rule: You need to be a subject matter expert. Be it program logic or be it programming language. AI is only a helper, it will go wrong, frequently, and if you do not understand the reason for the code and the programming language, you will take so much more time than if you did not even use the AI.
Without naming the IDE, but one of the top 3 I guess, I asked it to simplify some code. I had repeated code 8 times. 6 of them were identical, the last 2 had a variation. The AI just did not catch it, and refactored all 8 blocks to use the logic of first block. How can you even do that? The code is similar but different, it looks the same but there are extra lines of code in the last 2 blocks !!
And it took me a while to realize this. I never ingest AI code directly so at first I was marveling at a job well done, and as I read and compared, the horror !! And that was not the first time it happened, but once again I got tricked by the soft spoken well mannered AI to believe that it did a fantastic job when it did not.
Edit: It is just an assistant. You give it a task, it will make a mistake, you tell it to fix the mistake, it will fix the mistake. It still saves you time. Next day, it will make the same mistake - and hopefully that gets reduced as the versions evolve.
- nkrisc 2y agoI like to think of AI as a force (or skill) multiplier. If you’re low skill, it doesn’t do much. The higher your skill, the more useful it is.
- chii 2y agoThat hasn't been my experience, nor that of others using the AI. It's a force constant, rather than a multiplier. If you're low skilled, asking it to do a low skilled task, it works fine. If you're high skilled, and asked it to do the low skilled task, you saved a tiny bit of time (less than that of the low skilled person). But it cannot do a high skilled task (at least, not right now). It can pretend, which can lead the low skilled person astray (but not the high skilled person). Therefore, all AI does is raise the floor of what is achievable by the laymen, rather than multiply the productivity of a high skilled programmer.
- derekp7 2y agoYou could also be a mixed skilled developer. Good at regular code, architecture, and algorithms but not as familiar with a given UI framework. Having the LLM generate the html and css for a given layout description saves a lot of time looking through the docs.
- dingnuts 2y agoLLMs will be best at HTML and CSS among programming languages because even if it's subtly wrong the browser will still render something. Still, I'm not sure I need to spend $250/yr to occasionally generate some HTML that I could use a template to generate
- skydhash 2y agoDoes it really? The thing is that there’s a domain model beneath each kind of library and if they solve the same problem, you will find that they will generally follows the same pattern. Let’s take the web. React, Svelte, Angular, Alpine.js, all have the same problems they’re solving. Binding some kind of state to a template, handling form interactions, decompose the page into “components”,… once you got the gist of that, it’s pretty easy to learn. And if you care about your code being correct, you still have to learn the framework to avoid pitfalls. Same things with 3D engines, audio frameworks, physic engines, math packages,…
- derekp7 2y agoUsing myself as an example -- I'm a long time C programmer (occasionally in a professional setting, mostly personal or as a side-item on my primary professional duties). I've picked up other languages through the years, had to deliver a web based application a few years ago so I did a deep-dive into html5, css3, and javascript. Now javascript has evolved since then, and I lost a bit of what I learned. So now I want to do a new web application -- If I fall back on my C roots, my Javascript looks a lot like C. Example: adding an item to an array. The C style in Javascript would be to track the length of the array in another variable "len", and do something like myarray[len++] = new_value; I can feed this into an LLM, or even say "Give me the syntax to add a value to an array", and it gives me "myArray.push(newValue)", which reminds me that "Oh yeah, I'm dealing with a functional/object oriented language, I can do stuff like this". And it reminds me that camelCase is preferred in Javascript. (of course, this isn't the real situation I've run into, just a simplified example -- but I really don't have all the method names memorized for each data type. So in that manner it is useful to get more concise (and proper) code.
- NitpickLawyer 2y ago> Rule number 1 and the only rule: You need to be a subject matter expert. Strong disagree. I've been coding for 25+years but never on the front-end side. I couldn't write JS w/ pen & paper with a gun against my head. But I know what to ask and how to make sure a react component does what I want it to do, with these tools.
- nkrisc 2y ago> head. But I know what to ask and how to make sure a react component does what I want it to do That is the subject matter expertise that many lack.
- latexr 2y agoOr, in other words, you are a subject matter expert and are agreeing with the person you’re responding to. Quote the full argument (emphasis added): > Rule number 1 and the only rule: You need to be a subject matter expert. Be it program logic or be it programming language. You are a subject matter in program logic, just not programming language. You are supporting their point, not disagreeing.
- NitpickLawyer 2y agoI see where you're coming from. But later in the message they go > and if you do not understand the reason for the code and the programming language, you will take so much more time than if you did not even use the AI. I guess that's the part I disagree on. The programming language is largely irrelevant now is what I'm seeing. And especially the "time to first result" is orders of magnitude smaller when using AI assistants than having to rtfm/google/so every little problem I encounter in an unfamiliar language. And I am in no way stating that my code will match an expert in that field, of course.
- arijo 2y agoHow many thousands of lines does your AI-generated frontend code have? Do you have to maintain the code?
- ElectricalUnion 2y agoFrom my experience using ai, if you don't write a really precise description of your initial requirements in the initial prompt, and it it doesn't one-shot the answer, I don't bother asking it to fix the mistake. Unless you're using a LLM with really long context, it's prone that some context loss will happen soner or later - when that happens, pointing errors that dropped out of the context will just result in repeated or garbage output.
- theshrike79 2y agoThis is why platforms(?) like Claude Code, Cursor and Windsurf are essential. Claude Code forces you to create a CLAUDE.md to direct how it works, with Cursor you can (and should) write Cursor Rules. The difference with a good spec + AI vs just vibe coding from scratch is like night and day.
- larusso 2y agoI don‘t use these tools daily because I have a hard time to commit to these workflows. But do I need to do this setup once, once per project or every time for one off things I might code?
- theshrike79 2y agoYou really don't need these for tiny one-off scripts, but they're essential for larger projects where the whole application can't fit into the LLM context at once. Basically they're just a markdown files where you write what the project is about, where everything is located and things like that. Pretty much something you'd need to have for another human to bring them up to speed. An example snippet from the project I just happened to have open: ## Code Structure - All import processors go under the `cmd/` directory - The internal/ directory contains common utility functions, use it when possible. Add to it when necessary. - Each processor has its own subdirectory and Go package ## Implementation Requirements - Maintain consistent Go style and idiomatic patterns - Follow the existing architectural patterns - Each data source processor should be implemented as a separate command This way the LLM (Cursor in this project) knows to, for example, check the internal/ directory for common utils. And if it finds duplication, it'll automatically generate any common functions in there. It's a way to add guidelines/rails for projects, if you don't add anything the LLM will just pick whatever. It may even change style depending on what's being implemented. In this project the Goodreads processor was 100% different from the Steam processor. A human would've seen the similarities and followed the same style, but the LLM can't do that without help.
- theshrike79 2y agoAI is excellent for tasks you know how to do, but can't be arsed to spend the time. Example: I wanted a tool that notifies me of replies or upvotes to my recent Hacker News comments. Grok3 did it in 133 seconds with Think mode enabled. Total time including me giving it the example HTML as attachment and writing the specs + pasting the response to a file and running it? About 5 minutes. I know perfectly well how to do it myself, but do I want to spend the hour or so to write all the boilerplate for managing state and grabbing HTML and figuring out the correct html elements to poll? Fuck no.
- mirsadm 2y agoYes I find this to be it's best use case. Unfortunately for anything I actually need help with the results are often terrible.