[elm-discuss] Re: Best practices for designing models in the Elm Architecture - lean or rich?

2017-08-15 Thread Erkal Selman
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,

Re: [elm-discuss] Re: Best practices for designing models in the Elm Architecture - lean or rich?

2017-07-26 Thread Mark Hamburg
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

[elm-discuss] Re: Best practices for designing models in the Elm Architecture - lean or rich?

2017-07-25 Thread Kasey Speakman
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

[elm-discuss] Re: Best practices for designing models in the Elm Architecture - lean or rich?

2017-07-24 Thread Christian Charukiewicz
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