Can we come to an agreement?
There were days where JS, CSS and Ruby programmers where each other sat in different tables and in each table we were using different naming convention and it was not a problem.
Well, times have changed, and now there is not three tables any more, we have put the three tables side by side building an only one web developer table, but we still keep the three different naming convention. Which is very damaging for our flabby brain.
I’m moving my text editor from the CSS file to the JS file and back to the Ruby one, and I have to say that my tab changing is very much faster than my mental change. If naming things wasn’t hard enough now we have to switch continuously between formats.
- CSS: variable-name (hyphen case?)
- JS: variableName (lower camel case)
- Ruby: variable_name (snake case)
And when I start seeing things like this:
$( ".time-ini" ).html( this.timeIni ) ;
I feel very nervous. So please let’s come to an agreement, what about a non-binding poll for starting:
I’ll really would like seeing someone with community authority telling something about this.
Note: I know the variable-name option is not possible in JS neither in Ruby but I keep it in the poll for consistence with the article.
Note2: Also I know that the CSS attributes will remain variable-name style, and there is not much we can do about this.

Julio 26th, 2012 at 1:12 pm
Hi there,
I’ve got a couple comments regarding this.
The first one is that the “variable-name” syntax is valid on css, but not on ruby or javascript (as well as most non-lisp-based programming languages). So using the first option is not possible.
On the other hand, I would not feel very comfortable if the three concepts were named the same way; at least not if the codebase is non-trivial.
Variable names are representatives: they represent an abstract concept. While two different variables can represent the same concept, they can do so in different ways; the concept represented might be the same, but the *representatives* might be different. In that case, using the same name might not be a good idea.
For example: you (as a person) can be represented by our passport number, a picture of you, or your lawyer. But every one of those “representatives” works very differently from the others; each of them has its own rules of use, and its own context.
To me, the same happens with CSS ids/classes, javascript variables and ruby variables. Once the source code is big enough, I find that having a different separator policy for each makes the code a bit easier to work with, since the differentiation can be done by looking at the variable names alone.
In fact, I remember having fought this “same-nameness” when I have a one-word concept to represent. I had a ruby variable called, “employee”, and I called the css class “employee-item” and the javascript variable “employeeNode” or “employeeInstance”.
I don’t follow this rule strictly, though. On this case, ruby had to generate a chunk of javascript and html with the right css classes, and I found that having everything called “employee” made it a bit less clear. I am happy to use the same name for the three representatives if all I need is a one-liner inside the jquery initializer.
Regards!
Julio 27th, 2012 at 3:43 pm
@Kikito very interesting reflexion. I see the point of keeping different names of variables in each different “world”, even I don’t absolutely agree with this I can understand to name the Ruby concept as “employee”, the CSS concept as “employee_item”, and the JS concept as “employee_node”, What I don’t understand is why we have to use different “naming formats”. It is not only you can use different names the problem is you have to use “camel case” in one side, “snake case” in other and so on.
Marzo 21st, 2013 at 7:02 am
Hi there, I found your site by the use of Google whilst looking for a related topic, your site got here up, it seems to be great. I have bookmarked to my favourites|added to my bookmarks.
Abril 8th, 2013 at 3:54 am
If necessary, end your wash routine with one more cold
water cycle to rinse every one of the detergent from your diapers.
I learned the delicate balance between assisting being a caregiver and
allowing independence and making decisions for my dad.
Abril 10th, 2013 at 11:12 am
However, if you are concerned that you might act to them, please discuss them
with your doctor or perhaps a mental health professional.
Great gifts for dad might include a unique daughter and father matching
outfit.
Abril 16th, 2013 at 6:56 pm
Get Free 17 Page paleo diet Report Now! Many of the health benefits of the Paleo Diet claim
these new foods are responsible for most of the anti nutrients toxins.
I take my lunch to work every day and so does my child, so this may also be triggered by
the consumption of foods humans evolved eating during the Paleolithic era.
MaelnQ: I wanted to bridge the gap between them filled with
a material whose color matches the body — yet more
evidence of bone demineralization activity.
my page; paleo diet free
Abril 17th, 2013 at 1:03 am
Right here is the right webpage for anybody who wishes to find out about this topic. You realize a whole lot its almost tough to argue with you (not that I actually will need to�HaHa). You definitely put a brand new spin on a subject that’s been discussed for a long time. Great stuff, just wonderful.