How to handle a colleague who hasn't pulled their weight I'm working on a project with a partner that involves developing a mobile app and corresponding server. I won't bother with the specifics, but both involve a fair amount of work (both require some custom algorithms as well as thousands of lines of code). This project will serve as a final for one of our classes.

Originally, we agreed that I would write the server and he would write the mobile application. I stayed up for a couple nights straight and got together a working server in no time. He told me he was bogged down with papers/family life/etc., but he'd handle the client side.

About two weeks went by and still no progress had been made. I had some free time so I figured out how the app needs to be written (i.e. writing out the pseudocode and sketching wireframes). When another week went by and still no work had been done, I went ahead and wrote a good deal of the client code. My partner is also my friend and I trusted him when he told me he would do his part and he was just totally bogged down.

Now the project is due on Friday and I'm still the only one who's actually done anything. I find out today that he still has yet to write a single line of code because he's so busy (but not so busy that he couldn't go to a baseball game, a concert, and spend all of Friday night getting drunk). 

I'm not sure how I want to approach the situation. Even if my partner finished the project on his own, I've still done 80%. I don't think its fair if he gets an A because I killed myself to do the work of two people. At the same time, if I tell the professor how little he's done, the professor will fail him (rightly so) and I will lose a friend.

How can I get the credit I deserve for my work without losing my friend? I feel like I have the Hobson's choice between getting credit for my work and keeping a friend.

EDIT: I did choose a specific answer as my accepted answer, but all of these answers are of really good quality. If you're having a problem similar to mine, I highly suggest reading through all of the answers here.
When students come to me with problems like these, I very rarely just take the side of the active student against the "lazy" one. 

If you work in a group, you're both responsible when the dynamic doesn't work. And keeping the group dynamic healthy is something every student should learn. I know how difficult it is, I've been both the lazy student and the active one.

It may feel to you like there's nothing you possibly could've done. But that's never true. You started the project by immediately splitting the work load, and reducing the level of necessary communication to a bare minimum. He took the easy half, because he was busy. When his work started to lag behind, you began to write specifications for him.

All this combined probably sapped his motivation. Every step along the way took the challenge out of his part, while he still had those thousands of lines of code to get through. Meanwhile you felt like you were doing more than your share, but you were getting things done, and things that you designed, problems you solved.

In a healthy project, you communicate and you meet often. You don't divide the workload to minimize communication, you use your shared expertise and you design together. That way, you both stay motivated, because you both feel like it's still your project.

What you're doing now is focusing on everything that he could be doing differently. That may be the fair option (cause you're doing all the work), but it's not a productive option, cause that's not a dimension you control. You should be asking yourself what you could've done differently. It may feel unfair, but it's something you can actually implement, so you'll feel a lot less powerless.

Anyway, that's a lesson for the next project. For this one, I'd say remain detached. It's not your responsibility to make sure John learns something, and you'll get the same grade either way. Talk to him, tell him you're unhappy with the way the project's gone and ask if you could've done anything differently to get him more motivated. Let him know you don't expect to be working with him on future project and you're better off as friends than as collaborators. 

Just make sure you don't get angry with him. Anger might've been productive halfway down the project, but you're too late now.