Sitemap
Mobius

Mobius

Conference for mobile developers

“When I started doing this, there were barely places to look for samples”: David González on Android development

11 min readFeb 20, 2018
Press enter or click to view image in full size

There are several ways Android developers may know David Gonzalez. He is involved in the Android Architecture Blueprints project (more than 25 000 stars on GitHub), he is a speaker, Google Developer Expert and co-organizer of Belgian Kotlin User Group.

So in anticipation of David’s talk on Mobius conference we asked him about different things — from Android Architecture Blueprints to Kotlin to the authentication in Android (which is the topic of his upcoming talk). We published the interview in Russian on Habrahabr, and here’s English version:

— In 2016 you gave a talk about Android Architecture Blueprints. What has changed since then?

— The project has grown, now there are more branches and architecture samples. At the time of a talk RxJava and Dagger versions weren’t stable and there wasn’t even a single Kotlin version.

Since that time, I haven’t been committing as much code as it used to be, but I’ve been more involved in helping people to take a look into the project and work on it. More people are involved in it now and they also have way more questions. They’ve been helping out a lot.

Apart from the project itself, there are also external samples, and I was helping Benoît Quenaudon who was in charge of MVI-RxJava-Kotlin sample.

— Do people say “OK, this is all good in theory, but once I started actually applying these Blueprints to the real-world project, everything became screwed up”?.

— You are right. Blueprint is more a sample to showcase different architectures more than “this is the only way to do it, you have to copy-paste everything from it”. It’s more like a guideline than a Bible.

If you have already an app in Google Play, you’ve been working on it for a couple of years, you have one architecture pattern and then you decide to change it, it’s not as straightforward as copy-pasting.

It really depends on the team you’re working on. If you are on your own, it might be easier. If you are in a bigger team, it’s more about having a dialogue and a discussion with them, deciding as a team how to move forward and how to start implementing those changes.

— Android Architecture Blueprints is maintained by Google. Are there situations when something could be useful for the project, but Google doesn’t let it in for its own reasons?

— No, it’s quite the opposite. For example, there’s the sample for RxJava, even though they may not use it internally. That’s where the community is very helpful, cause we can go and do it ourselves. It’s an open source project, so we can take ownership of those parts. The Dagger sample is a different example: they use it internally and it’s a Google product, so there is more Googlers involved in doing that. They don’t tell us, what to do or not to do, it’s completely open source.

— Does it happen that committers have very different opinions on how a specific architecture should be implemented? Are there conflicts?

— Normally, when there is a discussion for a new sample, then people would write the issue on GitHub and would just help each other. For example, when Benoit wanted to do the RxJava with MVI, I said I wanted to help, just talked to him. It looks more like a nice dialogue than two completely different versions of the same sample when you don’t know which one to go for.

— Android Architecture Blueprints is different from most projects because it is split into multiple branches any of which can reach some “complete” form. Does it mean that a work on it happens in “waves” when a new branch appears?

— Even though it’s always the same to-do app, there can be some new features added to a sample and then all the other branches have to implement it as well. And now Jose is working to find out what will be the next app to develop with the blueprints.

But it’s definitely ups and downs, yes. You really see when there’s a new architecture, many people write blog posts, that comes out to Blueprints and there is more work to do.

Press enter or click to view image in full size

— Now with the rise of Kotlin, do you feel there’s more demand for Kotlin blueprints than for Java versions?

— I think so, yes. The next week after the announcement of Kotlin support at last Google I/O there was a lot of people asking “Hey! When can we get this?” And then people contributed: “This is how I think we should go, what do you think about it?” A few people at Google also were helping with the Kotlin samples, it was very helpful, these guys know how to do it.

— In your talk about remote work you recalled choosing tech stack for the Help Scout application: “Should I do it in Kotlin? But what if I leave in 6 months and someone else has to support it?” These questions were reasonable when you started working on that app, but nowadays the situation is different. So what about Help Scout app now, do you migrate it to Kotlin?

— The situation has changed indeed, it’s a safe bet now to spend time on Kotlin and even in case of leaving the company somebody else will know Kotlin already. It won’t be an issue for the company to invest time in doing things in Kotlin nowadays.

But I don’t see migrating all the code of the app to Kotlin just because it’s Kotlin. I think that it’s way more valuable for the new features to be developed in Kotlin. And if there’s an issue with one of those parts of the app, we can re-write it in Kotlin.

We are also working on a new project that is being written in Kotlin from the start.

— You are organizer of Kotlin User Group in Belgium. How excited are developers in Belgium about Kotlin, comparing, for example, a familiar to you city of London?

— It’s different here. In London there were a lot of developers, meetups happening almost every week. Belgium is a different country, it is much slower in that sense. Even a number of people showing up on the events: even though it’s growing, it’s very different. And convincing Belgian companies to move to Kotlin is also a slower process comparing to London.

But people are excited, it’s just fun to work with, and everyone wants to have fun. When you spend 8–10 hours at work every day, you want to have fun there and I think Kotlin just brought this breath of air for everyone to enjoy again working on Android apps or even server side. I think it’s a great time to be a developer right now.

Get Mobius’s stories in your inbox

Join Medium for free to get updates from this writer.

— It’s a speculative question, but do you feel that Kotlin will soon overtake Java in Android development, or the majority of market is conservative so Java will remain the leader of the foreseeable future?

