Software functionality

So you are considering creating a software? This resource collects tips for creating the best user experience.

## User interface

[edit | edit source]

### Context menus

[edit | edit source]

Context menus allow accessing features that are relevant to a selected element. On a desktop computer or laptop, it is usually accessed using the right mouse button, and on mobile, usually by long holding.

An example use is in web browsers, where a context menus from a hyperlink shows options such as "open this link in a new tab", "open this link in a new window", "open this link in current tab" (overrides `target="_blank"` in HTML, "copy link text", "save target", and "bookmark link". If text is highlighted, options include "copy selection", "select all", and an option for searching the web for the selected text.

Icons can be added to context menu items to help users find them quicker.

### Keyboard shortcuts

[edit | edit source]

Keyboard shortcuts to commonly used items make the workflow more convenient. For example, on web browsers, the "Home" key jumps to the top of the page, the "`End`" key to the bottom, and "page up" and "page down" to scroll up or down by one height of the view port. `CTRL+T` opens a new tab in the same window for quick access to other tabs from the tab bar, and `CTRL+N` opens a new window.

To help users memorize keyboard shortcuts, menus should list the keyboard shortcut mapped to options.

### Message boxes

[edit | edit source]

Bar notifications are usually more suitable than pop-up notifications. Pop-up notifications usually appear at the center of the screen and may block the user interface behind it until closed, making them more intrusive and force the user to interact, meaning they interrupt the workflow, whereas bar notifications (or push notifications on mobile) are less intrusive.

Pop-up notifications should only be implemented where a process can not be resumed without user input.

On mobile screens, dialogue boxes should be aligned to the bottom of the screen rather than vertically centered, since the bottom is more accessible to the thumb.

## Data storage

[edit | edit source]

Data that is specific to the software, such as user preferences, are best stored in a directory dedicated to the software. New data generated by the software that can be used elsewhere is best stored in a common directory, optionally into a sub-directory that is named after the program, and with an option for the user to specify a custom directory.

For example, web browsers store settings in a dedicated profile folder (location varies between operating systems), whereas the default location for downloads is a folder named "Downloads" in the user profile directory of the operating system.

A `.bak` file copy of user configuration and opened files may be created to prevent corruption in case of a failed write. This may be caused by a power outage, operating system crash, or disk space exhaustion. Without the backup file, an unsuccessful write event may truncate a file, meaning it cuts off the file at a position, or leaves a blank file. In practice, this could cause a written document to become incomplete or get lost, a multimedia project file (e.g. from a video editor) to become unparseable, and user preferences being reset to default.

Files that are being downloaded or received may be temporarily stored with a different filename extension. For example, the Firefox web browser appends a "`.part`" to files not downloaded yet. The benefit is that it signifies the incompleteness of the file should the program end unexpectedly through a system crash or task kill. The disadvantage is that files openable while being downloadad (like some multimedia formats and long text-based files in byte editors) will be renamed when the download finishes and will have to be re-opened.

## Controversial decisions

[edit | edit source]

If you are considering to make a controversial change such as removing a feature, it is best to ask your user base for feedback in advance. Perhaps they tell you something you have not considered before, which leads to you making a better decision.

Removing useful functionality will discourage your users from installing updates in future.

## Asynchronous sub-processes

[edit | edit source]

To prevent an entire program from becoming unresponsive, make use of asynchronous sub-processes. For example, modern web browsers put individual tabs into independent child processes to prevent one site with an unresponsive script from freezing up the entire browser as happened with early web browsers. Another performance benefit comes from the operating system allocating child processes across the cores of multi-core processors.[1][2]

### Asynchronous disk writing

[edit | edit source]

Disk writing is best implemented in a way that does not interfere with with the user interface of the program, for example by launching an asynchronous child process to handle disk writes. If disk writes are performed synchronously from the program's main process, it is unresponsive until the disk write is completed. If many programs are running in the background of the user's computer, this could lead to the program freezing up until the data storage controller has handled all requests.

## Avoiding data loss

[edit | edit source]

The user should not be able to irreversibly lose data by accident.

For example, a file manager should not lose data during file transfer, and the user should not be able to delete files with one button press. Before anything can be irreversibly deleted, a confirmation dialogue must be displayed. The same applies in other areas such as web browsing history.

To move files safely, file sizes should be compared from the source to the target before a source file is deleted, and source files and folders should never be deleted unless transferred properly. As a counter-example, a bug in the file manager by Google that is bundled with the Android mobile operating system caused data to get lost when cancelling a file moving process, due to deletion of untransfered files.[3]

Make sure that a camera or audio recording app does not lose data when improperly quit, and that the user can not destroy data by accident. For example, some voice recording apps feature a "discard" or "cancel" button.[4] Such a button is not necessary, since the user can simply delete an audio file if they wish to discard it, but if such a button is featured, a confirmation dialogue should be displayed to prevent accidental tapping from destroying data. Additionally, the camera software of some early Samsung smartphones such as the 2011 Samsung Galaxy Ace discarded a video file if recording was quit with the "back" navigation button.

If the software is improperly quit (for example through process termination or operating system crash), the temporary file should be repaired at the next start, rather than being discarded.

The user interface should be designed in a way that makes it unlikely to delete data by accident. There should be a confirmation dialogue before data is irreversibly deleted. Some gallery applications for smartphones feature a vertical swiping gesture for deleting items. The only way to prevent deletion after actuating this gesture is to respond to a "toast" type notification with an "undo" button, which disappears within seconds. As a result of stress, a user might fail to tap on it and tap next to it, closing the notification immediately. Also, in Mozilla Firefox, it is possible as of 2022 to delete items from the history and download list with a single press of the "delete" key. No confirmation dialogue appears first.

Your software should be able to handle full-disk conditions without losing data. For example, a text editor should not save directly to a text file, since directly writing to a text file while space storage is exhausted could cause that file to be blanked. Create a temporary file and only rename it to the name of the existing file if it was saved successfully.

For software that creates large files, such as a video camera application, it is recommended to leave a free space margin such as 100 MB to prevent a failed write from corrupting the video file and to prevent making the operating system unstable.

## Minor annoyances

[edit | edit source]

Take reports by users about annoyances that might seem trivial seriously, because many individually minor annoyances put together form a significant annoyance, so it is better for seemingly trivial annoyances to be defeated.

## References

[edit | edit source]

1. ↑ Electrolysis: Multi-Process Firefox » Linux Magazine
2. ↑ Modern Multi-Process Browser Architecture • Helge Klein
3. ↑ Google support thread: Photos disappeared after moving to another device folder by Gökhun Güneyhan (57 Replies)
4. ↑ "6 Best Free Audio Recorders for Android" – Better Tech Tips (September 23, 2018) (with screenshots)