Skip to content

Commit

Permalink
Write ADR about no state machine dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
mpanne committed May 21, 2024
1 parent 557fe64 commit 2b037e0
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions packages/dito/doc/adr/0004-no-state-machine-dependency.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 4. Do not use an external dependency as state machine

Date: 2024-05-21

## Status

Accepted

This comment has been minimized.

Copy link
@lsolcher

lsolcher May 21, 2024

Contributor

I'm not sure about the way ADRs work, but to me it would make more sense to not negate the title and put the status as rejected:
Do we use external [...]
and then
Status
Rejected

other then that looks good to me!

This comment has been minimized.

Copy link
@mpanne

mpanne May 22, 2024

Author Contributor

I get the thought but according to the template we are following, "rejected" is not a valid status (see quote below) but you always describe the preferred behaviour which you want to decide and indicate with the status if the decision has already been made and is still valid.

Status A decision may be "proposed" if the project stakeholders haven't agreed with it yet, or "accepted" once it is agreed. If a later ADR changes or reverses a decision, it may be marked as "deprecated" or "superseded" with a reference to its replacement.


## Context

The digital touchpoint application will feature a dialog form that guides users through a series of questions.
We need to decide whether to use an external dependency, such as [xstate](https://xstate.js.org/),
which provides a state machine implementation, or to implement the flow ourselves. The application
will ask users a fixed number of questions (currently five), with a set order and no conditional
logic for skipping questions. This setup is not expected to change in the near future.
The answers will determine different outcomes on a result page.

The benefits of using an external state machine dependency include:

- Easier addition of new questions or changes to the order once set up
- Improved management of complexity if the dialog form evolves, reducing the risk of errors and minimizing code changes

However, there are also some drawbacks:

- Introducing a dependency adds maintenance work and increases the software’s complexity and size
- The mental model of the dependency must be understood
- Learning to use the dependency requires additional effort

## Decision

We do not use an external dependency as a state machine, as it would introduce unnecessary overhead given the
current simplicity of the dialog form.

## Consequences

We will implement our own dialog form flow for the five consecutive questions without relying on an external dependency.

We will reassess this approach if the complexity of the dialog form increases.

This comment has been minimized.

Copy link
@lsolcher

lsolcher May 21, 2024

Contributor

Like this part!

0 comments on commit 2b037e0

Please sign in to comment.