Back in my self-employment days, I've once taken on a small and rather well-paid project: "A newsletter system", the spec stated.

Everything was fine, invoices were paid with each milestone reached, me was a happy developer … Until Mr. Client started demanding mail header spoofing and a bunch of other functionality eventually leading me to the conclusion that I was building quite the sophisticated spam mailer.

To make a long story short: Financial considerations made me finish what I had started. I resent having taken on the job in the first place to this day – if I had bothered to google my client's name, I would've been warned.

What strategies can I use to avoid ending up coding stuff I'd rather not see in someone's hands?

  • 1
    Hi vzwick, while asking people for their war stories might make a good discussion topic, it's not a good fit for the Stack Exchange Q&A format. I've removed those parts of your question so as to focus on the answerable part: how to prevent taking on an unethical project.
    – user8
    Oct 26 '11 at 12:47
  • 15
    ...so it was you! (checks email: 69,105 unread emails)
    – rlemon
    Oct 26 '11 at 13:38
  • 1
    May I have an address for this person? I want to fill his house with packing peanuts.
    – Yatrix
    Oct 26 '11 at 13:49
  • 1
    This question reminds me of Stanford Experiment, that basicly explains why people did horrible things when they were commanded to do something that is not moral from their point of view.
    – ruslik
    Oct 26 '11 at 15:49
  • 3
    Designing the H-bomb is ethical. Using it may not be.
    – user11586
    Oct 26 '11 at 16:16

Warren Buffett was once told that he was an good and ethical man in an interview, and he said something to the effect of, "The world will never know. I've always been well off in my life. I've never had to steal to feed my family or make the choice between my ethics and poverty." (paraphrasing, as I don't have his exact words)

I have had similar experiences. Very luckily for me, I was in a position where I didn't have to do these unethical things. I have had clients who have made decisions that about how they've wanted to run their business that I have disagreed with on ethical grounds, and I've finished out my contracts with them and bid them adieu.

The strategy for avoiding this has nothing to do with programming. Get yourself in a financial position where you can survive well for a number of months with no pay. Save enough money that you're not dependent upon one client's unethical demands to make ends meet. Money is used all of the time by unethical people as a lever to get people to do something that they wouldn't otherwise do.

My limits are what I'm comfortable with. I can't enumerate them all, but it would go something like the Code of Ethics for Professional Engineers.

  • 3
    I'll add one more point to this... I deal in finance. Creating a spam mailer for a client is clearly not what I'd want to be doing, but I wouldn't feel the kind of ethical dilemma I would feel if it were a choice between feeding my family and falsifying financial reports for a company. In that case, I would have to leave immediately on ethical grounds. In the case of writing a spam mailer, I would likely choose to finish out the contract, say "lesson learned", and move on. Oct 26 '11 at 11:34
  • That is a wise point. I'm not sure what I'd do. Fortunately, I've never been asked to write a spam mailer. Is spam illegal? I guess I'm not sure. Oct 26 '11 at 11:35
  • 4
    Good point, but ethics is a slippery slope. It seems wise to entrench where the ground is firm and not budge even a little. Even if I were to win in court, I would rather not that anyone could even accuse me of unethical practice. Oct 26 '11 at 12:12
  • 5
    @Matthew: One only has to read history to know you're right. Good people do terrible things by being led along in small steps. Oct 26 '11 at 13:37
  • 3
    My wife was put in a situation where the place she was working asked her to do something illegal, she just looked at her boss and said "Really?" (She didn't do it). I was job hunting recently and there were a few places that contacted me that based on industry I rejected them out right. I think one was a ForEx site, which is not an industry I would feel right about working in. I personally use as a guideline "Would I feel ok telling my Rabbi about this job?" - YMMV
    – Zachary K
    Oct 26 '11 at 14:35

Ethics are quite a bit subjective. Laws aren't. If you can show what you are demanded to do is illegal, you can use that as leverage. IANAL, but I am quite confident that withholding payment to coerce you to do something you think is illegal is really enough to be considered as duress.

As for your specific case: It appears that in Germany sending advertisement mails with misleading header/subject is actually illegal and can lead to a fine of up to 50000 EUR. Based on this you should have denied your client's request.

In general you might want to consider asking a lawyer in such a situation. Actions in our medium are sparsely covered by the law, which also means that the more general rules of conduct must be applied, which (depending on your country and your understanding of ethics) can tend towards what you consider ethical.
And I think most clients will back down if you tell them what they intend to do can be considered forgery (even if it's a whole different question whether it will be) or a similar crime.


Some things to consider if you are financially obligated and already made the mistake of agreeing...

Try disassociating yourself with the project work. Don't submit any code with your name or initials in comments. Remove any public code repositories linked to your email. In the event that legal actions are brought against this person you will still be linked by contract and financial transactions though. Hope and pray that this person does nothing illegal.

On that note, you might want to consider reporting his IP address to a known public honeypot list that tracks such spammers.

Further, if you feel the client could be doing really bad things that might put you in legal jeopardy for aiding and abetting then code in a hidden remote kill switch. Something where you can send a carefully worded HTTP header with the words, Alakazam for instance that will make everything grind to a halt. If what the person is doing is illegal anyway then they can't really win in court over breach of contract.

EDIT: I am not condoning the actions I described, just offering suggestions if you have already made the mistake of associating with this person. I understand the downvotes though.

  • 3
    -1. "Don't submit any code with your name or initials in comments." So you're basically saying that if you do something unethical, you should try to keep it quiet or cover it up. I think we've all seen how that story ends. This also basically means "don't use source control" because every single SCC system out there tracks who made what changes and when. Oct 26 '11 at 11:17
  • 2
    Like I said -- an interesting idea about the kill switch -- but I disagree about it. If everyone takes the "law" (vaguely defined here) into their own hands, bad things happen. The law should be enforced by the entity authorized to enforce it, i.e. the government. So, I'm downvoting this answer. Oct 26 '11 at 11:21
  • 3
    +1 to counter the downvotes. I sincerely wish that none of us shall ever need to use the options listed in the answer - but it can be useful to know them. Sometimes one can only choose between bad and worse choices. It is so easy to condemn others without having walked in their shoes. Oct 26 '11 at 11:57
  • 4
    @Péter "Sometimes one can only choose between bad and worse choices." That is true, and I'm not condemning maple_shaft. I'm just disagreeing with the usefulness of this answer. Oct 26 '11 at 12:08
  • 4
    All these options will eventually lead into a legal quagmire, with the consequences of having to pay more lawyer's fee to have them sorted out.
    – rwong
    Oct 26 '11 at 16:13

You did it for the money and we have to make these decisions all the time. Should I take a high paying job in an industry I don't agree with or help a greener company or non-profit?

I would not feel comfortable creating anything I would be ashamed to tell my friends and family about. It would be an uncomfortable interview discussing what I did with this application. These sound like more self-serving than ethical reasons but I've never claimed to be altruistic.


First step is to make sure your contract fully documents what features would be included. If you see questionable features up front, don't take the job. If the client tries to add questionable features later, they are not covered by the current contract, so you can refuse the new contract and client is still obligated to pay for the original contract work (and you obligated to complete it).

If you already have a contract that is too vague, you are in a tough spot. You can either surrender the contract and deal with the legal and financial outcomes or complete the work per contract. YMMV and IANAL, but I believe you don't have much of a legal position to fight from in your current situation. While it may be illegal to send spam in your country, I don't think it would be illegal to build software that could be used to send spam so you can't use the illegality to get out of the contract. Building a gun is not illegal, even though shooting someone with a gun almost always is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.