What’s in a name?

…or why “my” is not a valid prefix for a variable

While I’m greatful for examples like this J2Me GameCanvas example I’m not so happy about this bit of it:

/** Starts the canvas by firing up a thread
*/
public void start() {
Thread myThread = new Thread(this);

// Make sure we know we are running
running = true;
done = false;

// Start
myThread.start();
}

What’s wrong ? Quite simply ‘myThread’.  You see the ‘my’ prefix used in code all over the web – it’s extraneous… extra noise, you may as well add ‘the’ to the beginning of every variable.

Variable naming is to a certain extent a matter of taste; a lot of people would say that it is worrying about nothing. The problem is, that most of the time spent with code is reading it, not writing it; as such we should try and be as succinct as possible ‘my’ adds absolutely nothing here.

In the example above it would be better to either leave out the ‘my’ or call the thread canvasThread.

 Fuzzy

Where possible variable names should reflect what you want to use them for, if your naming is fuzzy then others will use them for things you did not intend and then your on the downward spiral…

This is the other crime in variable naming, over generalising… quite often you see variables called ‘data’ when the name of the type would do fine… usually it is only in IO based applications dealing with arbitrary data that the name is appropriate.

Of course, if you can’t think what to name them, then don’t pad them out as well, it’s pointless.

My my my

A quick search on coders (excluding mysql) finds 301,040 hits for ‘my*’.

That’s a lot of noise… stop the madness: ban ‘my’ now… if microsoft can remove it from Vista, how difficult can it be?

Date for wine 1.0 release announced

The Wine project has been going since 1993, and has got to the point where a large percentage of windows programs run well in linux.

A perennial question is when 1.0 will be released, excitingly it looks like this will be sooner than we thought – as seen from their mailing list today:



Paul Vriens <paul.vriens.wine at ??????> writes:

> Just noticed that the dates attached to the versions on
> http://wiki.winehq.org/WineReleasePlan are not correct.
>
> 0.9.58 came out on March 21st.
>
> Does this mean we still stick to May 9th or do we stick to 0.9.61 as being
> 1.0.0.rc1?

We should stick to May 9th, we'll just have to wait for this date to
coincide with a release. If my calculations are right this should be
release 0.9.218 on May 9th, 2014. Hopefully we can clear the 1.0 bug
list by then.

--
Alexandre Julliard