Hi Everyone,
Usually when I want a series of updates to chain in sequence, I'll write some code like this:
FirstThing ->
let
newModel = { model | -- update the record properties -- }
in
update SecondThing newModel
SecondThing ->
let
newModel = { model | -- update the record properties -- }
in
update ThirdThing newModel
ThirdThing ->
let
newModel = { model | -- update the record properties -- }
in
update LastThing newModel
LastThing ->
let
newModel = { model | -- update the record properties -- }
in
newModel ! [ ]
But... isn't this similar to using a GOTO statement in BASIC?
(Hey, I love BASIC, but... !)
I've found that when I have a few of these chained in sequence, spaghetti code is the guaranteed result.
Is there someway to manage this sequencing in some kind of centralized way?
For example, something like:
SequenceOfSteps ->
FirstThing
SecondThing
ThirdThing
LastThing
It would be nice to do this so that I can selectively insert or remove steps while testing my application.
Is this possible?
Any advice or opinions?