Experimental features in Android extension is good for Production release
Asked Answered
E

1

9

I'm using the @Parcelize feature in android development using Kotlin language.

To use them I have done the below modifications in build.gradle file.

apply plugin: 'kotlin-android-extensions'

then

androidExtensions {
    experimental = true
}

I'm successful in using the above feature. But is it recommended to use them for production release or only for development purpose alone?

Ensoll answered 14/6, 2018 at 10:52 Comment(1)
well, if nobody ever tries it in production, how can it ever get out of its experimental state?Ennead
B
11

This isn't just an Android-thing though, it's Kotlin in general. Kotlin has quite a few experimental features, such as coroutines and the android extensions.

If you read the docs, you'll find this:

Experimental features, such as coroutines in Kotlin 1.1, have exemption from the compatibility modes listed above. Such features require an opt-in to use without compiler warning. Experimental features are at least backwards compatible for patch version updates, but we do not guarantee any compatibility for minor version updates (migration aids will be provided where possible).

Experimental features simply mean a different compatibility system. They still work (beta builds fall under EAP, and EAP has no guarantees for compatibility or stability). Experimental features are technically releases, which means they're as stable as any other language feature (as in there can be bugs, which there always can be, but it's intended to be stable).

So if you want to use it in production, do it. The experimental features have different compatibility modes, but they should be as stable as any other language feature. They're "safe" to use in production without much problem. You might have to re-write code if there's an incompatible update, but that's a development problem and not a release problem.

However, the android extensions docs also has a mention of the experimental part:

Android Extensions plugin includes several experimental features such as LayoutContainer support and a Parcelable implementation generator. These features are not considered production ready yet, so you need to turn on the experimental mode [...]

Considering the things I mentioned earlier, this probably means the feature itself isn't finished, equivalently to the coroutines. You can use it in your production releases, but it's not considered a production-ready component of the Kotlin language. And since it's experimental, it has been released. Releases are usually better than EAP versions.

See also this forum post on the Kotlin forums (it mentions coroutines, but some of it applies to other experimental features as well).


And, obviously, if it doesn't work in development, it's most likely not going to work in production either. If something in the extension is completely broken, don't use that specific feature. It doesn't necessarily mean the entire extension is broken though. Generally, even with EAP, if it works, you can use it in production.

Brierroot answered 14/6, 2018 at 11:39 Comment(4)
Can you give tell me why you know that experimental apis are as stable as any other language feature? The site you cite is saying Experimental means "try it only in toy projects": can you give me other sources? I tried to google it but without successErbium
@Erbium No, because there isn't anything I can do about them changing their own docs. The source said what I quoted when I wrote the answer. They've apparently redefined it since. I also never claimed it was stable, I only pointed out that the docs (at the time) didn't state that experimental features weren't actively discouraged for production use (aside the point stating it comes with more maintenance work because the API may undergo breaking changes at any time, but that's just risk assessment as an early adopter).Brierroot
The answer really needs an update, but I haven't touched Kotlin in, what, 3? years or soBrierroot
No worries I thought you may have an update and thats why I asked(still thanks). The accompanist website also has a Accompanist FAQ Article, where they ask the question Is Accompanist safe to use in production?. So your point of view is probably still trueErbium

© 2022 - 2024 — McMap. All rights reserved.