Over a million developers have joined DZone.

Why MessageBox.Show() = Fail!

· Java Zone

Learn more about how the Java language, tools and frameworks have been the foundation of countless enterprise systems, brought to you in partnership with Salesforce.

In a recent post I stated that:

"[h]aving "MessageBox.Show()" in your code is almost always an indicator of a poorly designed interaction or notification and contributes to a poor user experience."

There was some debate in the comments about why or how I can claim this.

My aim with this statement was to summarise that post and another I'd written the day before about UX.

Here's 4 reasons why "MessageBox.Show()" sets my code senses tingling:

  1. You're likely asking an "ok/cancel" question which is therefore probably poorly worded.
  2. A message box is the laziest way of displaying information or a question. If you're displaying information in the laziest way possible I don't have confidence that you've created the best experience for the people using the app.
  3. You're showing a modal dialog. Modal dialogs are lazy and often unnecessary. Just because you have something you want to say to or ask of the user it doesn't always follow that they should be interrupted for you to do this.
  4. The standard MessageBox uses the systems default styling and can't be overridden. If you are using your own styles or colour scheme in the app then the MessageBox may end up standing out like a sore thumb when displayed.
Hopefully that makes the reasoning behind my statement clearer.

Yes, despite all this you may still want to use it. Yes, you may have a scenario where it still makes sense to use it. Yes, you may not care what I think and don't see a problem with how it looks.

No, I can't stop you using it.

What I want to do is help you to create the best apps you can and I think this is a simple example of one way you can start to do this.

Discover how the Force.com Web Services Connector (WSC) is a code-generation tool and runtime library for use with Force.com Web services, brought to you in partnership with Salesforce.

Topics:

Published at DZone with permission of Matt Lacey, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}