The code I’m still ashamed of
If you write code for a living, there’s a chance that at some point in your career, someone will ask you to code something a little deceitful – if not outright unethical.
This happened to me back in the year 2000. And it’s something I’ll never be able to forget.
I wrote my first line of code at 6 years old. I’m no prodigy though. I had a lot of help from my dad at the time. But I was hooked. I loved it.
By the time I was 15, I was working part-time for my dad’s consulting firm. I built websites and coded small components for business apps on weekends and in the summer.
I was woefully underpaid. But as my dad still likes to point out, I got free room and board, and some pretty valuable work experience.
Later, I managed to help fund a part of my education through a few freelance coding gigs. I built a couple of early e-commerce sites for some local small businesses.
By age 21, I managed to land a full-time coding job with an interactive marketing firm in Toronto, Canada.
The firm had been founded by a medical doctor and many of its clients were large pharmaceutical companies.
In Canada, there are strict limits on how pharmaceutical companies can advertise prescription drugs directly to consumers.
As a result, these companies would create websites that present general information about whatever symptoms their drugs were meant to address. Then, if a visitor could prove they had a prescription, they were given access to a patient portal with more specific info about the drug.
One of the projects I was assigned to involved a drug that was targeted at women. The graphics and general style of the website made it clear that the client wanted to specifically target teenage girls.
One of the features of this website was a quiz that asked girls a series of questions and recommended a type of drug based on their answers.
Remember, this website was posing as a general information site. It was not clearly an advertisement for any particular drug.
When I received the requirements, they contained the questions for the quiz, along with multiple choice answers for each question.
Missing from the requirements was any indication of what I should do with the answers at the end of the quiz. So what rules determined what treatment the quiz would recommend?
I spoke to the Account Manager about this. She emailed the client and got me the requirements. With those, I proceeded to code up the quiz.
Before submitting the website to the client, my project manager decided to give it a quick test. She tried the quiz, then came over to my desk:
“The quiz doesn’t work,” she said.
“Oh. What’s broken?” I asked.
“Well, it seems that no matter what I do, the quiz recommends the client’s drug as the best possible treatment. The only exception is if I say I’m allergic. Or if I say I am already taking it.”
“Yes. That’s what the requirements say to do. Everything leads to the client’s drug.”
“Oh. Okay. Cool.”
And she was off.
I wish I could tell you that when I first saw those requirements they bothered me. I wish I could tell you that it felt wrong to code something that was basically designed to trick young girls. But the truth is, I didn’t think much of it at the time. I had a job to do, and I did it.
Nothing that we were doing was illegal. As the youngest developer on my team, I was making good money for my age. And in the end, I understood that the real purpose of the site was to push a particular drug. So, I chalked this tactic up to “marketing.”
The client was extremely pleased with the site. So much so that their rep invited me and the entire team out to a fancy steak dinner.
The day of the dinner, shortly before leaving the office, a colleague emailed me a link to a news report online. It was about a young girl who had taken the drug I’d built the website for.
She had killed herself.
It turned out that among the main side effects of that drug were severe depression and suicidal thoughts.
The colleague who had emailed me didn’t show up to dinner.
I still went. It was difficult and awkward. I never mentioned the news report. I just ate my steak quietly and tried to force a smile when I could.
The next day, I called my sister. She was 19 at the time. We had discovered while working on the project that she had actually been prescribed the very drug I was building a site for.
When we first talked about it, we thought the whole thing was a neat coincidence. Now, the tone of our conversation was very different. I advised her to get off the drug ASAP. Thankfully, she listened.
There are a million and one ways for me to rationalize my part in later suicides and severe depression. Even today, there is ongoing litigation with former patients.
It’s easy to make an argument that I had no part in it at all. Still, I’ve never felt okay about writing that code.
Not long after that dinner, I resigned.
As developers, we are often one of the last lines of defense against potentially dangerous and unethical practices.
We’re approaching a time where software will drive the vehicle that transports your family to soccer practice. There are already AI programs that help doctors diagnose disease. It’s not hard to imagine them recommending prescription drugs soon, too.
The more software continues to take over every aspect of our lives, the more important it will be for us to take a stand and ensure that our ethics are ever-present in our code.
Since that day, I always try to think twice about the effects of my code before I write it. I hope that you will too.
These days, I spend a portion of my time writing and sending a regular newsletter that aims to help developers master their craft and advance their careers. Please sign up below to receive it.
UPDATE 2018: I am now a member of the Association for Computing Machinery and adhere to their 2018 Code of Ethics and Professional Conduct. I hope that you and the organization(s) you work with will consider doing the same.
If this article touched you in any way, please use the applause icon to help spread the word.