My intention with this poll was to be kinda vague, so that people would respond about what they like the best instead of thinking of one particular instance of usage. Usage could be where ever you need to manually name something: CSS classes and ID’s, programming function names, file names, usernames and passwords, basically anywhere you can’t use, but benefit from simulating, spaces.
Turns out the vagueness was problematic. For example, you might love hyphens (I do), but you can’t use hyphens when naming PHP functions. The poll results would have probably been more useful if it was limited one one particular language. Ah well. Inherent flaw aside, camelCase took the win at 45%, and hypens edged out underscores for 2nd place, 28% and 27% respectively.
New poll in a few days.
Wow, im one of the camelCase+hypens when possible, but i would bet on the underscores, i find so many script with them!
I use camelCase for CSS and programming all the time, I think it looks the nicest.
I see a fair few people agree ^_^
Ah crap, I’m in the minority…for some reason I can’t stop using underscores.
this_is_the_type_ftw! (oh, especially for PHP)
I use hyphens for CSS, and underscores when I’m writing function names in PHP and Ruby on Rails projects. And in Rails, I have to use CamelCase for class names. So I actually use all three equally, but I feel under_scores look most readable.
Surprising results, as you mentioned it would be interesting to see the brake down by programming language.
I use _underscore for css/js/php/html . CamleCase for action script.
camelCase for everything!, it saves a Byte everywhere :P
Indeed the waters were quite muddied with this poll as many people have different preferences for different languages (I use hyphens in HTML classes/IDs, but underscores and camelCase in JS and PHP).
I’m looking forward to the same “Hyphens, Underscores, or camelCase?” poll strictly for HTML class/ID names.
People have their own standards which is nice to see.
For me, hyphens for CSS, underscores for PHP but I use camelCase for functions in both PHP and JavaScript.
Mostly because it looks nice. Oh and hyphens for file names as well, unless it’s being included/used via PHP, then it’s underscores.
Shouldn’t it be “peopleLikeCamelCase” ;)
haha, good catch!
not for methods!
I like the hyphens the most, but since I can’t use them everywhere, I go for underscores for everything except JavaScript function names, where I use camelCase.
I use camel case for PHP and JavaScript, underscores for MySQL database tables, hyphens for CSS… Cheers :)
camelCaseEver.
Hyphens (where usable) win easy for me, because they’re fastest–no shift key.
CamelCase… Not so long ago I was sorta split between using CamelCase and hypens I wasn’t in particular for the one or the other… But after having installed the newest beta branch of Chrome for some time ago, I chose to use CamelCase since all css-classes with hypens ceased to function.
Shift key = bleh
I use hyphens whenever possible, but when I can’t, camelCase if possible. Hyphens have better readability than camelCase, and less keystrokes than underscores.
this-poll = 9 characters, 9 keystrokes
thisPoll = 8 characters, 9 keystrokes
this_poll = 9 characters, 10 keystrokes
Hyphens whenever possible. I really hate having to be case sensitive. I use hyphens for all my URLs and stuff too :)
CamelCase forever :) Looks cooler :)
I use all three in different situations:
For CSS class names, I always use a prefix and hyphens. So if I’m coding up a site that’s called “super awesome funtime” I would make classes like “saf-header”. I picked up the prefix thing from YUI’s CSS files, as I make a lot of YUI-based widgets, and I find it is a great practice for keeping things organized in mashup environments.
I use camel case for function names when programming, for example regularMethod() and ConstructorFunction().
In some special cases I will use underscores, but I tend to find them ugly and so I avoid them. In PHP, for instance, I will use underscores to group related constants. Being in all-uppercase by convention, PHP constants are already ugly as it is. :) In other situations where you might use underscores to group like variables, I tend to just use a hash of values instead.
I tend to use hyphens for URLs, underscores for file names. Don’t use camel case for much but I’m sure I’ll find a use for it somewhere eventually.
I usually use CamelCase for most situations, PHP/JS/ActionScript/C…
Actually I’m using hyphen on CSS for my new blog template.
Underscores I use mostly on filenames (photography) or in some special cases on PHP.
Sometime ago, I used underscores in C for arguments variables, but I discard that habit…
Let’s see if it goes well :)
I use all caps for everything. If I run into a name collision, I’ll reverse the name for the second occurrence. If I run into a 3rd, I’ll append a number to the end. If a 4th, I’ll reverse the 3rd, but increment the number by one at the end. Sometime I’ll throw in French.
I’m with Mario, being a Java programmer by profession – I use camel case for Java, PHP and JavaScript, underscores for MySQL database tables, hyphens for CSS.
Poll was too vague as you said. :)
I’ve got to say that I use hyphens for URL’s and CSS classes but definitely underscores for PHP (although, I’m really starting to like CamelCase for PHP).
I find though that I am at a crossroads right now. I think we all try on different ways to code/program and I’m at that place where I’m examining different procedures to complete tasks.
I use CamelCase. Well useful stats.
hypens for css. camelCase for PHP and JavaScript
camelCase for programming (JS, PHP) and css class names unless its a constant name, then its all uppercase with underscores.
underscores for SQL names (I like using upper case for SQL commands and lowercase for my table/column/view/stored proc. names)
i use hyphens for css id’s and form element names as it makes it easier to split them in JS/PHP, so I can add complex heirarchical ownership into the id/names. I’ve even had to use hyphens and underscores when I had to dynamically match table/column names within form element names.
I think underscores are probably most readable, but it depends on the genius of the language what I’ll actually use. In general I try to mimic the language I’m using. So:
* Hyphens for Lisp.
* Underscores for Ruby, PHP, Perl, etc.
* camelCase for Java, JavaScript, C, Ruby class names.
CSS…well…I usually use hyphens or underscores. But these days I’m dynamically generating most CSS with Sass, usually in a Ruby context, so I’m thinking more of Ruby aesthetics than CSS aesthetics anyway.
I use TitleCase… You should’ve included it in the pool..hehehe… I voted for camelCase.
^ Sorry typo error: I mean “poll” not “pool”..hahaha
camelCase for programming / css & hyphens for search-engine-optimization. I wish everyone was like that.
Hyphens and underscores are extraneous, since capitalizing the first character of each word in the name is sufficient to delimit them. Arbitrarily uncapitalizing the first word in the name as in camelcase is stupid and makes no sense. However, I preface the name with one or more prefixes and make them all lower case to differentiate them from the name – for example, fldintProductId is a field of type int and its name is ProductId, stylLeftColumn is a css style called Left Column. This convention is applicable regardless of dev environment or language. Thus, unlike everyone else, I use camelcase for a reason that does make sense and that is not stupid. I think.
What I use:
– camelCase for all object-oriented programming (C++, JavaScript, Java, Ruby, PHP classes)
– uderscores for procedural programming (PHP functions)
– hyphens for HTML and CSS (classes and ID’s, HTML filenames, URL’s)
This seems to be fairly standardized, so why buck the trends?