Udacity's Android Developer Nanodegree Updated To Android Architecture Components
Written by Nikos Vaggalis   
Monday, 28 May 2018

Udacity's Android Developer Nanodegree gets up to speed with Android Architecture Components with an important update. This recognizes that the components are growing in popularity and can  even be considered the modern way of doing things on the platform.

This new class talks us through the four subtopics that comprise the Architecture Components:

1. The Room persistence library - an ORM for easier interaction with a backend database.

2. LiveData - based on RxJava and the Observer pattern so that the UI can be  automatically updated upon any change happening to the underlying data store.

3. ViewModel - Caching and preserving data/state during configuration changes.

4. Lifecycle Aware Components - to make objects that haven't got a lifecycle (as defined by the platform) to become lifecyle aware.

 

These changes not only update but also upgrade both the development on the platform and the Naonodegree. Before Components there was overuse of some specific patterns and best practices. Take the most popular one, the Loaders. Most code is literally "littered" with calling Loaders and LoaderManagers in order to access the database on a separate thread, to cache the data fetched, to survive configuration changes and to refresh the UI whenActivity events take place. A large percentage of coding was consumed with those kind of tasks which the Components now come to replace.

The lectures on Room and LiveData are interconnected and explain that instead of returning table rows which are then mapped to POJO's before reaching the UI, they are now returning LiveData objects that encapsulate those POJOs and notify the UI to refresh itself through Reactive programming. This means getting rid of having to check manually for changes in the underlying data store.

The ViewModel provides protection from memory leaks because its scope is in sync with the Activity's scope. So, for example, when the Activity is destroyed before an async call for fetching data from the database or the network completes, due to the Activity not sticking around, that data will be delivered to the ViewModel itself! If you've been following my seven-part, in depth review/tutorial, of my Android Nanodegree experience, you'll be aware of the pain involved in maintaining state, especially when other components such as Fragments or the Backstack come into play.

Finally Lifecycle, comprised of LifeCycleOwner and LifeCycleObserver, allows components that do not have a lifecycle (LifeCycleObservers) of their own, for example LiveData, to  be able to observe the lifecycle of an owner (LifeCycleOwner), for example that of an Activity or Fragment, and respond to their lifecycle events taking place.

The lessons are accompanied by the relevant code, which is the classic ToDo list app but now rewritten to introduce the Architecture Components.

There is no hint whatsoever, but I suspect that sometime in the near future the projects that need to be submitted, such as the (toughest) Backing App, in order to progress between the stages of the Nanodegree, are going to be amended to ask for their implementation to be done with use of the Architecture Components.

More Information

Android Developer Nanodegree

Related Articles

Android Architecture Components Reach Stability

Android Gets Architecture Components 

Insider's Guide To Udacity Android Developer Nanodegree - 1

Insider's Guide To Udacity Android Developer Nanodegree - 2

Insider's Guide To Udacity Android Developer Nanodegree - 3

Insider's Guide To Udacity Android Developer Nanodegree - 4

Insider's Guide To Udacity Android Developer Nanodegree - 5

Insider's Guide To Udacity Android Developer Nanodegree - 6

Insider's Guide To Udacity Android Developer Nanodegree - 7

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

 

Banner


Avi Wigderson Gains Turing Award
16/04/2024

Israeli mathematician and computer scientist, Avi Wigderson, is the recipient of the 2023 ACM A.M Turing Award which carries a $1 million prize with financial support from Google.



Amazon Ending Alexa Skills Payments
12/04/2024

Amazon has told developers who are signed up to the Alexa Developer Rewards Program that their monthly payments will end at the end of June. The announcement follows a decision to end the program unde [ ... ]


More News

 

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 28 May 2018 )