Chapter II.10. Principles of User Interface Design

You can divide every program into two parts: a user interface and the part of the program that actually does something useful, such as predicting winning lottery numbers or editing video images.

The whole purpose of a user interface is to give a program a way to

  • Accept commands from the user.

  • Accept data from the user.

  • Display information back to the user.

The user interface basically lets you give information to a program and receive useful information back again, as shown in Figure 10-1. Most user interfaces let people control a program, but a user interface can just as well let inanimate objects (like a motion detector) control a program. Without a user interface, you can't control a program or retrieve any useful information from the program.

The user interface lets you control a program, give it commands, and retrieve useful information back.

Figure II.10-1. The user interface lets you control a program, give it commands, and retrieve useful information back.

The Evolution of User Interfaces

To better understand user interfaces, you need to know how user interfaces evolved and how current user interface designs are meant to solve the problems of the past.

Command-line interface

In the old days, programmers focused on writing the useful part of their program and then as an afterthought, they created a simple user interface for controlling that program. Because the programmers already know how to control their own program, they often create a bare-bones user interface that looks as confusing as this:

A:>

At this point, the user is supposed to know not only all possible valid commands to use, but also how to spell and use each command as well. Such bare-bones user interfaces are command-line interfaces because they force users to type in commands one line at a time.

The problem with command-line interfaces is that they're too hard to use:

  • You have to know all valid commands you can use.

  • You have to know what each command does so you know which one to pick.

  • You have to type each command in correctly. Spell a command wrong or leave out a space, and the program rejects that command and makes you type it all over again.

Menus

Command-line interfaces made using programs too difficult for the average person, so user interfaces soon evolved from primitive command-line interfaces to simple menus that listed options for the user to choose, as shown in Figure 10-2.

To choose a command listed in a menu, you had to either press a function key (such as F3) or a unique keystroke combination (such as Ctrl+K+X). The problem with these simple menus was that they gobbled up space on-screen. The more commands a program offered, the bigger the menus got.

The solution to this problem was to organize commands in different menus that would appear only when the user needed them. Such menus typically appeared at the top of the screen and would appear when the user clicked or pulled down the menu, like pulling down a window shade, as shown in Figure 10-3.

Early user interfaces were simple menus of keystroke combinations.

Figure II.10-2. Early user interfaces were simple menus of keystroke combinations.

Pull-down menus help organize commands and tuck them out of sight until needed.

Figure II.10-3. Pull-down menus help organize commands and tuck them out of sight until needed.

The main advantages of pull-down menus are that they hide program commands until you need them, and you could choose a command from a pull-down menu by clicking it with the mouse as opposed to typing a cryptic keystroke command.

Eventually, more programs started using pull-down menus. To make using different programs even easier, programs started organizing their commands under identical pull-down menu categories.

For example, the File menu typically lists commands that manipulate your data, such as Save, Open, or Print a file. The Edit menu typically lists commands for changing your data, such as Cut, Copy, and Paste. By offering standard pull-down menus, users could figure out one program and then quickly adapt to using another program.

Graphical user interface

The next great leap forward in user interface design occurred with operating systems. In the early days of computers, most operating systems offered only command-line user interfaces, so programs had to create their own pull-down menu user interfaces themselves. Therefore, every program tends to look slightly different even if it used nearly identical pull-down menus.

To create a consistent appearance for all programs and give users the ability to run two or more programs at the same time, operating systems soon abandoned their clunky command-line user interfaces and adapted a graphical user interface (abbreviated as GUI).

Warning

The main purpose of a GUI is to give users the chance to point and click the commands they want rather than force them to type in the actual command name.

An operating system's GUI offered three advantages:

  • All programs appeared with a consistent look.

  • Each program appeared in its own window.

  • Users could cut, copy, and paste data from one window (program) to another.

Before GUI operating systems, such as Mac OS X or Microsoft Windows, two programs might both display similar pull-down menus, but one program might display it in black against a white background whereas the other program might display it in red against a blue background. Such visual differences might be functionally trivial, but the jarring visual differences could make figuring out different programs harder for many people.

