Long is good. Too long is too bad.
Steve McConnell tells us in Code Complete, that long variable names are good. I think it’s in the section on “Self-documenting code”.
In object oriented languages, you have the object name, the name of a possible sub-object, and the name of a particular field or item in the object, which all add up to a descriptive long name, but split into different parts.
mypack.special-effect.color = chartreuse
However, I have been working in Gnu Make lately. Gnu Make recommends that you only use numbers, letters, and underscores in Make, as other characters may be used for other special purposes now or in the future. Now, in Gnu Make, you don’t have real objects. You do have “constructed variables”. By using recipes with wildcards in them, and constructing variable names with pattern substitution, you can get some of the same effect as objects. However, the variable names look kinda ugly.
testset_special_effect_color = chartreuse
Its easy in make to get a few lines like the following. The intent here is to make a copy of one pseudo-object that will only be used when code coverage is in effect:
# Initial special effect setup regression_mypack_special_effect_targets = \ testset_chartreuse \ testset_bland \ testset_monochrome regression_mypack_special_exec = mypack_special_exec # copy for code coverage regression_mypack_special_effect_ccov_targets = \ $(testset_mypack_special_back_targets:%=%_ccov) regression_mypack_special_back_color_iterations := 4
My problem was that I copied the variable name wrong. In line 8, I wanted to make a copy of the list of targets, with the names modified to be the ccov version of the targets. The difference is nearly invisible in the middle of the long variable name.
Verbose, clear variable names are an important part of self documenting code. Monotonous names with only underscore separators make that hard. Yet another reason to avoid “make” for complex projects.
There was a lot of activity at the OGRE meeting tonight, including knowledgeable questions and answers, and a great video setup in a meeting room at Jaded Pixel Technologies (Shopify).
John Duff demonstrated the Devise authentication framework with Facebook.
Jonathan Sutherland was persuaded to show off his Rails-based real estate agents’ web site.
This is a monthly meeting of Ottawa Group of Ruby Enthusiasts’ (OGRE). This group attracts a broad range of presentations and attendees, resulting in a very interesting evening.
See: Review: Code Factory meeting space for info about the Code Factory space.
There were about 18 people, including three of us who arrived later than 6:30pm. When I arrived at 6:35 or so, it appeared that the meeting appeared had started on time. It looks like most people arrive for networking soon after 6:00pm.
There may have been a couple of company owners there from Ruby-centric companies like Shopify, but most people there were developers with experience ranging from a couple of years or less to about 20 years or more.
The OGRE group has an active mail list. The next meeting is announced on the list and there are technical discussions regularly.
There were two presentations. Don Kelly’s presentation on LLVM and Treetop was about the esoteric technical area of writing your own language using Ruby-based tools. Julie Hache spoke on updating Ruby on Rails from 2 to 3, why and how.
The presenters spoke clearly and enthusiastically about their topics. Their technical knowledge was obvious. In both cases, their presentations were accessible to someone with limited Ruby experience, as well as experienced Ruby developers. This was partly because they were both competent presenters.
There was a community announcement from someone working on the “Hobo” framework which extends Rails.
The meeting started on time and ended at a reasonaable time near 8:00pm.
About 8 people got together at Darcy Magee’s. It took a few minutes for them to arrange a space for the group, but I don’t think anyone had contacted them in advance. The cost was reasonable. The service was prompt and courteous.