News for hackers. Stuff that matters.
Re:The Art and Science of Great Code by jon6 on Thursday November 03, 2011 @07:41PM (#3194214)
Failure to use proper spelling in code is a cultural disease. Misspellings in English are looked down upon so why do we put up with it in code? Well I don't.

The authors code examples go back and forth between spelled correctly and not spelled correctly so I'm not quite sure what hes advocating. Figure 13 is especially hilarious.

pload: I have no idea what 'p' is

qload: I have no idea what 'q' is

numBuses: should have been busCount probably

numTransLines: what is 'trans' ?

systemName: ah a good one!

gens: should have been generators but even in that case its basically useless. I already know its a vector of Generators, what is its higher level function?

transLines and buses: same as 'gens', just a name of the type.

Re:The Art and Science of Great Code by gambler on Thursday November 03, 2011 @09:25PM (#3194528)
I couldn't agree more.

Take any book you haven't read that is openly available online. Remove all vowels in worlds longer than 4 characters. Replace commonly used words (like 'the') with your favorite abbreviation (like 'T'). Truncate extra long words (9+ characters). Then try to read it. Horrible, isn't it?

Reading abbreviated (or worse, one-letter) variable names is like translating from a made-up language.

Re:The Art and Science of Great Code by wcarss on Thursday November 03, 2011 @10:47PM (#3194750)
As a Teaching Assistant for a first year computer science course, I have actually been using the example of writing an essay and keeping within a page limit by randomly cutting vowels out of words and thinking up ways to abbreviate words which aren't meant to be abbreviated.

Everyone quickly agrees that it would be ludicrous to do that. By stressing over and over, "try to write code which anyone could understand at a glance", I think they're getting it. Glad to see some like-minded thoughts!

Re:The Art and Science of Great Code by humbledrone on Friday November 04, 2011 @04:24AM (#3195337)
Even worse than having to read weird abbreviated variable names is having to write them. You know the variable you want to write is something to the effect of "the number of buses", but then you can't remember if it's numBuses, nBus, nBuses, num_buses, or God knows what. It gets even worse when the original author starts dropping random vowels, so you have to guess nmBuses or nmBs or something horrible like that. Who knows what letters they decided to omit?

Much easier to just write out a clear, concise variable name with no abbreviations (other than those that are extremely obvious and common). Even if the variable names are a little longer, your text editor will autocomplete them (right?).