Using AI when you know a lot about software development is great, as opposed to when you're a newbie (simplistic point, but lots of people need to think about it before declaring "learning to code" obsolete)
I'm not a NodeJS expert, or any backend expert for that matter, but I'm working on a small NodeJS project right now and needed a function to implement exponential backoff.
Now I know what exponential backoff is, though I've never implemented it. I typed in "function exponentialBackoff" and got this function from Copilot
I'm not sure if it is great, but as a developer, I can debug it, reason about it, and improve it. I can own this code and maintain it.
Now imagine doing this without knowing what "exponential backoff" even is - try to explain it to AI. Hell, you might not even realize it exists and can be useful to your use case.
ALT async function exponentialBackOff(cb, max) {
let attempts = 0;
while (true) {
try {
return await cb();
} catch (error) {
if (attempts >= max) {
throw error;
}
const delay = Math.pow(2, attempts) * 1000;
console.error(
`Attempt ${attempts 1} failed. Retrying in ${delay}ms...`
);
await new Promise(resolve => setTimeout(resolve, delay));
attempts ;
}
}
}