pockethub / PocketHub

PocketHub Android App
Apache License 2.0
9.4k stars 3.45k forks source link

Add Kotlin support and convert trivial models to Kotlin #1155

Closed veyndan closed 6 years ago

veyndan commented 6 years ago

I converted some trivial models (i.e. ones with basic accessors and/or not inner classes) to Kotlin. As this is a bit of a showcase of the benefits of Kotlin, there are a few things which just doing this has added:

Note: I did remove some documentation that I felt was uneccessary e.g. getGist() documented as @return gist.

aktiger87 commented 6 years ago

unsubscribe.

On Tue, Feb 6, 2018 at 8:25 AM, Veyndan Stuart notifications@github.com wrote:

I converted some trivial models (i.e. ones with basic accessors and/or not inner classes) to Kotlin. As this is a bit of a showcase of the benefits of Kotlin, there are a few things which just doing this has added:

  • All the fields are encapsulated (which wasn't the case in CommitMatch.java).
  • Automatic derivation of toString() (along with some other methods) which makes logging for debugging easier.
  • Classes are closed by default. There is a lot of inheritance in this app which sometimes baffles me, and to have the assurance that this is not the case semantically is good.
  • No properties can be null and this is enforced by the compiler. Again, this assurance makes it easier to reason about the state in which the model is in.
  • Reduction in verbosity which by looking at the change in LoC speaks for itself.

Note: I did remove some documentation that I felt was uneccessary e.g. getGist() documented as @return gist.

You can view, comment on, or merge this pull request online at:

https://github.com/pockethub/PocketHub/pull/1155 Commit Summary

  • Add Kotlin support
  • Convert trivial models to Kotlin

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pockethub/PocketHub/pull/1155, or mute the thread https://github.com/notifications/unsubscribe-auth/AKYHFLRLbUPzLkwdbwRPEgi_TxBg3H8aks5tR5vqgaJpZM4R6Txz .