[Draft started 3 August 2021]
Create good user messages based on form states using error-first design.
This tweet went out in 2018 and almost nobody picked up on it.
Build your app in its error state, then fix that, TDD or not. Make #ErrorFirstDesign a first-class citizen.
There follows a link to another tweet that has since been deleted, illustraiting the point that applications can enter unwanted or unsafe states without any intentions.
A loaded form on the web can be in one of four states initially:
- Empty: No values or selections are provided.
- Invalid: Some values or selections are invalid and should be corrected.
- Incomplete: Some but not all values or selection are provided and valid.
- Complete: All required values or selections are provided and valid.
That is the same set of possible states for an address change form or a sudoku puzzle.
An asynchronous form be can in one of four states:
- Loading: form initialization in progress.
- Submitting: request in progress.
- Errored: data not accepted.
- Failed: request not accepted.
- Success: request and data accepted.
Once a form is complete, it may be submitted. Of course, you need not validate in the client, but leave all that to the server, if you wish.
[more to come...]