18

I have seen so many people on Stack Overflow (mostly those sloppy people who make a lot of grammatical/spelling mistakes) putting a space before punctuation, especially before a question mark. Is this a widely spread habit shared by programmers?

9

In some languages, like French, it is required and carried over into English by some users.

I am not aware of any research into this topic. One can speculate it comes from the use of command-line interfaces where parameters are separated by spaces. Forgetting to separate by a space leads to angry error messages and the anxiety this causes carries over into written English.

| improve this answer | |
  • I see. That can be one factor. But I also see people who seem to be native English speakers doing it. – sawa May 14 '11 at 8:34
  • 2
    @sawa: low quality English is the norm in some Internet sub-cultures. Even my Polish colleague, who has a Ph.D. in biochemistry (and know how to write proper English), use this hard-to-read English in email. But it is a lost cause to try to change such habits. – P.Mort. - forgot Clay Shirky_q May 14 '11 at 8:50
  • I understand that, but I can usually distinguish a sloppy English native writing from low quality English written by non-natives. They both make mistakes, but the quality is different. In majority of the cases, it does not seem that putting a space before question mark is due to being a non-native speaker. Some cases may be, though. – sawa May 14 '11 at 8:53
  • 8
    I disagree with your speculation. A punctuation mark at the end of a sentence would no more be a "new parameter" than would a trailing slash at the end of a directory path. If anything, using a CLI would train users not to insert superfluous spaces! – Cody Gray May 14 '11 at 9:08
  • Edits appreciated ;-) – GhostCat Oct 7 '19 at 13:57
13

Quoted from about.com

Two-part punctuation marks In French
a space is required both before and after all two- (or more) part punctuation marks and symbols, including : ; « » ! ? % $ #

| improve this answer | |
  • 3
    I see. Maybe that can affect their English. But, I still don't think that the majority of people doing it are native French speakers. By the way, thanks for the quote. I didn't know that. – sawa May 14 '11 at 8:38
1

I occasionally add a space before punctuation to avoid confusion. For example, "I dislike String#upcase!, but I really like String#upcase !".

I'd say it's not so much common with programmers, but any user generated content on the Internet, especially that written by idiots. You'd probably see it with YouTube comments as well. I asked a similar question on Japanese Language and Usage: Is Japanese that lacks proofreading likely to contain bad spelling or grammar?.

Bad English must be chotto muzukashii when you yourself have put a fair amount of effort into learning the language, ne?

| improve this answer | |
  • 1
    You might think that avoids confusion, but I have no idea what that sentence says. – Cody Gray Apr 13 '12 at 0:44
  • @TheEstablishment edited accordingly. – Andrew Grimm Apr 13 '12 at 0:50
  • 2
    So, what you actually mean is: "I dislike String#upcase!, but I really like String#upcase!" :-) – Cody Gray Apr 13 '12 at 0:51
  • Yes. That's the feeling I have. – sawa Apr 13 '12 at 1:02

Not the answer you're looking for? Browse other questions tagged .