Summary

It was a lengthy chapter, but we did a lot here. We learned how to efficiently use extract method refactoring to simplify and clarify the code. This refactoring was applied to our code to greatly simplify the existing data retrieval flow.

We also saw how we can use the Factory Methods to create reusable Observables by wrapping their complex creation code inside familiarly named methods.

As we were exploring various ways of the method extraction helping us make the code easier to maintain, we saw the limits of this approach, and we learned to use ObservableTransformer to help us overcome those limitations.

The ObservableTransformer was successfully applied to simplify the persistence and error notification code. Further, we learned how to use Transformers to do a simple file-based caching and track the elapsed time for the emitted items.

Finally, after following through all of these techniques from this chapter, we reduced the main data retrieval flow from 63 lines to just 21 lines! That's a huge improvement toward the more maintainable code that is also much easier to understand.

In the next chapter, we will learn what Subjects are and how they are related to Observables and Subscriptions. Afterward, we will learn how they can be used to persist and pass preferences from storage to the Observables that are responsible for the financial stock data retrieval.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.51.153