lesson 2 for coders to get better at accepting & rejecting code from AI models(coming from an engineer who built the cursor for xcode at http://alexcodes.app)
you are a junior engineer who vibe codes. you haven't touched the code in months. you just accept and reject code every now and then.
everytime a new bug comes in, you say to a model: hey this is a bug, fix it.
here is why that's wrong:
models tend to take the path of least resistance(much like humans).
what that means is, you could one potentially deep rooted issue in your database design which is the main reason beneath the bug and the model would add hardcoded values explicitly to fix it.
it does fix the problem right? i mean it does.
is that the best way to do it? mostly not.
implementing such solutions often result in what senior devs say "tech debt" or in simple language "you implemented something which solves this problem but will result in 5x more problems later"
is there a solution to it?
yeah
understand the basic intuition behind the model. model is a smart hacky human who would do what you say. if you let it take shortcuts, it will.
the easiest way to solve a bug is to ask the model to first think of 3-5 possible reasons why something is failing.
once it comes up with that, ask it to add logs to verify the top 3 reasons it came up with.
run the code and pinpoint the specific reason.
don't ask the model to fix it just yet. ask the model about possible solutions. probe into the direction of, "what's the best solution to this"
often times the models still don't have the right solution in mind because they just don't have the full context when they are answering your question.
its always better to be "opinionated" about the kind of solution you want for a bug and then asking the implementation plan from the model to implement the plan.
i hope this helps you, fellow coder.