I noticed a silly query written by a member of my team today. I was done for the day at work, and got tired of poking my friends on Facebook after a while. So out of boredom, I started going through the log which keeps project-wise record of SQL queries written by the developers, along with their names. And I stumbled upon the following
SELECT username FROM user WHERE username = ?
I couldn’t think of any situation where this query will be of any real use. Then I found another one
SELECT email FROM user WHERE email = ?
I couldn’t help but the ask the writer of these hilarious pair of queries, about their real purpose. Apparently he was involved in building a User Registration system for the project, and these queries were written to check if a user record with a certain username/email already exists in the database. We are writing the software on an MVC framework, so he could simply try loading a Model using the username/email, returned true if it loaded, and false otherwise! The guy wasn’t a newbie programmer, he has been in the company for over a year. This reminded me of a blog post I read very recently. Is the ridiculous simplicity of PHP is a curse rather than gift, as it attracts mostly average level programmers, thus creating a bad reputation for the language itself?