The Code I‘m Still Ashamed Of – A Cautionary Tale for Developers

We‘ve all been there. You‘re a developer working hard to advance your skills, build your portfolio, and grow your career. The job market is competitive. So when your boss or client asks you to code something that seems a bit unethical, it‘s tempting to just put your head down and do as you‘re told. But is it worth sacrificing your values for a paycheck?

Early in my tech career, I faced this very dilemma. At 21, I was thrilled to land a junior developer role at a digital agency that built websites for big pharmaceutical clients. The pay was great and the team was smart. I thought I had it made.

Until one day, I was handed requirements for a website aimed at promoting a prescription drug to teenage girls. The site featured a quiz that asked girls a series of questions and then invariably recommended the client‘s drug as the solution, regardless of their answers. Even if they said they were allergic to the drug, the system would just tell them to ask their doctor if it was still right for them.

Alarm bells went off in my head as I coded the quiz logic. This was clearly unethical, using leading questions and false pretenses to push drugs on vulnerable young women. It wasn‘t illegal, but it was definitely wrong. However, as the new kid on the team, I was afraid to speak up. I put my misgivings aside and did what I was told. I just coded the quiz and collected my paycheck.

A couple weeks later, I read a news story about a teenage girl who had committed suicide while taking the very drug I helped promote through that manipulative website. She had started the medication after stumbling across the site and taking the rigged self-diagnosis quiz. My heart sank into my stomach as I realized the real-world harm my code had contributed to. The shame and regret I felt in that moment has stuck with me to this day, over two decades later. It fundamentally changed how I approach my work and responsibilities as a developer.

You see, as developers, we wield tremendous power. The code we write doesn‘t just stay confined to our text editors and staging environments. It reaches out into the real world and directly impacts people‘s lives, for better or worse. The algorithms we create and the software we build can lift people up or cause great damage if we aren‘t careful.

As technology becomes increasingly ubiquitous, software is only becoming more powerful and impactful:

• Over 4.66 billion people use the internet worldwide (59.5% of the global population)
• 92.6% of US adults use the internet as of 2020
• On average, US adults spent over 6 hours per day using digital media in 2019
• By 2023, the number of IoT-connected devices worldwide is projected to reach 43 billion

From social media networks that influence elections to AI diagnostic tools that help doctors treat cancer patients, code is now at the heart of nearly every industry and every part of society. Developers are no longer just behind-the-scenes technicians. Increasingly, we are the unseen architects shaping the very infrastructure of the 21st century world.

With all this power comes great responsibility. Responsibility to be ever-mindful of the real human impacts of what we create. Responsibility to speak up when we‘re asked to build something dangerous or deceitful. Responsibility to put ethics and values at the forefront of how we approach our work. As computer scientist Bill Sourour eloquently put it:

"As developers, we are often one of the last lines of defense against potentially dangerous and unethical practices…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."

Unfortunately, many developers still face regular pressure to compromise their ethics. In a 2018 survey of over 1500 US technologists across industries by Doteveryone:

• 28% of respondents said they‘d been asked to take shortcuts, rush work, or do something they felt was wrong in their jobs
• 18% said they were asked to implement decisions they disagreed with
• 12% were asked to mislead customers, clients, or the public about something
• 3% were asked to break the law

Even more concerning, the 2020 State of Developer Ecosystem Survey by JetBrains (over 20k respondents) found:

• 9% of developers were aware of unethical uses of the tech they helped build
• 8% suspected the tech they build was being misused unethically but weren‘t totally sure
• Only 40% were completely certain the products they built were being used ethically

Unethical and dangerous uses of technology are distressingly common. For example, Facebook allowed user data to be improperly harvested by Cambridge Analytica to target political ads and influence the 2016 election. Volkswagen used embedded software tricks to falsify emissions data and illegally pass air pollution tests. Uber developed a secret software tool called Greyball to systematically deceive law enforcement in cities where its service violated regulations.

The list of major tech ethics scandals goes on. But these high profile cases are just the tip of the iceberg. Everyday, programmers face a wide range of complex ethical challenges on the job, often without clear guidance or support on how to handle them.

Common developer ethics quandaries include:

