On good UX
h
CodeLongAndPros (1370)

How to make a good user interface

While browsing repl talk #share, I found a lot of bad interfaces. Not mentioning names, but I want to correct this:

Program output:

KISS

Don't add all the frills unless required.
This means:

  • No TTYesque output.

        for c in str:
          print(c, end='')
          sleep(0.05)
  • No rainbow text

  • No pauses for interpolation

Be like clang

Clang, a C compiler, has some very good error messages:

t.c:1:1: warning: return type of 'main' is not 'int' [-Wmain-return-type]
void main()
^
t.c:1:1: note: change return type to 'int'
void main()
^~~~

It tells you what you did wrong, and how to fix it.

Some messages are bad:

Program input

Follow common practice

If you're making a shell/OSlike thing, don't:

  • Present the user with a menu
  • Make programs called ReadFileContents when cat works/
  • Get in the user's way. (Windows XP won't let you read the root of C:)

You should:

  • Have a help menu
  • According to The zen of python :

    There should be one-- and preferably only one --obvious way to do it.

Make it fast.

If it takes 30 seconds to install packages, the user will be mad when they look at your project.

Don't use Colorama when \033[0m will work

If you need to install 30 packages:

You are doing it wrong

Don't do fake loading.

If your program needs to read a long file, say so.

Don't do:

import halo, time
with halo.Halo(message="Loading OS"):
  time.sleep(2000000000)

UX

The user is dumb.

Design your app as if a five year old or Gilligan had to use it.

Assume they will enter invalid input
Assume they don't RTMP (Read the man pages)
Assume they use a command wrong

Respond to user feedback

If someone says 'I don't like the color of your giant ascii logo', fix it .
If people say your slow_print function is too slow, fix it.

Documentation is like salmon: when it is good, it is very, very good; and when it is bad, it is better than nothing

Document the *NIX out of your code. If you write a good post on how to use it, people will be more liberal with their upvotes.

If it's not good, it's better than none.

Please let me know if you have any UX feedback on this article.

$ logout

You are viewing a single comment. View All
Viper2211 (82)

This is a truly honest tutorial. Hats off.