Sadly, this is the last post on our journey through EuroClojure. We explored the basics of AI and application security in my first post, discovered new tools in the second one and now all we have to do is to put them to work with some real life experience.
The following talks are showcases of applications used in the real world, from real users, that the speakers shared with us to show what they achieved using Clojure.
Moving people with Clojure
Authors: Abhinav Sarkar, Kartik Gupta - Summary - Video
This talk was about — you guessed it — moving people with Clojure. It focused on an Indonesian company that moved from a Java monolith to a Clojure service — also passing through a Golang service — in less than two years. They were able to rewrite their applications and go into production in about two months.
Go Jek is an Indonesian company founded in 2010. They started out offering two-wheel transportation by phone call, but today, they offer a lot of different services by drivers, including delivery services (for food, medicine, tickets and other items) and rides.
In early 2016, they moved from a Java monolith service to a Golang service. In August 2016, however, they decided to move to Clojure due to its features and flexible domain model. Believe it or not, it went from production to a smooth and almost bug free release in two months!
How did they do that and why? The first thing that comes to my mind is the code syntax. For the functionality of finding an available driver in the selected area who’s able to complete the requested task, they moved from a single, huge function with lots of code lines to a thread macro and a list of smaller functions. What does that mean? Easier code maintenance, readability and writability.
But how did they move from one service to another? They built the clojure service and sent it a copy of all the live traffic, which was then directed to a mock server.
Thanks to the generative testing, it was easy to test its functionality on ever-growing data, until the result was good enough to be released. At that point, the testing continued on live data. One per cent of their traffic was redirected to the Clojure allocation service and then to the same servers that received data from the Golang service. From there, a gradual rollout allowed them to completely move to their new service without any major hiccups.
Using Clojurescript to launch iOS/Android apps to 1M users
Author: Emin Hasanov - Summary - Video
The author of this talk gave a very deep, thorough context to explain the needs for this project and the reasons behind his choices.
The author is from Azerbaijan, a country between the Caspian Sea and the Caucasus Mountains which has seen rapid technological growth in the last few years. This, of course, influences people’s everyday lives and their expectations for technical products — especially mobile apps since nowadays, there’s a native app for almost everything.
That’s why they needed a quick solution to create a mobile app for their website, a buying/selling online service similar to Craiglist.They had some key criteria for the project:
- Be able to launch and iterate quickly
- Maintain same codebase for iOS/Android apps
- Avoid having to use Objective-C or Java
- Have access to platform native features
- Get fast, native experience on both platforms
As most of you know, the next step is to investigate all the possible solutions and find the best match for the project’s needs. And that’s exactly what was done, listing all the pros and cons of each possibility:
- Website wrapper
- Quick and easy, same codebase
- Worse experience than website due to user expectations
- Doesn’t add much value, except for an icon on your screen
- Part native, part web views
- Easy to start, lots of code shared with website
- Need to know native platforms
- Slower than native apps in many cases
- App store updates still required for any change to native code
- Almost native
- React Native / Xamarin / NativeScript / others
- Develop using the same tools and get almost native apps
- Most of the code is shared between iOS/Android
- Most updates do not require app stores
That’s where ClojureScript comes into play. They opted to use Reagent, a framework built on top of React and compatible with ClojureScript. This allowed them to simplify the code, define components using functions and data, manage the app state with atoms and trigger the re-render function by changing them.
That worked: it gave them what they needed, and it was helpful to have immediate feedback on screen thanks to Reagent and React. The Transit data format gave a final boost to this whole system. Why? Because it’s language-agnostic, supports any data type, accepts arbitrary keys and works on top of JSON.
The app reached production in three months and launched one year ago for both iOS and Android. So far, it has almost 200,000 installs, 20% of the daily sessions are from the app, 99.8% of the sessions are crash-free on both platforms, and it has an average rating above 4.7 from around 3,000 reviews.
Overall, I can say I’m really happy about this experience. All my worries about being a woman junior developer at a tech conference disappeared the exact moment I was welcomed and got involved in the social groups at EuroClojure.
I’ve realised that my knowledge has improved. Even if what I’m bringing back is a list of tools and indirect experience, at least I now have something new to explore.
Will I implement any of these tools? Hard to say for sure, but I’ll definitely put them on the table the next time I need to improve an application’s security, come up with an idea on how to change technology or build a robot that helps me move house!