Android Developer Group Poznań #20

Paweł Świderski
3 min readOct 19, 2017

On Thursday (October 5th) I was participating in the meeting of the Android Developer Group from Poznań. It was 20th event of the group and first that I participated in.

I wanted to go because I think that it is always worth to learn some new stuffs from the other professionals. The specialists that were struggle with some problems and decided to share their knowledge.

The group is mainly for Poles because the language is Polish but the presentation slides are mostly in English. The website of the event:

The agenda was as follows:

  • “How to handle encryption keys in Android” — Maciej Markiewicz
  • “Make your Kotlin code less Javish” — Rafał Naniewicz
  • “Android Clean Architecture” — Arkadiusz Macudziński

I would like to go through each one presentation and share with you what did I notice and learn.

“How to handle encryption keys in Android”

The presentation was about encrypting data that the application stores. Speaker paid attention to not storing the key because of the security risk, if the hypothetical attacker can have a key, he/she can decrypt the data. The key should be provided by user e.g. by password, drawn shade, biometric information etc. Android Keystore can also be used to generate hardware-backed safe private key.

“Make your Kotlin code less Javish”

That one was made by Kotlin enthusiast. Kotlin’s enhancements according to Java were shown. In Kotlin there are properties instead of fields. Kotlin does not force us to check exceptions because each of them is unchecked. Kotlin provides great support for Android Development — with extension functions we can enhance Android API, make the development easier and the code cleaner. Standard kt extension functions are basic examples of extensions. There are:

  • let — executes block if value is not null.
  • run — allows to run operations on the object from the context of that object and returns different object.
  • apply — works like run but always return the given object (receiver object).
  • also — works like apply but you can access properties of the object that holds the also statement.
  • with —like run but it is a regular function, not an extension.

In Kotlin there are expressions everywhere. We can override arithmetic operators like plus or minus. There is auto close for streams. And of course there are lots of new cool libraries.

For testing we can use Mockito with MockMaker that opens, in fly, classes that are final by default. During the meeting the notion that MockMaker is slow came up. Anyway it can be replaced by PowerMock.

Tests in Kotlin are clear because they are titled in the form of sentences. BTW the same feature appeared in JUnit 5.

“Android Clean Architecture”

The last presentation was about clean architecture and MVP. Onion model of the architecture was shown and described — we have to depend on more general, stable code. Layers should be plugins to each other e.g. UI is a plugin to presenter layer so it depends on the presenter but presenter does not even know about UI.

The MVP model with splitting the code into layers was proposed:

  • View — stateless Activities and Fragments.
  • Presenter — class with business glue logic.
  • Domain — use cases.
  • Repository/model — all data providers.

The Single Responsibility Principle was mentioned as the most important one according to the software architecture.

Asynchronous calls should be solved by callback pattern. Nice solution for this provides RxJava library.

Unit tests and integration tests are crucial to the clean architecture.

Summary

I came back very pleased that I participated in the meeting. I definitely learned new things and I had a nice time. I hope I will have a chance to participate in the future meetings.

--

--