frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

How to not use AI to code for you

https://mandaputtra.id/posts/how-to-not-using-ai-to-code/
21•mandaputtra•20h ago

Comments

mandaputtra•20h ago
I sat next to a young aspiring software engineer, I just met him. And it's annoy me, to look at how he works. Prompting again - again and again till something is fixed, it's not how you do things. I think, if the AI could not answer it in the first place, you should fix it your self ~ or give it more context.

I'm sorry, It's just ~ I don't think that's how I want to use AI to code.

So I tell him, he needs to level up or else ~ the civilization will collapse, lol.

Again this is just opinion

theGeatZhopa•19h ago
I think what that young guy actually did was practice for the next job application as "vibe programmer / Claude". Joke.

I think he did "vibe" coding, but (may be) on a piece of code that doesn't throw errors. Code assistance then doesn't know/understand what went wrong - more context would help. BUT!

I have had an logical problem once that I couldn't resolve with my quarter-pounder only. So I used cgpt and asked to give it to me. And, you guessed, it didn't work out.

I did not really expect it to work out, but at least give me the logical structure as the worst case. So I asked and got garbage. So I asked again, again, again - more context than the context I gave was out of reach, as I needed the logical structure firstly to be able to comprehend it myself and to add further context.

Then, at some point, I got something delivered that looked promising from the perspective of logical structure. So I took this and formulated a new prompt - and. Yes! You guessed it. It didn't work out in code.

So, I did a quick truth table of expectations, formulated the prompt with the given logical structure and truth table and told assistant to check on the given code... AAA AND! You guessed it. I sent 10 times the same prompt "here truth table, here code, ....".

I noticed, the code changed more or less each time, with introduction of newish loops and methods and and and..

And somewhen then, it worked flawless out of nothing.

Sometimes it makes sense just to write "it doesn't work out":

- in case one doesn't know how to formulate the actual problem, because it's out of scope. It's not the same as not being able to program, but it may be just to difficult to grasp the logic/algorithms with own brain (even own/custom one)

- to get alternative suggestions which may even be better than earlier suggested ones.

So, as long I don't know why this young guy did what he did, as long I can't judge what he did. May be he is like me - is able to code, but has big problems to sustain that knowledge and skill, because of Claude!!!!!

gexla•19h ago
Right, I'll have one main chat open for high level planning and guidance. It can knock out big chunks for me. But as soon as I take it on a side quest to fix something that doesn't work, it often starts going off the rails. Better to open a separate context for that fix. And often there's a good reason that it created the issue, like it patterned itself into a wall and a dead-end. At that point you should either start back from where it started drifting or take over (but still starting at the pre-drift point.)
freehorse•18h ago
I think that a big issue here is the chat UX implementations in most IDEs. In contrast, in zed, in the text-based chat threads, one can directly edit an LLM's answer, making actually fixing bugs oneself much less complicated in terms of UX. In a classical chat interface, where you cannot edit an LLM's answer, you have to either continue the thread, start a new thread with a different prompt asking it to avoid the issue, or fix the code and provide it as context again. If you do it in a new chat, you lose the context of the previous chat (you need to provided it again). If you continue the chat with the added code, you have dirty context (which makes llms perform worse). Moreover, they most probably require you to get in and out of the chat to do things, which is not ideal UX compared to just prompting again. The fact that I can just change the generated code in the chat itself, run it in the repl, and continue from there is the best UX imo for when such problems occur. I would like if more IDEs actually accepted something similar.

Of course, my workflow is very repl based and I assume different experiences exist for other contexts. Moreover, agent workflows have probably different pros and cons. It is great timewise that they can test code and fix bugs themselves, but essentially that's a bit like automating this prompt-reprompt loop. It saves time compared to that (at the cost of a lot more $$$ in tokens overall), but if the agent fails to solve the issues, yet again we are at square zero. What helps a lot is that work is done inside the codebase at least, which is supposed to be a good thing, but personally I have not understood how to use agents efficiently tbh.

Hackbraten•20h ago
> Its just trivial problem like centering things in CSS

Maybe it’s not trivial for them?

How do you know they weren’t trying to learn?

mewpmewp2•19h ago
It may be trivial now with flex... But back then, let me tell you...
alternatetwo•19h ago
Back then we had tables!
Klaster_1•19h ago
You still have to remember which flex property to use, unless it's something trivial like `margin: auto`. I always have to find the right combination in DevTools first before commuting to changing the stylesheet, even after extensively working with flex since its inception.
juliendorra•19h ago
I have been using CSS since, well, they were invented back in 1995 but not continuously (when I need them). And I can never remember how to properly center things or how to do a lot of supposedly simple things. The specs has a lot of confusing naming (the naming have some logic, but nevertheless a confusing) and of course a lot of interrelated effects.

We used to have css editors that helped.

But I’m glad LLMs can now write CSS for me, and it nearly works perfect every time (I sometimes have to dig and fix things, and to push it to use the latest specs not old obsolete tricks)

mandaputtra•16h ago
I know because I had a chat with him. Why not experimenting a bit instead of saying on and on again to LLM that the things are not center yet?

I know centering things in CSS can be a lot harder than it seems.

Kiro•19h ago
> Its just trivial problem like centering things in CSS

Out of all examples you chose the hardest problem in computer science.

jona777than•19h ago
I had this same thought immediately and had a good chuckle.

Ironically, my colleagues and I used “but can it center a div?” just today. It has been our running joke to measure usefulness of LLMs as they advance.

