Commas for Developers

Consider this sentence:

I went to the moon, it has low gravity.

Or this one:

We drove 30 miles, the car ran out of gas.

If those look okay to you, then read on. (Otherwise, scram. You’ve got work to do.)

If your writing — in tweets and especially on your blog and product pages — is full of misspellings and improper capitalization and other errors, I will lose trust in you and your product. If you’re careless with language, are you also careless with software development?

There’s a simple rule you’re missing: you can’t join independent clauses with a comma.

The “independent clauses” part sounds all grammar-police-y. I can hear your eyes rolling. (They sound like toothpicks.) So I’ll give you an easier way to remember this rule: you can’t join two separate sentences with a comma.

In the example sentences above, you can almost be forgiven for thinking that they’re not independent clauses. (Almost.) But they are independent. The easy way to test is just by replacing the comma with a period. You’d get:

I went to the moon. It has low gravity.

We drove 30 miles. The car ran out of gas.

You might also rewrite them in other ways:

I went to the moon, which has low gravity.

We drove 30 miles and the car ran out of gas.

You have an array of options: semicolons, colons, dashes, and words such as “and” and “but.” You can turn independent clauses into dependent clauses. But you can’t jam two sentences together with a comma.

When you do, my opinion of and trust in your work goes down.

This is not, by the way, some prissy thing about proper manners. Fuck that shit. I’m not trying to squash your voice. This is about quality and trust.

(For more information, see Comma splice on Wikipedia.)

14 Aug 2013

Archive

Ads via The Deck