By forcing all programs to look similar, GUI operating systems made figuring out programs much easier. After you knew how one program worked, you could easily switch to another one.

  • GUI operating systems can display individual programs in separate windows. Previously, computers could only run a single program at a time, and that program would gobble up the entire screen.

    With GUI operating systems, each program could only appear in a separate window. That way you could run multiple programs at a time, arrange them in separate windows, and see and switch between each program just by clicking a different window.

  • GUI operating systems let you share data between separate windows. So if one window runs a word processor and a second window runs a database, you could copy and paste data from one program into the other. Without a GUI operating system acting as an intermediary, sharing data between two different programs was difficult to impossible.

Warning

The only purpose of a user interface is to make it easy for people to use a program. The best user interface is transparent to the user — someone can use the program just by looking at it, rather than being forced to read 300-page manuals first.

Elements of a User Interface

To create a user interface, you have two choices:

  • Write a user interface from scratch.

  • Use a RAD (rapid application development) tool.

Writing a user interface from scratch basically means writing and testing your program and then writing and testing a user interface, essentially doubling your work. Because the code that creates a user interface can be separate from the code that actually makes your program do something useful, many programmers use user interface frameworks that contain libraries of subprograms for creating the standard elements of a user interface, such as pull-down menus and windows.

As an even simpler alternative, programmers also use RAD (rapid application development) tools that let you visually design your user interface. After you design your user interface, write code that attaches this user interface to the rest of your program.

No matter which method you use to create a user interface, every user interface needs to offer ways to do the following:

  • Give commands to the program.

  • Give data to the program.

  • Display information for the user to see.

Warning

The user interface has to make sense only to the people who want to use the program. If you design a user interface that looks great to you but confuses the people who use the program, the user interface fails no matter how pretty it may look.

Displaying commands to a user interface

Unlike command-line interfaces that force users to memorize and type commands, GUI user interfaces always display commands on-screen so the user can point and click with the mouse to choose a command.

The simplest way to display a command to the user is through a button. Because buttons can take up so much space on-screen, buttons are most useful for displaying a limited number of commands to the user, such as two or three possible choices, as shown in Figure 10-4.

Buttons can display the entire command name.

Figure II.10-4. Buttons can display the entire command name.

The problem with buttons is that they take up screen space, so using more than a handful of buttons can crowd the screen and confuse the user. So rather than bombard users with screens full of buttons, programs generally use buttons to offer choices that users need to make immediately.

For example, when quitting a program, the program may ask the user if she wants to save her file before quitting. So the limited number of choices are only: Don't Save, Save, and Cancel.

Warning

Buttons are useful for limiting the user's choices to a handful of options. However, buttons are impractical for displaying a large number of commands.

The most popular way for displaying multiple commands to the user is through pull-down menus. Pull-down menus organize commands into categories, such as File, Edit, Window, and Help.

Unfortunately, pull-down menus aren't easy to use when a program has hundreds of possible commands. As a result, commands often get buried within multiple pull-down menus.

To solve this problem, many programs group related commands within submenus, but now you have the problem of trying to find a command buried within a submenu, which is buried in a pull-down menu, as shown in Figure 10-5.

Because pull-down menus can get overloaded with so many commands, user interface designers started displaying commands as icons and grouping icons together in toolbars that usually appear directly underneath pull-down menus, as shown in Figure 10-6.

Submenus reduce the number of commands in a pull-down menu but make it harder to find a command.

Figure II.10-5. Submenus reduce the number of commands in a pull-down menu but make it harder to find a command.

Icons, organized in toolbars, allow one-click access.

Figure II.10-6. Icons, organized in toolbars, allow one-click access.

The advantage of icons is that they take up much less space than buttons with command names written inside them. The disadvantage of icons is that users have no idea which icons represent which commands.

As a result, most programs display short descriptions of each icon's purpose if you move the mouse pointer over that icon. So if you move the mouse pointer over a disk icon, the program might display the word Save underneath in a little window to let you know that clicking the disk icon represents the Save command.

Another way to organize icons is in a toolbox on the side of the screen, which is popular for accessing groups of commonly used commands, as shown in Figure 10-7.

Warning

Icons provide one-click access to commonly used commands. However, users should still be able to choose the same command from a pull-down menu if they want.

Toolboxes provide another way to group icons for easy access.

Figure II.10-7. Toolboxes provide another way to group icons for easy access.

Giving data to the user interface

