Closed togi closed 6 years ago
Thanks for the feedback! I tried to implement what you suggested here, hope I understood you correctly.
BTW, what you said IMO is very similar to what I tried to do in my sample application with Elm Architecture and CA https://github.com/sgrekov/Translater But I treated UDF primitives as presentation elements, hence all UI state modelling was concentrated in Presentation layer.
The init and update functions only depend on the model, event, and effect types, so we usually like to keep them in the same place. One pattern we've been using ourselves lately is to have a
domain
package where model/event/effect/init/update live, and in Java we putinit
andupdate
as static functions in eg. aLoginLogic
class.We think of the update/init as the business logic of the loop (essentially they do the same thing as interactors/use-cases do in Clean Architecture), so separating it from the rest of code makes it a bit easier to see that it doesn't have any other dependencies than on model/event/effect.
Also separating them makes it a bit easier to see that they actually are pure functions, and can make it a bit easier to get an overview of the different cases.