This is a nice question I kept asking myself.
I came to the conclusion that it is best to keep your model and your update
function as simple as possible.
In the model, there shouldn't be more than one representation of the same
datum.
The calculations should be made inside the view function,
Agreed that encapsulation is the way to isolate the engineering trade offs
because that's what this really is about. Ideally, one would never store
values more than once and derived data would always get re-derived. But
that ideal world ignores the cost of computations. Sometimes the cost of
I don't think it matters one way or another. Whatever you end up finding
easier to maintain.
What I would do is explicitly represent the BMI as its own module, probably
with an accompanying data type. In the module operations like
`updateHeight` and `updateWeight`, you could make sure that the
You should not keep derived values in the model. The model should be a
single source of truth. This property is violated if you store derived
data in the model. What happens if you create a new input that fires a
different Msg that only updates the height, but does not recompute and
update