Keep it Separated: Dashes or Underscores? [SEO]
At work we are reworking our coding guidelines to be more consistent and what not. We've standardized a lot of CSS classes, naming guidelines, etc. but we spent a bit of time discussing whether an underscore or a dash is better for separating words in our code.
After talking about it amongst ourselves and doing some quick Googling, this is what we decided:
For file names and paths, use dashes because most search engines (Google included) treat dashes as separate words. So "monkey_wrench" gets indexed as "monkey_wrench" but "monkey-wrench" gets indexed as "monkey wrench." Similarly, in code editors usually they will highlight the entire phrase if it includes underscores on a double-click while they will only highlight the selected word if it is dashed, which I prefer.
For variables, or anything that does not really need to be indexed, you can use whatever you see fit (note: most languages don't allow dashes in variables/functions).
If you have any thoughts or disagree, please share it in the comments.