I'm diving into Node.js with Fastify and am working on building small APIs. I'm curious about the mistakes that other developers made when they first got started. It would be great to hear some real-life examples, so I can learn from your experiences and avoid making the same errors myself!
4 Answers
Honestly, making mistakes is part of the learning process. You have to mess up and fix it to truly understand. So, asking for mistakes to avoid can be a mistake in itself!
Totally ignoring how I'm going to troubleshoot issues once the app is in production is something I learned the hard way. You really need a plan for that from the get-go, or you’ll be in for a rough ride later on.
I went overboard trying to make everything super abstract and reusable, especially with inheritance. It can complicate things way more than necessary.
One of the biggest mistakes I see new developers make is the n+1 query problem. This happens when you query a list of items and then perform another query for each one of those items. It can really slow down your app, leading to unacceptable latency issues that you'll have to revisit later and fix.
Could you break that down a bit? I'm not clear on how to improve beyond O(n) if I need to work with everything in a list. Thanks!
I wouldn't exactly say that's a mistake. Performance becomes important only when there’s a real need for it. Sometimes focusing too much on performance can make your code harder to write and maintain. There are many factors to consider.