Remember that Aesop's fable where these kids throw pebbles at the frogs as a game? After some heavy pelting, one of the older frogs told the kids, "Pray stop, my boys: what is sport to you, is death to us."
Once you get over the mental image of frogs speaking fluent English, the moral you extract is not that you shouldn't be throwing pebbles at people (which I thought was the point), but that you should be careful about not making jokes at someone's expense.
Frankly, we all have made jokes putting someone/something down. We do it without even realising half the time. Try and think of a joke in a social gathering that does not put someone or something down. Most people tread a very fine line when it comes to jokes. It is easy to go overboard if boundaries aren't defined and maintained.
Take most bullying cases, for instance. You see a bunch of guys being douchebags (DB) and making fun of someone. It's all fun and games at first, but things can escalate quickly enough and human nature is ever so vindictive. Be it some past insecurities that hit a trigger, some resentment held inside, or just the insatiable need to be a DB, we tend to forget or overlook these boundaries (considering they were there at all).
Establishing boundaries is a rule that supersedes all else. Know when to crack a joke, when not to; who to joke about, and who to avoid. Generally, people you know who appreciate your jokes are the people you should be joking with. It is highly inappropriate to tell a dirty joke to someone you just met. You can't imagine what force of willpower I had to employ to stop myself from making a bunch of inappropriate jokes in this article, because it is SHOUT and there are boundaries. There's a time and place for everything.
Secondly, do not offend, do not hurt. There are a lot of people who hate this sentiment. Your freedom of choice gives you the right to offend whomever you wish to… kind of. But that's not the point. Your stupid joke is just not worth hurting someone. Making jokes that hurt people does not make you cool; it just makes you a DB. Karma's a witch, and someday it's going to come back and boom, headshot. Respect other people, and you will receive in kind.
Three, don't drag your jokes. C'mon, man. There is a limit to how lame you can get. I have my fair share of absurdly lame jokes. A friend of mine once introduced someone saying they are friends from Nursery. I asked, "Nursery? What are you guys, trees or something?" Yeah... I like cracking lame jokes. But this is where I should have drawn the line instead of making an array of jokes about photosynthesis. I lost a good friend that day.
Never explain your stupid joke. Just don't. How would you feel if I tried to explain how I lost a good friend that day? It's annoying, and destroys what little humour you managed to start with. Instead, try to make your jokes more easily understandable. Going, "Er... wait, I know what happens next. Let me just remember a bit..." does not help. Neither does letting out the punch-line before getting to the end of the joke and then going, "I should have said this before the punch-line… but you can see why that would be funny."