r/CodingForBeginners • u/waveoui • Oct 16 '26
How do you verify AI-generated code when you're not an expert?
A green-looking result isn't proof that everything works. What simple checks would you recommend to someone building their first app with AI?
0
Upvotes
13
u/Beregolas Oct 16 '26
That's the neat part... you don't ^^
This is why learning programming is still important, especially in the "Age of AI". There are no simple checks that just work, you actually need to be able to understand what the AI is doing to control it.
4
u/marmotta1955 Oct 16 '26
Short answer: you cannot.
3
u/ConcreteExist Oct 16 '26
OP, you're so close to realizing the problem with vibecoders, so close.
2
u/HugeCannoli Oct 16 '26
you become an expert. But you can't because you keep programming with AI.
2
u/Cevvity Oct 16 '26
If it looks like shit, waffles on, outputs shit, yeah it’s probably my code
2
u/questron64 Oct 16 '26
You don't. If you can't tell the good code from the bad then you're vibe coding. There is no simple "is this code good" check you can do.​
1
u/Distdistdist Oct 22 '26
How do you verify your mechanic's work if you don't know anything about cars? By hiring somebody who knows about cars.
1
u/Ornery_Platypus9863 Oct 22 '26
You can’t, that’s why you have to actually know what you’re doing.
1
u/LrdJester Oct 16 '26
This is a good way to learn debugging.
But never trust the generated code.
I use AI to create personal stand alone apps as my disability honest my ability for long coding sessions. But this is for my use shortly at this point. If I ever share it I'll refactor the entire project, even though it'll take me a long time, to ensure it's not being inefficient and ensure security.
I will have it working and then update the small things, via AI, and the app will totally collapse and I find that when it made changes it introduced timing bugs.
1
u/DirtAndGrass Oct 16 '26
At the minimum be able to write/execute full coverage whitebox and black box testsÂ
1
u/Shtucer Oct 16 '26
By hiring expert... Obviously.
1
u/net_ramblings Oct 16 '26
This is free advertisement.
1
u/buzzon Oct 16 '26
You hire an expert
1
u/didnt-like-my-name Oct 16 '26
"LGTM!"
1
u/Ormek_II Oct 16 '26
No simple Checks!
I suggest TDD.
If it works immediately you have too few test.
1
u/LongjumpingFee2042 Oct 16 '26
I don't approve unless I am reasonably sure of the code. If the ai can write it. It can explain it. In depth and respond to your questions about why it chose to do x.Â
1
u/mxldevs Oct 17 '26
You spend thousands of dollars to get an expert to look at it.
1
u/Oliver_clothsoff1983 Oct 17 '26
The same way you build a house if you have only ever built a shed,.... hire a contractor thats built 100 houses already.
1
u/Longjumping_Put_7212 Oct 18 '26
I would say you verify it by reading through the code and seeing if the logic works. Or just add a few debug print lines that tell you what it is actually doing to help you understand how different inputs affect it
1
u/_manpat Oct 18 '26
you don't. the simple check I would recommend is "check that you're not using ai"
1
u/NoDepartment772 Oct 19 '26
A lot of the answers are "you can't," which is honest but not much use if you're going to ship the thing anyway. Practical version: you can't verify quality, but you can verify behaviour, and that catches more than people expect.
Test it on inputs you choose, not the ones in the demo. Empty, zero, a negative, a huge number, text where a number goes, an emoji. The demo always uses the happy path.
Re-read the prompt you gave it and check the code does what you actually asked, not what looks impressive.
For anything touching money, login, or files, if you can't explain what a line does, don't ship it yet. Ask it to explain that line, then check whether the explanation matches the code. Those often disagree.
Keep the last known-good version before each AI change so you can get back.
The skill you're really building here is testing, and that's worth learning on its own.
0
u/Sure-Passion2224 Oct 16 '26
It's a learning opportunity. AI is a tool and it is appropriate to use tools to get any job done. In those cases when you don't understand what the tool did the best response is to walk through it line by line to learn from it.
-1
u/VoiceOfSoftware Oct 16 '26
For starters, ask a second AI model (from a different company) to check the code. Ask both AI models to write tests, and explicitly look for edge cases, monitor errors, etc. Inject as much of your human understanding as possible, meaning add your own creative requirements that an AI may not be thinking of on its own.