I like to joke around and have a good time while doing serious work. This isnt some profound optimization technique, just something that makes my day happier and usually that of those around me. However, my general rule of thumb is to never directly engage a female at the workplace outside of a purely professional, subdued necessity. They are too sensitive. While I know I have good intentions and care for their happiness, not everyone has the same level of empathy. So I simply avoid getting grouped into the fratboy category even when I really do want them to just lighten up a bit. I personally find blanket invitations to after-work drinks to be a better environment to get more friendly with the ladies on the team, most will drop their shields a few notches.