Code Room
Vibe codingMedium
Question
An AI wrote this Swift code to parse a price from an API response and format it for display in a checkout cell. It passes the dev's manual test, but you get a spike of crash reports in production from a single screen. What's the bug and how would you catch it before shipping?
func displayPrice(from json: [String: Any]) -> String { let cents = json["amount_cents"] as! Int let currency = json["currency"]! as! String let dollars = Double(cents) / 100.0 return formatter.string(currency: currency, amount: dollars)!}What a strong answer looks like
Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.
Learn the concepts
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.
Run or narrate your approach, then ask the coach.