Live data from Hacker News

Ask HN: How can I get better at using AI for programming?

news.ycombinator.com

331–340 of 491 posts

Re: Ask HN: How can I get better at using AI for programming?

#331

Earlier quoted context omitted.

I cannot show it because the code belongs to my employer.

Ah yes of course. But no one asked for the code really. Just show us the app. Or is it some kinda super-duper secret military stuff you are not even supposed to discuss, let alone show.

It is neither of these. It's an application that processes data and is not accessible outside of the companies network. Not everything is an app.

I described my workflow that has been a game changer for me, hoping it might be useful to another person because I have struggled to use LLMs for more than a Google replacement.

As an example, one task of the feature was to add metrics for observability when the new action was executed. Another when it failed.

My prompt: Create a new metric "foo.bar" in MyMetrics when MyService.action was successful and "foo.bar.failed" when it failed.

I review the plan and let it implement it.

As you can see it's a small task and after it is done I review the changes and commit them. Rinse and repeat.

I think the biggest issue is that people try to one shot big features or applications. But it is much more efficient to me to treat Copilot as a smart pair programming partner. There you also think about and implement one task after the other.

Re: Ask HN: How can I get better at using AI for programming?

#332

Everyone's suggestions feel designed to frustrate me. Instructions on how to cajole and plead that seem more astrology than engineering. This is the pattern I settled on about a year ago. I use it as a rubber-duck / conversation partner for bigger picture issues. I'll run my code through it as a sanity "pre-check" before a pr review. And I mapped autocomplete to ctrl-; in vim so I only bring it up when I need it. Oth…

This is the only approach that seems even remotely reasonable “Prompt engineering” just seems dumb as hell. It’s literally just an imprecise nondeterministic programming language. Before a couple years so, we all would have said that was a bad language and moved on.

A few years ago we didn't have an imprecise nondeterministic programming language that would allow your mom to achieve SOTA results on a wide range of NLP tasks by asking nicely, or I'm sure people would have taken it.

I think a lot of prompt engineering is voodoo, but it's not all baseless: a more formal way to look at it is aligning your task with the pre-training and post-training of the model.

The whole "it's a bad language" refrain feels half-baked when most of us use relatively high level languages on non-realtime OSes that obfuscate so much that they might as well be well worded prompts compared to how deterministic the underlying primitives they were built on are... at least until you zoom in too far.

Re: Ask HN: How can I get better at using AI for programming?

#333
maybe a dumb but wise approach is to just code as usual without thinking about "AI", and when you have difficulties or efficiency issues, look for tools to solve that. think in terms of specific tools instead of "ai" or "llm".

Do you need better auto-completion? Do you need code auto-generation? do you need test cases to be generated, and lots of them? maybe llms can are ideal for you, or not.

Personally, the best use i've gotten out of it so far is to replace the old pattern of googling something and clicking through a bunch of sites like stackoverflow to figure things out. and asking llms to generate an example code of how to do something, and using that as a reference to solve problems. sometimes i really just need the damn answer without having a deep debate with someone on the internet, and sometimes I need a holistic solution engineering. AI helps with either, but if I don't know what questions to ask to begin with, it will be forced to make assumptions, and then I can't validate the suggestions or code it generated based on those assumptions. So, it's very important to me that the questions I ask an AI tool are questions whose subject domain I have a good understanding of, and where the answers are things I can independently validate.

Re: Ask HN: How can I get better at using AI for programming?

#334

Earlier quoted context omitted.

This is the only approach that seems even remotely reasonable “Prompt engineering” just seems dumb as hell. It’s literally just an imprecise nondeterministic programming language. Before a couple years so, we all would have said that was a bad language and moved on.

A few years ago we didn't have an imprecise nondeterministic programming language that would allow your mom to achieve SOTA results on a wide range of NLP tasks by asking nicely, or I'm sure people would have taken it. I think a lot of prompt engineering is voodoo, but it's not all baseless: a more formal way to look at it is aligning your task with the pre-training and post-training of the model. The whole "it's a b…

Do you mean, like, scripting languages? Are the underlying primitives C and machine language? "Might as well be well worded prompts" is the overstatement of the century; any given scripting language is far closer to those underlying layers than it is to using natural language with LLMs.

Re: Ask HN: How can I get better at using AI for programming?

#335
post #38