— Well, there are still companies working in COBOL. And you still have people that need to write COBOL to maintain them. But these systems are 20 years old. I don’t know if any app will be 20 years old. And it looks like mobile developers like to refactor things much faster, you see app rewrites every 2–3 years. So, a lifespan of a project is much smaller compared to old enterprise code, and if there will be a new language in three years, there will be new blog posts and talks about migrating from Kotlin to whatever the new language is. That will be the new kid on the block and then we’re gonna jump on that ship.

— You’ve retweeted the news about the release of Arrow Library for writing in Kotlin in functional style. Do you think there’s demand for writing in Kotlin in functional style?

— I think so. The guys from Arrow Library have done an amazing job. First of all, combining different libraries into one. And they’ve spent a lot of effort and time in the documentation and web site and the samples. People are getting excited.

And I think that even though Android doesn’t seem to be the best place to use the functional programming style, it also allows people from all other languages to come over to the platform and enjoy. If you are Scala developer and you are used to do those patterns, it is easier for you to come into Android now.

In the end, it’s another tool to do the same thing — you still can write an Android app. What really matters is that your users like it. But in the process you can have fun and you can do it with different patterns and libraries.

— You are into Android development for a long time, your first device was HTC Magic. What are the main differences for an Android developer between those times and today?

— I would say that back in the days when I started doing this, there were barely places to look for samples. There were just 3–5 blogs where people would talk about Android. Nowadays there are millions of blogs, courses and samples. Anyone has a code on GitHub and you can read code from other people and learn it from them. You can consume a book, you can have an online course or a presence course, you have conferences all over the world almost every week. There is always something going on. It’s definitely easier to get into Android development now, cause there is a lot of information out there.

And then the devices have changed a lot. New devices with many cores and many gigabytes of RAM were unthinkable a few years back. We don’t spend as much time as we used to in tuning our app, because now if you use Pixel 2, that would never have out of memory issues, unless there is something very-very wrong.

— Today Android developers often say “oh when will I be able to drop API version X”. Was it even more painful back then? Was there a feeling that API changes are life-changing?

— There were no developer previews like we have nowadays, where several months before the actual release you can testing your app with the new SDKs.

And when the Honeycomb came, that changed everything. The Fragments appeared. What do we do with them? Why should we use them? Those APIs were changing much more rapidly than they do now.

Press enter or click to view image in full size

— You’re going to present a talk about Android authentication on Mobius conference, so we have some questions about that topic.

There was a Russian blog post recently stating that many developers use the Account Manager not for the Account Manager itself but for the Sync Adapter. Do you see the same picture?

— Yes, it’s the way the framework was designed. For Sync Adapter, you need to have Google account. And that account is only visible through the whole framework via the Account Manager.

It’s sad, because it has nothing to do with authentication, it’s more about a need that you have for Sync Adapter on its own. And that’s why many people stopped using it: there was a lot of boilerplate code that you have to write just for syncing your data, and that was a bit confusing.

But happily, there are now different options for synchronizing data from your device to a remote server that don’t involve the Account Manager. You have Android Priority Job Queue from Yigit who’s now at Google, the job scheduler from the actual framework, you have Android-Job from Evernote.

— Apart from Sync Adapter, that post also praised Account Manager for sharing the same account between several applications. But it was written by a person from Yandex, a huge Russian company with lots of applications. Obviously it’s useful for them, but doesn’t it turn Account Manager into a tool for large companies that’s much less useful for a regular developer?

— It’s true that Account Manager is very useful for the big companies with plenty of applications, letting you have this common point of authentication for all those apps. If you’re Google and you have Gmail, Google Maps and other apps it is very helpful when a user doesn’t have to log in everything all the time.

But even if you only have one application, Account Manager can be useful. It’s more about storing users’ information in a secure way. And that’s the benefit you get from the Account Manager. I’ll explore it in more detail in my talk.

— How much does authentication in Android change over time? For example, if you were giving a talk on Android authentication two years ago, would it be totally different or more or less the same?

— That’s a very good question. The basics are the same, cause those methods have been around for years. But now we have more helper tools that make the life easier.

For example, if the same app is opened on the Android TV or even another device, you don’t have to authenticate again, because Google will store those tokens for you and they will allow you to access that device.

And the Firebase authentication evolved and became more popular. A few years back if you wanted to use Facebook and Twitter as a login provider for your app, you had to use their SDKs. Now you can rely on Firebase to do that and that makes it easier for you, removing the dependencies from Facebook SDKs or Twitter SDKs. It’s very appealing for many developers.

And that’s exciting because even though authentication might not be the most exciting topic to talk in a conference, I think almost all of us have to do in our own apps, so it’s always nice to see different methods that exist and how to make it less boring than just having a text field with a user and a password and a button to log in.

— And in this evolving of authentications tools did there emerge a “best” one, or does it always depend on a specific use case?

— Yes, essentially, the authentication method really depends on the company and its size. For example, if you are a small company and you use services like Firebase that also allows you to authenticate and they make it very simple for you to do so.

There are other factors. For example, Fingerprint API is a very flashy thing and a nice feature, but in reality, not all the devices provide a fingerprint scan. So if your app is designed to work in one specific country, maybe just a small percentage of users there have fingerprint scans in their devices and they aren’t gonna be able to use that feature.

— Given that there are several ways none of which is inherently better, maybe it would be useful to create Android Authentication Blueprints to showcase different approaches to authentication? :)

— That’s a really good question! I never thought about it. Maybe we can ask during the session and see if people are involved and then you can go about it. That’s a good idea!

--

--

Mobius
Mobius

Written by Mobius

Conference for mobile developers