Besides giving a program commands, users also need to give a program data to use for calculating a useful result. At the simplest level, users can just type in data they want to give the program. To accept typed-in data, user interfaces need to display a text box.

A text box is nothing more than a box for the user to click and type something in it. Text boxes are commonly used when the program needs data that can't be predicted in advance, such as asking for someone's name, as shown in Figure 10-8.

Users can type any information inside a text box, including invalid data.

Figure II.10-8. Users can type any information inside a text box, including invalid data.

Text boxes are great for accepting any data, such as names, passwords, or search phrases, but text boxes also allow users to type in invalid data. To weed out invalid data, write extra code to verify that any information typed into a text box is actually valid.

If the type of data the user can give to the program is limited to a fixed range of choices, it's better to use one of the following user interface elements instead:

  • Radio buttons

  • Check boxes

  • List boxes

  • Combo boxes

  • Sliders

Restricting choices to one option with radio buttons

Radio buttons get their name from old car radios that let you assign a favorite radio station to a button. So rather than tune in your favorite radio station manually, you had to press in a radio button, and the radio would jump to a pre-set radio station.

User interface radio buttons work the same way. Each radio button represents one possible choice, and the user can pick only one of them, as shown in Figure 10-9.

Radio buttons display choices, but only let you pick one option.

Figure II.10-9. Radio buttons display choices, but only let you pick one option.

The main advantage of radio buttons is that they show the user all possible choices, so instead of typing in the data (and risk spelling it wrong), users can just click the radio button that represents the data they want to give a program.

Restricting choices to two or more options with check boxes

Radio buttons are useful for restricting the type of data the user can give to a program. However, if you want to display all possible choices but allow the user to choose two or more of those choices, you can use check boxes instead, as shown in Figure 10-10.

Check boxes can display multiple choices and pick more than one option.

Figure II.10-10. Check boxes can display multiple choices and pick more than one option.

The drawback of both radio buttons and check boxes is that they take up space on-screen. Displaying 4 or 5 radio buttons or check boxes on-screen is reasonable, but displaying 20 or 30 radio buttons or check boxes can get cumbersome.

Displaying multiple choices in a list box or combo box

If you need to display multiple choices, you may find it easier to display all those choices in a list box. A list box can either display all choices or a limited number of choices.

If the list box is large enough, it can display all choices. If the number of options is more than the list box can display at once, the list box displays a scroll bar so users can scroll through the list of all available options, as shown in Figure 10-11.

List boxes display a list of options.

Figure II.10-11. List boxes display a list of options.

Similar to list boxes are combo boxes, which combine the features of a text box with a list box. Like a text box, a combo box lets users type data directly into the program. Like a list box, a combo box also displays a list of options that the user can choose, as shown in Figure 10-12.

Combo boxes let you either make a choice or type data directly.

Figure II.10-12. Combo boxes let you either make a choice or type data directly.

Warning

Unlike list boxes, combo boxes always hide all choices until the user clicks the combo box.

Restricting numeric choices with a slider

If users need to give numeric data to a program, they can type the numeric values in a text box. However, if you want to restrict the range of valid numbers that the user can type in, you can use a slider.

A slider moves along a ruler, with the position of the slider determining a specific numeric value or setting, as shown in Figure 10-13. Not only can sliders limit the range of a number that users can give a program (such as from 0 to 100), but sliders can also define the increments of numeric data.

A slider lets users visually choose a numeric value or setting by dragging a slider along a ruler.

Figure II.10-13. A slider lets users visually choose a numeric value or setting by dragging a slider along a ruler.

So if a slider restricted values from 0 to 100 with increments of 0.5, that means the user could give the program numbers such as 0, 0.5, 1, 1.5, 2, 2.5, and so on.

Showing information back to the user

User interfaces can show information to the user in a variety of ways, such as through text, graphics, or even sound. Typically, a user interface displays data in a window where users can manipulate that data and see their changes directly, as shown in Figure 10-14.

A user interface displays data in a window that users can manipulate whether that data represents text, numbers, pictures, or sound.

Figure II.10-14. A user interface displays data in a window that users can manipulate whether that data represents text, numbers, pictures, or sound.

Using any program is like talking to the computer. You first tell the computer what you want to do (start writing a letter), the computer obeys (loads your word processor) and then waits for you to do something else. You give another command to the computer (to format text you just typed), the computer obeys and then asks what to do next, and so on.

