Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I struggled with making this decision, but ultimately it's all about readability for me. Hope it's not too much of a hassle for folks, but that's why this happens in a major update and not minor ones :).


I like the human-readability that dashes lend to URLs, but there are two things that bother me about using them in this case:

1. A dash is an operator, which could get confusing when you are doing math. For example: (@grid-gutter-width * (@grid-columns - 1)).

2. As far as variables go... thisIsDoubleClickable, and_so_is_this, but-this-is-not. I suppose it's not the biggest deal in the world, but I really hate having to drag my mouse to select.

My two cents...


Yea this is an age old discussion, I also like the separation that dashes or underscores give. Personally I'm a fan of underscores myself, mostly because I can then have id="foo_bar" #foo_bar and $foo_bar, for html, css, and jQuery variables, respectively, and remembering that JS can't have dashes in variable names. This makes the double clickable aspect super handy to me :)

Sometimes I hear that people don't want to have to press shift, which is understandable considering how much we code. But if bootstrap devs are already pressing shift in order to use camelCase, I wonder why they didn't pick underscores.


This is my general rule: If it's client-facing (eg. a URL) then use dashes - it's more readable (at least I feel it is). If it's developer-facing, use underscores or camel case. Sure it's not as pretty, but it's functional - which is really what we need. This boils down to - do whatever is best for the user.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: