Announcing poetimizely library 📢
We love highlighting the great work folks are doing in progressive delivery & experimentation. Recently, our customer Patxi Bocos created a a library that generates type safe accessors for experiments and features of a given Optimizely project. We wanted to repost his Medium article with his library to share with our broader community. Take a
We love highlighting the great work folks are doing in progressive delivery & experimentation. Recently, our customer Patxi Bocos created a a library that generates type safe accessors for experiments and features of a given Optimizely project.
We wanted to repost his Medium article with his library to share with our broader community. Take a look and keep the conversation going in our Slack developer community.
After spending the last weeks working on a library, today, I am happy to announce the first beta release of poetimizely. (Thanks to Ralph who is contributing to the project 🙂).
What is poetimizely?
poetimizely is a library to generate type safe accessors for Optimizely experiments and features.
Type safe means that referencing experiments and features are safe, reducing the possibilities of making a mistake when typing names. This makes sense because both experiments and features are part of a closed set of values (determined by whatever is defined on Optimizely).
Why should I use it?
Optimizely is a very powerful experimentation platform that I have worked with in my last jobs. The power is on the platform side, whereas clients are usually just querying if the current user is under a given variation of has a feature enabled.
There are two main features from Optimizely that poetimizely facilitates using.
Experiments 🧪
Each experiment has a key identifying it uniquely as a list of variations. It basically allows having like a switch/when statement (expression in Kotlin) controlled by the data/criterias defined in Optimizely.
A client typically asks which variation entered and behaves differently, depending on the result.
When using the Optimizely Java SDK, our Kotlin code will look like:
val variation = optimizelyClient.activate("experiment-key", userId)
when (variation?.key) {
"variation-1" -> TODO()
"variation-2" -> TODO()
null -> TODO()
}
With poetimizely we get rid of all those strings and they get replaced by enums (for variations) and objects (for experiments) automatically generated by the library:
val variation = optimizelyClient.getVariationForExperiment(Experiments.TestExperiment, userId)
when (variation?.key) {
TestExperimentVariations.VARIATION_1 -> TODO()
TestExperimentVariations.VARIATION_2 -> TODO()
null -> TODO()
}
Features 💡
If experiments are the switch/when, then features are the ifs. Let’s see an example of how we code using a feature with the SDK:
val enabled = optimizelyClient.isFeatureEnabled("feature-key", userId)
Then with poetimizely we provide the ability to reference a feature with any of the values contained in an auto generated enum:
val enabled = optimizelyClient.isFeatureEnabled(Features.FEATURE_KEY, userId)
If you want to know more please check out the README file.