Normally when you give a command to a program, the program responds right away. However, sometimes the program asks the user for more information. For example, if you give the command to print a document, the program may want to know how many pages to print. Whenever a program needs more information to carry out a command, it displays a dialog box, as shown in Figure 10-15.

Dialog boxes ask the user for more data before carrying out a command.

Figure II.10-15. Dialog boxes ask the user for more data before carrying out a command.

A dialog box is the computer's way of saying, "I'm trying to obey your instructions, but I'm not quite sure exactly what you want." Some common dialog boxes are used to

  • Open a file.

  • Save a file.

  • Print a file.

Warning

Because dialog boxes are so common in every program, many programming languages provide built-in features for displaying dialog boxes. That way you don't have to create your own dialog boxes from scratch.

The Open dialog box lets you click a filename that you want to open. The Save dialog box lets you click a drive or folder where you want to store a file and then type a name for your file. The Print dialog box lets a program ask the user how many pages and copies to print as well as the page size or orientation.

Warning

Dialog boxes provide standard ways for performing common tasks needed by almost every program.

Organizing a user interface

One problem with designing a user interface is fitting everything in a single window. To help organize a user interface, many programs use either boxes or tabs.

Boxes draw lines around items on the user interface, such as multiple radio buttons, and visually separate items, as shown in Figure 10-16.

Boxes draw lines to separate and organize different user interface items.

Figure II.10-16. Boxes draw lines to separate and organize different user interface items.

Another way to organize a user interface is to use tabs. Each tab can display entirely different user interface items (buttons, text labels, check boxes, and so on). When you click a different tab, the tab shows you different user interface items, as shown in Figure 10-17.

Tabs let you organize and display different user interface items in the same window.

Figure II.10-17. Tabs let you organize and display different user interface items in the same window.

Warning

The goal of boxes and tabs is to organize your user interface. As far as users are concerned, the user interface is the only part of your program that they can see, so if you design a cluttered or confusing user interface, people think of your program as cluttered and confusing.

Designing a User Interface

There's a big difference between knowing the elements of a user interface and knowing how to put together an effective user interface. That's like the difference between knowing how to write every letter of the alphabet and knowing how to write a best-selling novel.

That's why designing a user interface is part art and part science. After you design enough user interfaces and use the user interfaces of different programs, you can see what you like and don't like. Then you can apply your own ideas to designing your idea of a perfect user interface.

Although it's difficult to teach the art of designing a user interface, it's much easier to teach the science behind designing a user interface. By following certain user interface principles, you can increase the chances that your user interface will at least be competent and usable.

Tip

To see drastic differences between user interfaces, compare the user interfaces of commercial programs from Microsoft, Adobe, or Apple and then look at the user interfaces on shareware, freeware, or niche commercial programs (such as astrology charting programs or horse race prediction programs). Big companies spend much time and money testing their user interfaces. In comparison, many individual programmers just slap together a user interface and start selling their program — and the results from their user interface really shows the difference.

Know the user

Most people find computers hard to use because the user interfaces of most programs are too confusing. Usually the problem lies with the fact that the programmers know how their program works, so they automatically assume that everyone else must also know how the program works, too. Essentially, too many programs are written by programmers for other programmers and ignore the ordinary user.

Before you design your user interface, you must determine what your users expect. A program designed for other programmers (such as a compiler or a debugger) can have a drastically different user interface than an educational program designed for 6-year-olds.

No matter who the typical user might be, the user interface's sole purpose is to communicate with the user. Just as you'd talk to a college professor differently than you'd talk to a 6-year-old child, so must you adapt a user interface to the person most likely to use your program. After you know who the user is, you'll know the best ways your user interface can "talk" to that person.

Hide unusable options

At any given time, the users should know what they can do. Unfortunately, poor user interfaces either

  • Expect the user to know what to do next.

  • Bombard the user with so much information that the user still doesn't know what to do next.

The command-line prompt is an example of a poor user interface that expects that the user already knows all valid commands and how to spell them. If you don't know which commands may be valid, the user interface won't help you.

Even worse than sparse user interfaces are user interfaces that show too much information, such as the pull-down menus in Figure 10-18. The program in this figure displays an Attribute submenu within the Text menu title.

