A part of my daily jobs is to work with junior developers and help, directly or indirectly, train them to become a better, senior developers. An inevitable part of that learning process is seeing them making mistakes, sometimes very obvious ones. Looking back, I used to make many obvious mistakes when I was a junior developer, and those incidents have helped me improve to become the developer I am today. Here are some of the mistakes I remember the most.
I used to develop an SMTP event sink that was responsible for sending and receiving emails. When it sent an email to a nonexistent address but the host name is correct, the other email server would respond with a bounce mail. Here is where the fun began: I didn't check if an email was a bounce mail, and because my event sink judged that the bounce mail was being sent to an invalid email address inside our system, it sent an auto-reply back. This process ended up with an indefinite loop which basically DDoS our own email server as well as the other server.
Sometimes our mail database table (yes, we didn't use Exchange or any mail server products back then) had bad data which needed a clean up. Once I wrote a short script to delete bad data, but the problem was that I forgot to put in a where clause so all data was deleted! Since then, I always wrote double check if I have a correct where clause before running any queries.
The last one is also about that emailing module. This involved a somewhat hilarious exchange: a colleague showed me a log file and asked if I saw anything unusual. I look at the file and told him that I saw nothing and asked what the problem was. His answer was that: "Yes, the file is empty, which means no email has been sent out, and that means no money!".
Although this post is about mistakes I made when I was a junior developer, it doesn't mean I don't make mistakes now. I still do, fewer than before, but still make plenty of mistakes. The thing is that I need to make sure I don't make the same mistake twice, and if possible should correct them before they cause real problems.