Brajeshwar•19h ago
It was a fateful day in one of the Indian Monsoon in the late 2000s. I rode the ever-reliable tuk-tuk in the city of Mumbai to reach a coveted Indian outsourcing company that has taken on a multi-year, multi-billion-dollar contract. They had inherited a project and discovered that one of the programmers was me, as indicated by comments inside the code, and they had reached out.

Fortunately for me, they are stuck in the specific styling of an enterprise app that has been in operation for a quarter and is now starting to reflect in their P&L account.

After all the security check-ins through the gates, and after being seated and coffee-ed, I walked to a desk and spent as much time just staring at the codes. I pretended to be in some deep trance code-thinking thing. Then, as the clock ticked by, I did the hand-clap thing that Stanley did in Swordfish. I wrote a few lines of code - a utility CSS class to center align a block element, preferably a DIV.

I walked out with people clamoring for my autograph and selfies with their Nokia N95. Later that evening, I sent an invoice that was ten times the monthly salary of the project lead working on that project.

/s

mandaputtra•15h ago
It is, but I bet you will open the DevTools and checking why it is not working like intended. Instead of asking LLM "it's not center yet" or "now the other things is center but not the one I mean"
sebstefan•19h ago
This is a bit circlekerky and the english is very broken

Bit ironic considering running it through a LLM would've fixed the 2nd part

Lukas_Skywalker•19h ago
The article is still understandable, and someone took the time to write in their second (or third?) language. This was probably much more work for them than for us needing to reread some sentences because they mix up the order of some words.
sebstefan•19h ago
My first language is french so I'm not convinced

To me it's mind boggling to not proofread a blog post. Posting it on HN is crazy too

I don't mind for online comments and the like but a blog post is crazy

freehorse•18h ago
I am not doubting your comment, but personally it did not cross my mind that something is wrong with the syntax or grammar before I read your comment. It is informal, brief and not getting that deep, but it was pretty much understandable for me, and it sets up an interesting point to discuss imo. It could have been more polished but it looks readable enough, and I do not think that a post like this should be flagged (not implying you specifically flagged it or not, either, but it is flagged and I assume some of the reasons for it may be this).

Moreover,

> My first language is french

well french is very close to english in many ways, much closer than many other languages, so I find it a bit unfair to judge other ESL authors by the standards of a french native speaker's experience with english.

sebstefan•15h ago
Hey. We're not incapable of effort

If you don't speak the language, but make an article like this (and are actively sharing it), the bar is most definitely above "you gotta get it proofread".

I'm quite sure you're going to get a pretty uniform response from non-native speakers across the globe if you are saying that we are poor little creatures and the world should lower this bar

freehorse•14h ago
> I'm quite sure you're going to get a pretty uniform response from non-native speakers across the globe if you are saying that we are poor little creatures and the world should lower this bar

I am non-native speaker, so n=1 here. Moreover, I said that I do not consider OP to be such a low bar. It may be informally written, but it did not cross my mind it would have been not understandable to some. I guess opinions may vary on this. Going back reading it I see quite a few obvious grammatical errors, surely they should have spent some effort fixing them before posting it here (nowadays it should be trivially easy to do) but again it is not to the point of not being understandable or hard to read, imo.

mandaputtra•16h ago
Sorry my english is broken because its not my first languange and I'm trying to improve it.

Thanks for the feedback

worldsayshi•19h ago
It seems to mostly be about risk management - knowing how to contain risk? What is the cost of this piece of code failing to do what it is supposed to? Is it easy to replace?

If the answer is low and yes, then speed matters more than perfection and you don't have to always know exactly how it works. We already accept some risk while outsourcing parts of our problems when using dependencies. The risk management puzzle is different but still fundamentally the same?

If you don't know how the thing work in principle though, it's not going to be easy to replace.

freehorse•19h ago
I have caught my self a few times do this repeated prompting "fix the bugs" out of mere laziness to go down on the code and actually read it. Actually fixing the bugs oneself requires a certain kind of effort and focus that you are not into while "vibe coding", and this increases the less familiar you are with the language/code. If I do this on anything serious, as in anything I will need to maintain or reuse, I end up losing more time than gaining. If it is something I am gonna throw away anyway, I do not care as much. I don't know what the context in this example is.

I would say that the main reason to not do this for any actual code you work on is that you will need to go into the code and fix bugs anyway when the LLM will, at some point inevitably, start consistently failing certain tasks. All the time you (think you had) saved by avoiding actually delving into the code will come back as technical debt then.

ilaksh•19h ago
My interpretation of this is he feels that AI-assisted programming is okay if you still participate in the programming sometimes, but if you only prompt then you're not really a programmer. Or something.

He does say that you should provide more context rather than just repeating yourself.

There is a distinction as far as having some engineering skills and knowledge to give the AI hints, but it might be more of a symbolic one than people realize. And as AI continues to improve, that will be more so.

But it does bring up a valid point that if we don't do any problem solving or thinking for ourselves, we will be totally helpless.

I think this is something that all students should be taught pro-actively. Actually there should have already been a national standard reinforcing to kids what happens to your brain if you don't use it and how important it is to actually read, write and solve problems sometimes rather than feeding everything into an AI.

On the other hand, the robustness and general capabilities of ML models continues to improve. We have models that can roughly generate a video game frame-by-frame from a text prompt and input image. How long until we get this for application software? Or a diffusion LLM that just outputs a full WASM source/binary or update from a text prompt or series of images in 4 steps and 5 seconds.

I think it could be a really interesting experiment to create a diffusion LLM trained on thousands and thousands of 6502 games and programs, with the full manual (including images) as input and the output being assembly or machine code along with a bit of metadata for RetroArch or something. Or maybe also include recorded gameplay data/visuals.