This program's pull-down menu lets you view a bunch of submenus that you can't access.

Figure II.10-18. This program's pull-down menu lets you view a bunch of submenus that you can't access.

However, every option on the Attribute submenu appears dimmed, which makes the Attribute submenu useless. Why bother showing the users commands that they can't use? Not only does this frustrate the user, but the user never knows when any of the Attribute commands might appear undimmed and available for use.

A well-designed user interface should always show all possible choices and not overwhelm the users with choices they can't pick anyway.

Tolerate mistakes

User interfaces are meant for people to use, and it's no surprise that people make mistakes. Sometimes they type in the wrong data and sometimes they give a command that they didn't really want to give.

If you make a mistake, you should be able to

  • Undo or take back that mistake.

  • Give the right command or data.

Unfortunately, too many user interfaces don't let users undo their mistakes, which can make the user anxious and timid because he's afraid that if he does something wrong, he can't ever reverse his mistake. As a result, anxious and timid users tend not to trust a program or use it to its maximum capabilities.

Even worse is when user interfaces provide cryptic feedback if the user does something wrong. Examining the error message in Figure 10-19, can you tell what you might have done wrong and what you can do in the future to make sure this error message doesn't appear again?

A cryptic error message is meaningless and frustrating because the user never knows how to avoid this problem in the future.

Figure II.10-19. A cryptic error message is meaningless and frustrating because the user never knows how to avoid this problem in the future.

Cryptic messages can make users feel as if the program is scolding them. As a result, users are less likely to enjoy using the program and probably won't take full advantage of all its features either, if they even bother using the program at all.

User interfaces should tolerate and expect that the user will make a mistake and then find a way to recover from these mistakes gracefully. This can be as simple as having the program beep if the user tries to type his name instead of his Social Security number, or having the program display a descriptive error message that not only tells users what they did wrong but also tells them what to do right.

By doing this, a user interface can give the user confidence to experiment with a program and learn its features without reading a 300-page manual. Instead, the user can gradually figure out how to use a program with the program guiding him every step of the way.

Be consistent

One reason why franchise restaurants are so popular is because people know what to expect when they eat there. User interfaces also need to make a great first impression on users and then remain consistent so users generally know what to expect from a program at any given time.

For example, suppose a program displays a toolbox of icons on the left side of the screen. Now what happens if the user chooses a command and suddenly the toolbox of icons either disappears or appears in another part of the screen for no apparent reason at all?

Having the user interface suddenly change its appearance or behavior while the program is running is certain to confuse and annoy users. By staying consistent in appearance and behavior, a user interface can be predictable so the user feels more comfortable using it (just as long as the user interface was designed properly in the first place).

Focus on the task

Ultimately, the user interface must make it easy for the user to achieve a specific result from the program, whether it involves creating greeting cards, editing digital photos, or typing messages into a blog. If the user interface doesn't make the main purpose of the program clear and easy, users don't know or understand what to do.

The program in Figure 10-20 is designed to help people create stories, but rather than display its various tools for story writing, this program forces users to choose a file to open first. At this point, most users will wonder which file to choose, where to find a file, and why they need to open a file if they're using the program for the first time?

Before you can use this program to create a story, you must choose a file first.

Figure II.10-20. Before you can use this program to create a story, you must choose a file first.

Rather than focus on the user's convenience, the program in Figure 10-20 focuses on the program's convenience and forces the user to make things easier for the program instead of the other way around. By not focusing on the main task (creating stories), this program forces users to work harder to use the program than they should.

Make navigation easy

After users start working with a program, they need to switch back and forth between viewing their data in different ways. For example, a Web browser lets users view Web pages (data) and new or previous Web pages easily by either typing in a new Web site address or clicking the Back and Forward buttons. By making it easy for the user to do what she wants, the user interface aids the user without drawing attention to itself.

At any given time, users should always be able to view their data in a previous state (such as seeing the preceding Web page) or view their data in a new way (such as seeing a new Web page or changing the size of text on the current Web page). By making it easy and predictable for users to manipulate data, a good user interface can make even the most complicated program simple to understand and eventually master.

There's no "perfect" user interface because every user interface must cater to different types of users. However, by following user interface design guidelines, you can make sure your program not only looks good but also helps the user get some work done with your program, which is the ultimate goal of any program.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset