Replies: 3 comments 7 replies
-
I am personally voting for Kotlin Style APIs. I think most of Android is already focused on Kotlin. |
Beta Was this translation helpful? Give feedback.
-
I use MapLibgre GL JS from more than a year now and it's one of the best Open Source project I have used until now. Now considering your question, I testify as a begginner with Android than it's another problem with this platform. Many samples use Java and it's difficult to understand some samples when two languages are used to do the same things. Normaly, Google recommend from 5 years now to migrate to Kotlin (https://developer.android.com/kotlin/first) and so I expect to found samples and projects using Kotlin BUT we have to do with legacy code! So it's not a simple problem. IMHO, the Android native project should be rewrited from scratch using Kotlin and because it's a lot of works the team should try to 'pair' all API (JS, Android, iOS, ...). Mapbox have do this a few month ago, the last version is full Kotlin (https://github.com/mapbox/mapbox-maps-android). I understand that this is not really an answer to the question asked. But the problem is broader than simply choosing a way to write a function or more generally the future code of the existing API. |
Beta Was this translation helpful? Give feedback.
-
Consistent API. If you introduce new API paradigms bit by bit, you'll have a very misaligned API for years, which is confusing. You'll then have to choose: Since b > a there is little advantage to having some of your APIs already updated. Also, I dunno if it is still the case, but using the kotlin |
Beta Was this translation helpful? Give feedback.
-
I would like to start a discussion about new APIs that we add to the (Android) toolkit. The Android platform of Mapbox GL Native codebase was written purely in Java originally, after the fork we have not done much expansion of the API surface since. When we completely redesign a set of APIs, I think it makes sense to re-imagine it with Kotlin in mind (see e.g. the annotations design proposal). When adding one new API method to an existing set of APIs, should we remain consistent with the original Java APIs, or do we want to create an API method that are more natural for Kotlin?
For example, in #2516 a new method is added for fetching a single (offline) region. The API implemented in the PR uses an interface to define the object the callback will look like.
This is in line with the existing API, but a more Kotlin friendly API would use a more functional approach with a callback with a single
Result<OfflineRegion?>
parameter that can communicate if there is a result, if there is an error or if there is no result but no error either.What do you prefer? Consistency or incrementally adopting Kotlin?
Beta Was this translation helpful? Give feedback.
All reactions