UML State Machine Diagram Example
Every company having customers maintains customer accounts and supports a complete life cycle of the account from its creation until it is closed. There are differences in what are the stages (states) in the account’s life cycle, and what are conditions or events causing account to change its state.
Here we provide an example of user account life cycle in the context of online shopping, shown as UML protocol state machine diagram.
For the user account to be created, it has to meet some initial requirements. For example, user id (used as a login name) must be unique, at least for the existing accounts. After account was created, it might need to be verified. Verification depends on the company and could include e-mail, phone, and/or address verification. If account was not verified during some predefined period of time, that account could be moved to the suspended accounts.
Online shopping user account protocol state machine diagram.
New, active, or suspended accounts could be cancelled at any time by client’s request. Note, the precondition for this usually includes payment of any outstanding balances, and might require some separate account state or substate to handle this case.
User account might be suspended for security reasons, manually or automatically. For example, website intrusion detection system locks user account for predefined period of time, if there were several unsuccessful login attempts using incorrect account password. After account lock times out, account is activated back automatically.
Some user accounts could be inactive for a long period of time. Company policy or business rules could require moving such dormant for a year or two accounts to the suspended state.
Once we listed user account states and specified all possible transitions from one state to another, we can review the diagram with other subject matter experts to see if anything is missing or needs further clarifications.