There can be a science to joke writing, there are certainly rules and patterns that can be followed, but I think most of the best comedy goes beyond the rules.
Robin InceOne idea I explore in my stand-up show is whether, if you try looking at the universe rationally and avoid coping mechanisms like mysticism or religion, you can still be happy knowing you are going to die after a brief time on this spinning ball.
Robin Ince