You might find this post boring. It’s a straight-out grammar lesson.
Here are the rules:
- Separate interjections (such as “However, …”) and direct address (someone’s name or title) from the sentence with a comma.
- Separate an introductory clause from the rest of the sentence with a comma.
- Separate an introductory prepositional phrase from the rest of the sentence if it contains five or more words.
- Some common shorter prepositional phrases, such as “for example,” get the comma, too. This rule is flexible. If you have a short prepositional phrase, and it feels as if it needs a comma, go for it.
Okay, take a look at this:
However, the Coppersmith’s algorithm allows quite a lot of flexibility. Tom, you can’t do that!
Easy enough. Now how about this one:
To speed up the prime number generation, smart card manufacturers implement various optimisations.
(British spelling. Ignore that). The sentence starts with “to.” Prepositional phrase, right? Well, no. It’s actually an infinitive. Infinitives are verbs. If it has a verb, it’s a clause. So I could rewrite this as:
To speed things up, smart card manufacturers implement various optimisations.
Fewer than five words, still gets the comma. If fact, look at a sentence I just wrote:
If it has a verb, it’s a clause.
“Has” is a verb, so you have a clause. A lot of introductory clauses start with words like “if” and “when.” We call them introductory adverbs. In fact, if you got rid of that introductory adverb, you’d have a complete sentence, which requires a period, not a comma. If you write:
It has a verb, it’s a clause.
Get rid of that comma! Use a period! Two independent sentences separated by a comma is called a comma splice, and that’s a no-no.
Sorry—it’s pretty hard to find a comic about commas.
PS—Wouldn’t you know! I ran into one at Saturday Morning Breakfast Cereal: