oursky / skeleton

Skeleton and instruction to get start for common Android project
MIT License
6 stars 4 forks source link

Review on kotlin #7

Closed louischan-oursky closed 6 years ago

louischan-oursky commented 6 years ago

I just had a quick look on the new kotlin skeleton. Here are comments.

  1. No need to commit .idea/. Please remove them.
  2. I doubt whether we should use Rx and Redux. Can we try Architecture Components?
  3. There is a android library called anko by the team of Kotlin. I think it is going to be useful. It even has layout DSL library that we can use directly, which can save us from inventing our own.

@rickmak @hidden-dimensions

hidden-dimensions commented 6 years ago
  1. .idea/ should be committed (at least once), recommended by jetbrains. We can consider ignore subsequent changes.
  2. I was hoping to get a similar environment / design pattern across android & ios. But if AC works much better we can explore. btw, while LiveData works like observable, it is supposed to bundled with ViewModel (quote: A LiveData object is usually stored within a ViewModel object and is accessed via a getter method, technically we could use it like a standard observable tho), so the use pattern is slightly different with redux - which is plain data store.
  3. anko seems good, I think we can adopt the layout DSL first, and maybe sql later.

More on AC LiveData only address part of the observer requirement, brings convenience life-cycle awareness with ViewModel (on Rx you need manual dispose or lifecycle module supports). However it lacks support on threading, distinct, map, filter and other operators. Even Google recommends using LiveData with ViewModel as view state, and Rx with business logic - LiveData & Rx might be used side-by-side if needed, it's not meant to replace.

Further reading: https://stackoverflow.com/questions/46312937/when-to-use-rxjava-in-android-and-when-to-use-livedata-from-android-architectura

rickmak commented 6 years ago

Just take a look at anko, agree the layout DSL is a good start.