Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

A Modest Usability Improvement

Us­abil­i­ty is a hot top­ic on KDE­land. Al­most ev­ery­one who reads this will have seen, one time or an­oth­er, ar­ti­cles with ti­tles like What Lin­ux Needs To Win On The Desk­top Wars or some oth­er sim­i­lar non­sense.

I say non­sense be­cause there is no war, and if ar­ti­cle writ­ers are so clever they would be ac­tu­al­ly writ­ing soft­ware that could win such war. And that in­cludes me. Hel­l, I am not that much of an ar­ti­cle writer, (or that much of a pro­gram­mer, for that mat­ter).

How­ev­er, I know this: code beats word­s. Think­ing beats not think­ing. Of­ten, to think right, you have to start from noth­ing.

So, I start­ed think­ing... what is the worse pos­si­ble pro­gram in all of KDE, us­abil­i­ty-­wise? And the an­swer is prett­ty ob­vi­ous. The cal­cu­la­tor. And what can I do about it? Write a cal­cu­la­tor that makes at least some sense.

But wait, you may say, the cal­cu­la­tor? Who us­es that thing? Prob­a­bly noone, be­cause it´s a pro­gram that makes no sense. It´s a clone of a pro­gram that made no sense in the first place.

How wrong is the cal­cu­la­tor? Let me count the ways...

/static/kcalc1.png

1. The finger emulator

Q: Why so many but­ton­s?

A: Those are the cal­cu­la­tor but­tons

Q: What hap­pens when I press the 1 but­ton?

A: It in­puts the num­ber 1 in­to the cal­cu­la­tor.

Q: Oh, cool. But why not use the nice, 3D but­ton made of plas­tic with the num­ber 1 I have in my key­board?

A: You can use that but­ton

Q: So why is the but­ton on the screen?

A: It serves no use­ful pur­pose what­so­ev­er.

Yes, the cal­cu­la­tor´s most ob­vi­ous mode of op­er­a­tion (click­ing on the wid­get­s) means you use your mouse and point­er to em­u­late a fin­ger, click­ing on em­u­lat­ed cal­cu­la­tor but­ton­s. Oh, sure, the em­u­lat­ed fin­ger is 10x slow­er and 20x less ac­cu­rate than your ac­tu­al fin­ger click­ing ac­tu­al keys, but hey, it makes it look like a cal­cu­la­tor! Which re­minds me...

2. The keyboard-in-a-window

It´s usu­al­ly ac­cept­ed that a tool­bar with 20 items has at least 8 too many. The kcalc win­dow shows 33. In the sim­ple mod­e. On the oth­ers it shows many more. You just should­n´t put 30+ but­tons in a win­dow un­less you have a very good rea­son. But that´ s not the re­al prob­lem. The re­al prob­lem is...

3. It acts like a calculator

You can see a MR but­ton. And a M+ one. And sev­er­al oth­er­s. If you haven´ t ev­er learned what those do, they are the in­ter­face to the cal­cu­la­tor´s mem­o­ry stack.

That is very use­ful in a cal­cu­la­tor, be­cause it means you can do things you us­al­ly can´ t, like 2*(3+3).

Let me quote the KCalc hand­book on the sub­jec­t:

Crickets chirping

Yup. It´s not even doc­u­ment­ed. Be­cause you are sup­posed to know how to do it from us­ing a re­al cal­cu­la­tor, I sup­pose. So, for 90% of the user­s, those but­tons are just dec­o­ra­tion. MInd you, this is not a crit­i­cism of the doc writ­er­s. A good rea­son not to doc­u­ment it is that it´s a use­less fea­ture and their time is lim­it­ed.

We are us­ing, to em­u­late this 1960s piece of hard­ware, a freak­ing com­put­er. You know, a cal­cu­la­tor usu­al­ly has about 1024 mem­o­ry lo­ca­tion­s. Your com­put­er has prob­a­bly over 128 mil­lions. And draw­ing one of those cute but­tons us­es a cou­ple thou­sands of them.

