Code for Users

One thing that I always thought was neat, in a really strange way, is how users and coders see things totally differently.

At work, we have some admin tools to manage users, but periodically, we’ll come across a spammer who’s just signed up. They have tools to stop them and delete their posts, but I’ll often go the extra mile and log into a MySQL replicant and do a “SELECT * FROM users WHERE ip LIKE ‘$spammers_ip’G”, and see if it turns up any other users. Sometimes it’ll unearth a bunch.

The other thing I’ll do is something like, “SELECT username, signup_time, email, ip FROM users ORDER BY signup_time DESC LIMIT 20;” to view the most recent users, and re-run it every 30 seconds or so to keep an eye on who’s signing up. I have much better things to do than sit around watching this all day, but it’s useful when spammers do their periodic, “Register thousands of accounts at once” thing.

So today I was doing this for one of the customer service people, and they asked, “Where is that tool? I can’t find it.”

“Oh, I’m logged into the database… There’s no way for–actually, give me a few minutes.”

I threw together a couple PHP scripts that basically do the above, and display it in a table. It’s the type of thing that might bore a Programming 101 student, and the only thought involved, really, was in trying to figure out why it was aborting with an error. (Hint: searching for “” doesn’t do what you expect it will. I must have looked at the bit of code 30 times trying to figure out what could possibly be wrong with the line, and then it suddenly dawned on me. I’m a giant idiot. The is an escape character, effectively telling PHP to treat the next quote as a literal quote, not a closing quote on the string. This is something I know well: I’ll often do something like echo "<a href="">link</a>", using the exact functionality that tripped me up today. And yet I kept missing the error.)

Anyway, that’s not my point. My point is that I’m consistently amazed at how the user’s view is so radically different than the programmers. From my perspective, I just wrapped a little PHP around one of the simplest SQL queries imaginable. Heck, much of the logic was copied-and-pasted from another script. But from the perspective of the people who will use this script, it’s an immensely helpful tool that fills a void that’s existed for quite some time.

Of course, sometimes it’s the opposite way. Sometimes all the user wants is a report on newly-created groups, the username of the person that created them, and the number of members. That’s just a simple SQL query! Actually, I suppose it’ll take a join. No, wait, two joins… But do we actually store the number of members in a group? I wonder if I can do that with a subquery… Maybe this needs to be a script. You know what? This is way too complicated.

Leave a Reply

Your email address will not be published. Required fields are marked *