Click here to monitor SSC

Dan's Blog

Software Engineer - Red Gate Software

Wing Dings

Published Tuesday, November 22, 2005 6:49 PM

Occasionally when developing software you come across really absurd or bizarre bugs. The user interface for the application I'm currently developing recently exhibited one of these: a propensity for beeping periodically, for no readily explicable reason. To be precise, not so much a beeping as a "ding"ing.

Now like most software developers, I work in an environment where workstations don't tend to have speakers. People who do want to listen to music bring in headphones, and thus get to live in their own audio universes.

So it was only whilst idly listening to some music whilst testing the latest shiny new feature that I suddenly noticed that my otherwise quite pleasantly heavy soundtrack was periodically letting up from its relentless drumming and so forth in order to go "ding".

I've had this with MP3s before, usually after having employed rather low quality CD ripping software (by which I don't necessarily mean software that isn't commonly (mis)used for that little job on many thousands of PCs around the world). But I'd played these particular MP3s many times before without unnecessary "ding"age. They were tastefully "ding" free. Distressingly, I noticed that the "dings" corresponded quite closely with my mouse activity clicking bits of our application. The evidence was beginning to pile up.

I knew for a fact that I wasn't advertently causing anything to go "ding" in our user interface code. So I promptly took the dutiful approach that any professional programmer would take. After careful consideration I filed a bug report, assigned it to myself, and cheerfully moved onto shinier and easier ground.

However, since we've been getting close to showing off this application to the public, I've had to return to the land of "ding", grumbling and rolling up my sleeves.

I won't bore you with tales of endlessly commenting out bits of user interface code, rerunning the application, toying with it, hearing it go "ding", returning to my development environment (which also has a vexing habit of "ding"ing at me - and, mark you, a less soothing "ding" under the Windows default sound scheme than one exhibited by our application), rinse, repeat.

The upshot of this worthy investigation was that the offending "ding"s were being produced by a rich text box control. As and when we had occasion to ask it to not display anything at all, if it didn't mind, it would "ding". Under .NET, RichTextBox.AppendText (or more precisely, the SelectionText property invoked by AppendText) will "ding" if it's assigned an empty string. Which is exceedingly nice of it.

This "feature" does beg one question: why? It smacks of the kind of debug code one might leave in as a control author ("hmm, might be getting empty strings, better ding to make sure people are aware of it". But in .NET we have Exceptions for that sort of thing. There is a reason why our language doesn't natively permit the following:

try
{
    DoSomething();
}
catch ( Exception )
{
    ding;
}

Because it would be extraordinarily and vexingly pointless, not to mention pointlessly vexing. If I did write that sort of code, I'd expect the compiler to go "ding" when I tried to compile it, at the very least.

So I recall why, when setting up a new PC, the first thing I do is turn the system sound scheme to "quiet as the grave": the world is full of annoying applications that go "ding" at the slightest provocation. I'm happy to say that our shiny new application is no longer one of them.

Comments

 

Al Carl said:

Pleased you fixed it, the number of times I've seen (well heard) applications leave our developers without being tested with speakers is worryingly high. Like you say most development machines are without sound so it's easy done but very annoying from a user experience point of view.
November 23, 2005 5:03 PM
 

Pradeep said:

Hi Dan

Though I am not concerned about technical aspect of your post, however post is nice. I did like your use of ding for "sound" as well as for "application crash". Refreshing post.
November 24, 2005 12:58 PM
 

James said:

If you have programmed with Windows Forms for long it is most probable that you have come across one...
January 18, 2006 11:50 AM
You need to sign in to comment on this blog
<November 2005>
SuMoTuWeThFrSa
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910
How to Kill a Company in One Step or Save it in Three
 The majority of companies that suffer a major data loss subsequently go out of business. David Wesley... Read more...

Migrating from OCS 2007 R2 to Lync: Part 4
 Having migrated the rest of our users and legacy resources across, and start getting ready to... Read more...

Automated Script-generation with Powershell and SMO
 In the first of a series of articles on automating the process of building, modifying and copying SQL... Read more...

Seth Godin: Big in the IT Business
 Seth Godin has transformed our understanding of marketing in IT. He invented the concept of 'permission... Read more...

Using SQL Test Database Unit Testing with TeamCity Continuous Integration
 With database applications, the process of test and integration can be frustratingly slow because so... Read more...