AI generated code.

I Gave an AI the Same 20 Coding Tasks With Short and Detailed Prompts — More Context Didn’t Always Produce Better Code

There is a habit I picked up after using AI for coding for a while. Whenever the generated code was not quite right, I added more context. Then a little more. Input formats, edge cases, performance requirements, error handling, preferred architecture, things the function should not do. Eventually a two-line request could turn into a small technical specification.It feels logical. A developer cannot read your mind, so why should an AI model be able to? More information should remove ambiguity and give better code. But after a few cases where a detailed prompt produced something strangely overengineered, I started wondering whether this assumption was actually true for small programming tasks.So I made a small experiment. I prepared 20 coding problems and sent every problem to the same model twice. The first version was intentionally short. The second explained almost everything I could reasonably explain without giving away the solution. There were 40 generated solutions in total. No follow-up messages, no asking the model to fix a failing test, no manually repairing imports. The first answer was the answer.

продолжить чтение