Android Code Architecture, With mix Pattern

Ta Theerasan Tonthongkam
ta tonthongkam
Published in
2 min readMar 8, 2018

Since Google has announced Kotlin is first-class support also release the stable version of AAC (Android Architecture Components) there are so many possible ways to implement an App with good code structure, but why we stop only one pattern when it can be combined?

Are you out of mind to do a mixing code pattern?

The purpose to write code in a good architecture/pattern is for making the code maintainable, readable and testable as long as it still achieves to the goal why should we stick to only one pattern? NO, it can be adaptive and combine by bringing the good side of the pattern into your code.

In this Project, I use “https://newsapi.org/" as an API. The scope of the project just show a list of news and you can click on any news to see its detail. This application also supports the screen rotation. And I provide some of the unit-tests.

Better if you know these before

  1. Basic reactive programming, despite I use LiveData and Kotlin I be able to write android App with a Reactive pattern, it’s really fun comparing to normal Java — read more
  2. MVVM code pattern, this project still use MVVM pattern in some path because the pattern was proved that it fit with mobile development. — read more
  3. Repository pattern, one the architecture that Google proposing is the repository pattern that comes along with AAC, Google has already worked thru it, why we have to change it? Just follow Google — read more
  4. Last but not lease, Kotlin — read more

What is the final pattern?!!

This project also had Router and DataBinding so the pattern may be called, MVVM-R-Binding-Repository — MVVM mix

This is my Git Project feel free to try and explore, more comments to improve this code pattern will be appreciated.

Screen Shot

The Screenshot of the app

Improvement

Of cause, this project still has areas of improvement, please tell me your thought, I’ll try my best to improve it and contribute this to Android Developer Community.

Thanks

--

--