> prompting just isn't able to get AI's code quality within 90% of what I'd write by hand Tale as old as time. The expert gets promoted to manager, and the replacement worker can’t deliver even 90% of what the manager used to. Often more like 30% at first, because even if they’re good, they lack years of context. AI doesn’t change that. You still have to figure out how to get 5 workers who can do 30-70% of what you c…

>2. Internalized speed: be a great individual contributor, build a deep, precise mental model, build correct guardrails and convention (because you understand the problem) and protect those boundaries ruthlessly, optimize for future change, move fast because there are fewer surprises

I think the issue here is, to become a great individual contributor one needs to spent time on the saddle, polishing their skills. And with mandatory AI delegation this polishing stage will take more time than ever before.

Re: Ask HN: How can I get better at using AI for programming?

#336

Earlier quoted context omitted.

Not borderline - it is just straight snake-oil peddling.

yet it works? where have you been for the last 2 years? calling this snake oil is like when the horse carriage riders were against cars.

I am an early adopter since 2021 buddy. "It works" for trivial use-cases, for anything more complex it is utter crap.

Re: Ask HN: How can I get better at using AI for programming?

#337
post #124

AI programming, for me, is just a few simple rules: 1. True vibe coding (one-shot, non-trivial, push to master) does not work. Do not try it. 2. Break your task into verifiable chunks. Work with Claude to this end. 3. Put the entire plan into a Markdown file; it should be as concise as possible. You need a summary of the task; individual problems to solve; references to files and symbols in the source code; a work li…

How do you mean 'a tmux session' to be something verifiable?

Re: Ask HN: How can I get better at using AI for programming?

#338
post #247

Earlier quoted context omitted.

I am sorry but what do I have to learn? That the tool does not work as advertised? That sometimes it will work as advertised, sometimes not? That it will sometimes expose critical secrets as plain text and some other time suggest to solve a problem in a function by removing the function code completely? What are you even talking about, comparing to shell and text editors? These are still bloody deterministic tools. Y…

Yes, you have to learn those things. LLMs are hard to use. So are animals, but we've used dogs and falcons and truffle hunting pigs as tools for thousands of years. Non-deterministic tools are still tools, they just take a bunch more work to figure out.

No, please, stop misleading people Simon. People use tools to make things easier for them, not harder. And a tool which I cannot steer predictably is not a god damn tool at all! The sheer persistence the AI-promoters like you are willing to invest just to gaslight us all into thinking we were dumb and did not know how to use the shit-generators is really baffling. Understand that a lot of us are early adopters and we see this shit for what it is - the most serious mess up of the "Big Tech" since Zuckerberg burned 77B for his metaverse idiocy. By the way - animals are not tools. People do not use them - they engage with them as helpers, companions and for some people, even friends of sorts. Drop your LLM and try engaging with someone who has a hunting dog for example - they'd be quite surprised if you referred to their beloved retriever as a "tool". And you might learn something about a real intelligence.

Re: Ask HN: How can I get better at using AI for programming?

#339
post #257
post #247

Earlier quoted context omitted.

Yes, you have to learn those things. LLMs are hard to use. So are animals, but we've used dogs and falcons and truffle hunting pigs as tools for thousands of years. Non-deterministic tools are still tools, they just take a bunch more work to figure out.

It's like having Michael Jordan with dementia on your team. You start out mesmerized by how many points he can score, and then you get incredibly frustrated that he forgets he has to dribble and shoot into the correct hoop.

Spot on. Not to mention all the fouls and traveling the demented "all star" makes for your team, effectively negating any point gains.

Re: Ask HN: How can I get better at using AI for programming?

#340

Everyone's suggestions feel designed to frustrate me. Instructions on how to cajole and plead that seem more astrology than engineering. This is the pattern I settled on about a year ago. I use it as a rubber-duck / conversation partner for bigger picture issues. I'll run my code through it as a sanity "pre-check" before a pr review. And I mapped autocomplete to ctrl-; in vim so I only bring it up when I need it. Oth…

This is the only approach that seems even remotely reasonable “Prompt engineering” just seems dumb as hell. It’s literally just an imprecise nondeterministic programming language. Before a couple years so, we all would have said that was a bad language and moved on.

It's technically deterministic, but it feels nondeterministic in chatbots since tokens are randomly sampled (temp > 0) and input is varied. Using the right prompt makes the model perform better on average, so it's not completely dumb.

I like task vectors and soft prompts because I think they show how prompt engineering is cool and useful.

https://arxiv.org/pdf/2310.15916

https://huggingface.co/docs/peft/conceptual_guides/prompting

Post reply on HN