We have now added a brand new piece of functionality to our humble counter feature, that of a timer, and we approached this in a very interesting way. We first concentrated on the core domain of the feature, which is the observable model. We implemented the timer functionality in full isolation without a care in the world for the view. The timer functionality is already complicated enough on its own without having to worry about the view. It’s a long-living effect and we had to manage its lifecycle manually.
And then when it came time to update the views it was quite easy. We just had to add a button to the UI to invoke the appropriate method on the model. And our feature now works on two different platforms and many different view paradigms.
Let’s add one more feature to our little counter feature. Sometimes when I get a fact for a number I learn something very interesting about that number. Let’s make it so that we can save our favorite facts and display them in a list in our view. And further, we will make it so that we can delete any facts that we no longer like.
Let’s dig in.