Udacity Eng & Data

from the engineers and data scientists building Udacity

Follow publication

My first weeks as an Android Dev

Hello world! It’s me, Barbara. I’m here to tell you all about my first four weeks as an Android developer intern here at Udacity. Prior to my internship, I built a quick-and-dirty computer science dictionary app for students who were enrolled in the Intro to Programming course offered at my school. Udacity’s Android app is kind of like that, but on steroids. I feel like I’m David, and the Udacity android codebase is my Goliath

“together, we can create a product that has the potential to change the lives of our students”

By the end of my first week, I learned that Udacians share one important belief: that, together, we can create a product that has the potential to change the lives of our students. When I heard that my first project would be integrating the feedback modal at the end of a lesson, I was a little excited. This feature enables students to comment on their experience while also providing us with insight on the quality of work being produced at Udacity. It’s a win-win!

The Goal

To offer some context, here is the main flow:

  • The student reaches the end of a lesson in the classroom.
  • The modal is then displayed on the screen, presenting the option to leave a suggestion and/or rate the lesson ‘bad’, ‘neutral’ or ‘good’. Or maybe even leave no feedback at all.
  • Either way, continue onto the start of the next lesson.

The Layout

Design

I spent what felt like forever, getting the layout to be cohesive with the rest of the app. I was working with the web adaptation as reference, and had to pull and modify the assets so that they were Android Studio friendly. I also studied the layouts of other activities, to see what common styles and themes were being used throughout the app. I continued to make small changes to the layout throughout the completion of project.

ConstraintLayout

This is a fairly new ViewGroup in Android (c 2017). There are some very cool and handy attributes that come with ConstraintLayout. Like, specifying positions based on the relationship between views and view groups. I used layout_constraintTop_toBottomOf to align my two main ViewGroup objects. I tried to use the chain feature, but failed to get it down right. It’s now on my list of learning-goals.

The Code

Data Binding & Observable Fields

Data binding is neat. It gets rid of so much boilerplate code by removing UI framework calls in the activity, making attribute setting much simpler and easier to maintain. Combining it with observables removes any direct reference to a view, while still allowing notification between the view and the view model. But my big question was, how would I get the data I needed for the views, from the classroom?

Dependency Injection

I would first have to create aViewModel with two dependencies:

  1. A POKO (Plain Old Kotlin Object) that holds the classroom data
  2. An analytics client to track the user’s response. At call time, the classroom passes an Intent containing the Parcelable object (aka the POKO), is then parsed in the activity’s onCreate method, and then injected into theViewModel.

Voilà! I now have all the classroom information I need, as well an Analytics object. What’s ideal about this approach, is that it adheres to the MVVM architectural pattern. The View notifies my ViewModel that the student is interacting with the interface, and my ViewModel responds by exposing to it whatever values or information it needs.

Kotlin

I’ve never written anything in Kotlin before, but it’s not totally out my ballpark of experience. I think I now prefer it over Java because it’s lightweight. Kotlin also has qualities I like in other languages, such as: type inference, range expressions and lambdas. I’m looking forward to working with Kotlin and familiarizing myself more with ‘the Kotlin way’ of doing things.

Don’t be fooled, I couldn’t—and didn’t — do this completely on my own. I had a lot of support from my mentors, both local and remote, who were always willing to answer my questions… pair program… help me with roadblocks… and perform code reviews.

Ready to Learn More?

Check out our full catalog

Follow Us

For more from the engineers and data scientists building Udacity, follow us here on Medium.

Interested in joining us @udacity? See our current opportunities.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response