In fac­t, let´s try some­thing more rad­i­cal: your com­put­er´s key­board has paren­the­ses in it. You know, the­se? () ? Those are used to group op­er­a­tions. So you don´ t have to use a cal­cu­la­tor-­like mem­o­ry. And you can tell your com­put­er to re­mem­ber things. Hel­l, you can tell your com­put­er to reemm­ber ev­ery­thing.

4. It´s not the right kind of calculator

Ev­er seen a tick­et-­tape cal­cu­la­tor? Those are rather more ex­pen­sive than the sim­ple LCD-­type stuff kcalc em­u­lates. They have a roll of pa­per, and what­ev­er you do, it prints. That way, you can lat­er check what your pre­vi­ous op­er­a­tions were, and what their re­sult was. Usu­al­ly, you are lim­it­ed some­what be­cause it us­es pa­per. But we have a com­put­er with mil­lions of bytes of mem­o­ry. We can have a prac­ti­cal­ly in­fi­nite tape.

So, kcalc is not on­ly em­u­lat­ing a cal­cu­la­tor when it does­n´t have to, but it al­so is em­u­lat­ing the wrong one.

Let´s get constructive

Here you can find Use­calc. I wrote it in 20 min­utes. It´s a much nicer cal­cu­la­tor. It us­es PyQt, so you need that if you want to try it, but even if you don´t, look at the screen­shot.

/static/usecalc1.png

The thing that jumps up at you is, of course, that it does­n´t look like a cal­cu­la­tor. Re­mem­ber, that´s good.

Here´s the man­u­al:

  • Type what you want cal­cu­lat­ed on the bot­tom.
  • Re­sults and er­rors come up at the top scroller.
  • You can get back any­thing from the scroller by dou­ble-click­ing in it.
  • The sup­port­ed op­er­a­tors are the usu­al, plus paren­the­sis, and ** which is pow­er. If you want a square root, just use **0.5. If you wan­t, I can add some­thing more ob­vi­ous.
  • Lots of oth­er things work, since you can use (some) python code in it.

And that´s that.

I dare any­one say this cal­cu­la­tor is not more us­able than kcalc ;-)

Sure, any­one can take kcalc and use it right away. But if you want to ac­tu­al­ly use a cal­cu­la­tor, Use­Calc is a bazil­lion times bet­ter, IMHO.

Bugs

  • It us­es python´s eval() so it´s prob­a­bly un­safe as hel­l.
  • I am not sure the right-jus­ti­fi­ca­tion for re­sults and er­rors is a good idea.
  • If you want float­ing point, you have to use float­ing point. For ex­am­ple: 5/2=2 but 5/2.=2.5
  • There´s some­thing wrong with the width of the QListViewItem­s. Try 2**500 with a small win­dow and see.
  • Such a sim­ple tool should re­al­ly be writ­ten in C++ so it starts quick­er.
  • I wrote it in 20 min­utes (15 to get the QListViewItems to draw them­selves fan­cy). So it´s re­al­ly just a hack I don´t in­tend to main­tain.

Conclusion

What can we learn from this? Well, I don´ t know about you, but I learnt that Us­abil­i­ty some­times means throw­ing away stuff. And that some­times re­plac­ing some­thing with a bet­ter ver­sion can ac­tu­al­ly be sim­ple. Use­cal­c´s code is about 1/100th of kcal­c´s (just guess­ing, Use­calc is 100 lines of non-­gen­er­at­ed code). A re­al ver­sion would prob­a­bly stil be 1/10th the size.

I al­so learned that cal­cu­la­tors are easy to write, if you drop all the bag­gage ;-)

(Ok, so I cheat­ed, I used Python ;-)

Links

  • Down­load Use­calc (It's 3.2K­B. Re­al­ly.)
Roberto Alsina / 2006-04-04 16:33:

Comments for this story are here:

http://www.haloscan.com/com...

employment background check / 2011-12-27 23:24:


Hi very nice article


Contents © 2000-2020 Roberto Alsina