From the contractor point of view, dragging the corporation's name through the mud isn't going to serve any purpose and can be used against you in court. While I don't necessarily side with Pigeon.ly, and emotionally, I'm on-side with the developer for calling them out, doing so just started a smear campaign on both sides. This isn't cool. Smearing someone's name is bad behaviour all around. I don't care whether a client does it or a consultant.

Having been in this position myself and being completely blindsided by it, I can tell you first hand, it'll shake your confidence and then you go through the stages of grief - pretty much the same as when anyone betrays your trust. Lashing out, even though you're angry and this client may deserve to be called out doesn't help.

To start you can issue a formal letter to the company regarding the filing a DMCA takedown notice that you will file with their web host and Google for copyright infringement if they fail to pay for the code they're infringing upon. If they don't pay by the deadline you set, file the notices... or you could just go ahead and file the DMCA takedowns with their web host and Google. I don't think legally you're required to inform the company first (though, I would check that with a lawyer. I vaguely recall my lawyer saying that to be the case, but I can't say with 100% certainty), but if you want to be treated fairly in court, you have to act honourably out of court.

At that point of you notifying the company, they basically have 3 options:

- Take down the infringing code (even in a work for hire, as my lawyer explicitly told me, your code is still your code until it's paid for in full. That means that every piece of work you've completed since the cut off period for work completed on your previous invoice is still yours until it is included on your next invoice and that is paid in full.)

- Pay for the code you have written in full.

- Pay a lawyer to fight their case in court.

This is a game, plain and simple. The question is, who is the better player, you as the developer or the corporation. That depends entirely on your evidence/lawyer and who has the fewest scruples. Whoever's got the least scruples and the best lawyer wins. Their lawyer's job is in the first instance to keep this out of court. Outside of a courtroom, the company can bully you into accepting whatever terms they see fit, unsupervised by the court. In the second instance it's to twist whatever material they can lay their hands on to manipulate the judge into taking their side and giving you nothing - all for less than it would cost to pay whatever they can make you settle for. Your lawyer's job is to get the payment you deserve or get it in front of a judge to win more than the company would agree to pay outside of the court, plus your lawyer's fees.

If (like most of us) you have a conscience and spend your life worrying about whether you're really as good as you hope, chances are, the fight will take a huge toll on your confidence and your health. Even if you're right, can you handle the bully tactics that will be used to drag your name and reputation through the mud or will self doubt make you cave? Do you have the fortitude and the finances to stand against their lawyers to the end? Do you have the confidence that your lawyer can outmaneuver theirs in this case? At the end of the day, if it's cheaper to pay you off, they will do so; if it's cheaper to rewrite from scratch and cut you off they will do so; if they can make some money back by strong-arming you into paying back what they paid you, they'll try (usually though, this is just a tactic to make you back off so they don't have to pay their lawyers to fight you - because they don't even want to pay their lawyer.)

At the end of the day, it's about their bottom line, it's not personal, though it will feel very personal to you. You have to take the same stance as the corporation: Look at the bottom line, let's say you're still due $25,000, you've been paid $15,000. You stand to lose $15,000 plus court costs (and damages if they can prove it) if they win in court (i.e. if their lawyer is better than yours.) You stand to win $25,000 if you win. Out of that $25,000 you will have to pay your lawyer - which, if the case runs on could cost you as much as you're owed if not more. Is what you get after what you've paid your lawyer worth the time you lose working on some other project that is paying their bills? Probably not.

If you've got a case, file a DMCA takedown notice, if you don't, chances are you should just move on and chalk it up to lessons learned.

The best lessons I learned in this situation:

- First and foremost, have a lawyer, someone that knows corporate and intellectual property law. Someone you trust.

- Never sign anything until your lawyer has looked at it and made sure it's in your best interest to do so. A contract presented to you is a starting point of negotiation. Don't just blindly sign it assuming "it's just a standard developer contract". Any contract presented to you to sign is likely to be sided all in favour of the corporation. I've had contracts presented to me that by signing them, I'd be in breach of contract or NDAs for turning evidence over to my lawyer if that should be needed. So I reiterate - never sign anything until your lawyer has looked at it!

- Check your ego at the door. This isn't personal, it's a business relationship. Your quest to be the best and change the world for the better are your biggest strengths, but they can also be your biggest weaknesses. Don't let emotion and ego dictate your client interactions, they will be your quickest undoing.

- Never agree to anything that cannot be recorded. Every piece of communication regarding your work should be carried out in some form of recordable communication: Email, Skype chat, Lync chat, Text Message, record every phone call from your clients. Every scrap of supporting documentation you can find confirming your approach to your code should be kept to hand. Make sure all evidence the most credible it can be.

- Always use a form of source control that you have complete control over. When you pull down their original code base, check it into your local source control, unchanged. Doesn't matter if it compiles, doesn't matter if everything is there. Just check it in, in whatever state it's in. This is the starting point of your chain of evidence. If the shit hits the fan, you have a point of reference from where this whole relationship started. If you use centralized source control and they lock you out, you've lost your chain of evidence, but their lawyer has theirs. They could tamper with it to favour their story and you're powerless to do anything about it.

- Keep a log of your relationship with the client, things like what happened today, what frustrations you faced, what went wrong, what could be improved upon tomorrow. Is policy and procedure keeping you from doing your work? Have you been provided the tools required to do your job? Are you actively prevented from doing your job because of X, Y or Z?

- Every commit should have an accurate commit note. This isn't just some bullshit hoop to jump through. The notes are important. This is an evidence log of the work you've completed, it is a description of why that commit exists. It contains a timestamp, fingerprint and your username proving that you did the work and when you did the work. If nothing else, your daily check ins can be used as proof that you were working on any given day.

- Every check-in should be married with a clearly and unambiguously written task or bug to be completed.

- Make sure code review happens, someone else needs to check your code. This again isn't just some bullshit big brother tactic. This is you covering your ass. This is your ability to say, this code was tested, checked and validated before it was checked in. It was the right approach, it was good code.

- Write unit tests, make sure every unit test passes before check-in.

- Never check in broken code. If push comes to shove, you want to say that their production code was working at the point of your final check in (which was code reviewed) and all unit tests were passing. You have proof of this because their production application has the same version stamp as the check-in you wrote. You can demonstrate the same from the final check in from your local source control.

- Never say anything in writing that could later be used as evidence against you. Any time you sit down in front of an email to a client, before you hit send ask yourself how this could be construed in court against me if it ends up there. It can and it will end up in court if it suits your client's purpose.

- Never take shortcuts. Do it right. If someone is pressuring you to do it wrong, get it in writing. Support their wishes, be a team player, but make your objections in writing clear "I don't like this approach because of X, Y and Z, but if that's what you want, under duress, I will see that it's done exactly as you ask." You want to be able to say in court, "They asked for this in writing (here is the email) and I clearly made my objections in writing (here is that email) at the time this was asked of me."

- Never get so far ahead of your client in terms of work vs. what they owe you that you can't afford to live if they refuse to pay for work not yet paid for. If you can't afford not to get paid under the terms set out, then don't agree to those terms. If for instance you're paid on 30 day terms on each calendar month - that means that by the time you get your first payment, you'll have completed 2 months work. Can you afford not to get paid for 2 months work? If not, don't agree to those terms. Always make sure you have enough of a buffer that if the client refuses to pay, you've got enough to cover, plus enough to cover you while you find your next client.

- If you can put yourself in the right situation (though it's hard in the contractor world), never hand over code until it's been paid for. Take it to the client, demo, get sign off that it's complete but don't hand off until you have payment.

- Never think "this won't happen to me." It can happen to you. I'm told I was lucky to make it through the 20 years I did without it happening. It's commonplace in this industry, chances are, it's just a matter of time before it happens to you, if not, you're lucky. Just be the best you can be, act honourably and cover your ass. Hopefully if it does happen, all you'll lose is a bit of money.