• Violating user privacy or anonymity to meet business goals
• Training AI models using biased datasets leading to unfair outcomes
• Creating infinite scrolls, autoplay, and other features that promote tech addiction
• Implementing dark patterns that mislead users into taking actions not in their interests
• Enabling fake reviews, likes, followers to juice growth metrics
• Greenwashing platforms to make companies seem environmentally-friendly
• Skirting industry regulations in highly-regulated sectors like health and finance
• Knowingly taking technical shortcuts that will lead to critical bugs or failures
• Being asked to exaggerate or outright lie about software features to win sales
• Automating jobs and displacing workers without concern for societal impact

So what can we as developers do? How can we navigate these challenging situations and ensure that ethics always come first in our code? Here are 10 principles I try to follow:

  1. Familiarize yourself with industry ethics standards, like the Association for Computing Machinery (ACM) Code of Ethics and the IEEE Code of Conduct. Refer to them when making decisions.

  2. Think critically about every project. Ask yourself: What‘s the real purpose? Who could be harmed? Is this adding value or mainly serving greedy interests?

  3. Voice concerns if a project seems unethical. I know it‘s not easy, but even asking clarifying questions can prompt reconsideration. Speak up thoughtfully.

  4. If overruled on an ethics objection, document your concerns in writing. Consider whether you want to continue working in that kind of environment. Quitting is sometimes the only ethical option.

  5. Proactively suggest ways to make products safer, fairer, and more beneficial. Advocate for responsible innovation that puts ethics front and center.

  6. Take time to consider unintended negative consequences of your work, especially for marginalized and vulnerable populations. Perform "ethical debugging."

  7. Follow secure coding best practices to protect your users‘ privacy, data, and safety. Security and ethics are closely intertwined.

  8. Incorporate ethics discussions and training throughout the software development lifecycle. Don‘t treat it as an afterthought or a rubber stamp.

  9. Be transparent about how systems work, especially decisions made by AI. Give users control over their data and the ability to opt out.

  10. Participate in the broader tech ethics community. Attend meetups, join working groups, contribute to new standards and guidelines. Together our voices are stronger.

As developers, we have an amazing opportunity to build solutions that uplift people and truly benefit humanity. But that means taking the long view and prioritizing positive impact over short-term gains. In the words of former Mozilla CEO Brendan Eich:

"The web is now a dominant platform, the defacto operating system of the cloud. That means those of us working on the web platform have profound ethical responsibilities…As hackers, we need more than the ‘move fast and break things‘ ethos. We need precautionary principles and guidance on using — and not abusing — our power."

The fact is, the ethical stakes in software development are incredibly high and growing by the day. Technology is now interwoven into every sphere of human society and experience — communication, education, employment, healthcare, governance, commerce, entertainment, etc. There‘s no longer any such thing as an ethically-neutral technology. Every line of code either affirms human dignity or corrupts it.

Of course, no technologist sets out to cause harm (with rare sociopathic exceptions). Most of us get into this field with the best of intentions – to build cool things that solve problems and maybe make the world a bit of a better place. But here‘s the rub: Without a strong ethical framework, even our most well-intentioned creations can end up doing more harm than good. The road to dystopia is paved with lines of code just meant to hit KPIs and keep bosses happy.

If we want to live up to the ideal of tech as a force for positive change, we have to put our code where our values are. We have to center ethics over expediency. Speak truth to power. Be willing to make personal sacrifices for the greater good.

Because at the end of the day, we are the ones designing the decision logic. We are the ones choosing what data to collect and what to do with it. We are the ones responsible for anticipating and mitigating the harms of our inventions. There‘s no one else to pass the ethical buck to.

For me, two decades ago, I failed this test. I coded that unethical prescription drug website and harmed vulnerable girls because I was too scared to object as a junior dev. To this day, I still feel sick about the suffering I contributed to with those lines of code. It will haunt me forever.

But I‘m determined to do better going forward. I‘m determined to anchor my dev work in humanist values, to fight for ethics all the way down the stack. I hope you‘ll join me in this mission. Because, like it or not, we developers are now the reluctant philosophers of the digital age. The world we build will be the world we live in. I don‘t know about you, but I want to be able to live with myself. I want to be proud of my code.

Similar Posts