I've been using underscore_case for about 2 years and I recently switched to camelCase because of the new job (been using the later one for about 2 months and I still think underscore_case is better suited for large projects where there are alot of programmers involved, mainly because the code is easier to read).Now everybody at work uses camelCase because (so they say) the code looks more elegant .What are you're thoughts about camelCase or underscore_casep.s. please excuse my bad englishEditSome update first: platform used is PHP (but I'm not expecting strict PHP platform related answers , anybody can share their thoughts on which would be the best to use , that's why I came here in the first place)I use camelCase just as everibody else in the team (just as most of you recomend)we use Zend Framework which also recommends camelCaseSome examples (related to PHP) :Codeigniter framework recommends underscore_case , and honestly the code is easier to read .ZF recomends camelCase and I'm not the only one who thinks ZF code is a tad harder to follow through.So my question would be rephrased:Let's take a case where you have the platform Foo which doesn't recommend any naming conventions and it's the team leader's choice to pick one. You are that team leader, why would you pick camelCase or why underscore_case? p.s. thanks everybody for the prompt answers so far
Naming conventions: camelCase versus underscore_case ? what are your thoughts about it?
naming
I agree that it depends on the language you're using to some extent; code tends to look neater when your symbol names follow the same formatting regimen as the language's built-ins and stock libraries.But where there's a choice, I prefer underscores to camel case, for one simple reason: I find that style easier to read. Here's an example: which do you find more readable? This:aRatherLongSymbolNameor this: a_rather_long_symbol_nameI find the underscore version much easier to read. My brain can ignore the underscores much more easily than it can detect the lowercase/uppercase boundaries in camel case, especially where the boundaries are between glyphs that look similar to other glyphs of the opposite case, or numerals (I/l, O/0, t/I, etc). For example, this boolean variable stores a value indicating whether or not an Igloo has been built with proper planning permission (undoubtedly a common use case for us all):isIllicitIglooI find this version a lot easier to read:is_illicit_iglooPerhaps even worse than a hard-to-read symbol name is an easy-to-misread symbol name. Good symbol names are self-documenting, which to me means that you should be able to read them and understand their meaning at a glance. (I'm sure we all read code print-outs in bed for pleasure, but occasionally we grok in haste, too.) I often find with camel case symbol names that it's easy to mis-read them and get the wrong impression of a symbol's semantics.