Android Developer Nanodegree by Udacity Gets an Update to Android Architecture Components

02 Jun

Udacity's Android Developer Nanodegree gets up to pace with Android Architecture Components having a significant upgrade. This acknowledges that the elements are increasing in popularity and may even be regarded as that the contemporary manner of doing things about this stage.

This new course talks us through the four subtopics that include the Architecture Components:

  1. ViewModel - Caching and maintaining data/state during setup changes.
  2. The Room persistence library - an ORM for simpler interaction using a backend database.
  3. Lifecycle Aware Components - to create objects that have not obtained a life cycle (as described by the stage ) to eventually become lifestyle conscious.
  4. LiveData - according to RxJava along with the observer pattern so the UI could be updated upon any change occurring to the underlying data store.

These modifications not only upgrade but additionally upgrade the growth on the stage as well as the Nanodegree. In earlier components there has been overuse of several particular patterns and best practices. Just take the hottest among the loaders. Most code is "littered" with phoning loaders and loader managers so as to get into the database onto a different thread, to cache the information fetched, to endure settings changes and also to refresh the UI when activity occasions occur. A massive proportion of programming has been consumed with these sort of jobs that the components today come to substitute.

The lectures on room and also LiveData are interconnected and clarify that rather than returning table rows that are subsequently merged to POJO's prior to hitting the UI, they are presently returning LiveData items which oppose those POJOs and inform the UI to match itself via reactive programming. This usually means eliminating having to check manually for modifications from the underlying data store.

The ViewModel provides security against memory leaks since its range is in sync with all the activity's scope. Therefore, by way of instance, once the action is ruined prior to an async involve pulling information from the database and also the system finishes, on account of the task maybe not sticking around, this info will be sent into your ViewModel itself! If you have been after my seven-part, in-depth review/tutorial, of my Android Nanodegree encounter, you're going to know about the pain involved with keeping condition, particularly if other elements like fragments or even the backstack come in to play.

Finally, Lifecycle, included of LifeCycleOwner and LifeCycleObserver, permits components which don't have the lifecycle (LifeCycleObservers) in the own, such as LiveData, to have the ability to discover the life cycle of an operator (LifeCycleOwner), such as that of an Action or Fragment, and also react to their own lifecycle events happening.

The classes are accompanied with the appropriate code that is the timeless ToDo list program but rewritten to present the Architecture Components.

There's not any hint at all, however I guess that sometime in the long run the jobs which will need to be filed, like this (toughest) Millionaire Program, so as to advance between the phases of this Nanodegree, are likely to be formatted to request their execution to be accomplished with use of this Architecture Components.

Share this post with your friends!