Take the 2-minute tour ×
User Experience Stack Exchange is a question and answer site for user experience researchers and experts. It's 100% free, no registration required.

I know there are a number of ways to prevent users from entering illegal input: disabling buttons, showing warnings, and other solutions that fit the domain of the problem. However, the usual practices in software and web apps do not feel right if we consider something very simple - for example, a calculator app for a smartphone. Here's the situation:

A user enters 5, 0, and / (this is a reverse Polish notation calculator). This translates to 5 / 0, and is thus an illegal operation. Now I could introduce a physical constraint (disable the / button in my app), ensuring that division by zero becomes impossible. However, this is not how actual calculators work. From what I remember, some of the common calculators return 0 in such a case or indicate an error somehow. And then - depending on how good the device is - the user can either recover from the error or has to reenter everything. This becomes a bit more complicated in the case of RPN calculators - the result of any operation is put on top of the operand stack so that the next operation can use that result right away. Therefore, returning NAN, for example, would mean that no operations can be performed until legal operands are entered. Returning 0 in this case sounds like a better idea, but what if it confuses the user into thinking that, e.g., sqrt(-1) = 0?

So my question is then as follows: what would be the most appropriate way of dealing with illegal operations in a simple calculator app for a smartphone? Would it make more sense to return 0 (sounds most reasonable), NAN (complicates things), or disable illegal operations (reasonable, yet deviates from user expectations and experiences with real calculators)?

share|improve this question
    
is this comparable to a scientific or just a basic calculator? –  jberger Jan 24 '12 at 18:25
    
Show Error. but provide recovery options such as access to history of recent results in order to be able to retrieve something on the stack that was calculated via multiple operations. Note that this would be useful in a calculator anyway! –  Roger Attrill Jan 24 '12 at 18:47
    
@jberger basic. –  ernes7a Jan 24 '12 at 19:06
    
show error, don't put value in operand stack..? ("0" is a wrong answer, and normal people don't know what "NAN" means.) –  jberger Jan 24 '12 at 19:15
add comment

2 Answers

up vote 7 down vote accepted

You're building a mobile calculator app not an actual calculator. Your output format is limited only by the number of pixels you allocate for the output area. Thus, why would you not provide helpful error messages for illegal operations? The default calculator in Windows 7 already does that:

divide by zero square root of -1

Since the basic layout doesn't support i the application returns the respective error message.

You can go a step further and make the error messages links to help info explaining the mathematical rules for such cases.

share|improve this answer
    
I was just formulating a similar response, so I'll be upvoting your answer. +1 for the screenshot :) –  jcmeloni Jan 24 '12 at 18:35
    
@jcmeloni: To be honest, this questions is such a soft-ball that I didn't expect to be the first one to respond. –  dnbrv Jan 24 '12 at 18:41
    
"Your output format is limited only by the number of pixels you allocate for the output area" - I would be inclined to disagree. My output format is limited by the type of the app, in this case defined as a simple/basic calculator. So I don't see how linking to mathematical rules would make sense. Providing error messages sounds like a reasonable suggestion, though. –  ernes7a Jan 24 '12 at 19:11
    
@ErnestaOrlovaitė: Your output is presented on an high-res LCD as opposed to old-school LED displays, which could show only a limited number of characters. Once the app returns an error, the text (like Cannot divide by zero) can be made a clickable link to either internal help or some website. –  dnbrv Jan 24 '12 at 19:19
add comment

I have owned real calculators that outputted something "-E-" if you try to perform an illegal operation (e.g. (-1)!).

Of course, modern real calculators have better error outputs and an app can output anything.

I have always thought that the (Reverse) Polish notation is not a good user experience.
- Why not enable a more natural input?

Even real calculators (e.g. Casio FX-991) are progressing to more and more natural inputs and outputs from (calculator) generation to generation.

Smart phones are supposed to be smart, not dumber than a calculator.

share|improve this answer
    
A smart smartphone calculator would allow you to switch between RPN and infix notation so that you have the option. –  Roger Attrill Jan 24 '12 at 18:50
    
I don't think that anyone would choose to use the RPN or PN, therefore implementing it would be a waste of time and of phone storage (extra code = larger app). Even Microsoft has/had a "PowerToy Calculator" that enables natural input. –  Danny Varod Jan 24 '12 at 18:59
    
The option that allows switching cannot be defined as a "a simple calculator app for a smartphone". And it's not a question of whether anyone would use RPN. The issue is a more conceptual problem of how to deal with illegal user input when 1) the app is to be very simple, and 2) when the app closely resembles a real world item that has specific rules and experiences attached to it. –  ernes7a Jan 24 '12 at 19:05
1  
As I said, real calculator do have error messages and trying to imitate their constraints makes no sense. –  Danny Varod Jan 24 '12 at 19:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.