My Journey in Functional Programming at Ona

Ona Staff
April 07, 2019

by Racheal

Day one

If someone told me last year I would be doing a different programming language in 2019, I would have shrugged it off. I had no prior experience with Functional Programming before I joined Ona. Yes! You heard me right, this was a completely new concept to me coming from an Object Oriented Programming background. A little history about my programming journey: I began with Ruby on Rails, a Ruby web application framework, before learning the language itself. A little bit odd, but it did spark my interest.

Clojure Lambda

My first day at Ona began with an introduction to two engineers on the Zebra team, Mark Ekisa and John Mwashuma. Zebra is the front-end piece to Ona Data, a data management platform used for real time data collection and analysis written in Clojure and ClojureScript. Just in case you get confused like I did — it’s just a random name they gave themselves!

“Have you done any functional programming before?”

That was one of the questions Mark asked after the pleasantries. A chill ran down my spine. Was I ready for this? I knew I would be learning something new, but this was a major milestone for me. Good thing Mark assured me it’s not as difficult as I assumed.

Code code code!

We started off by installing Clojure, a functional programming language running on the Java Virtual Machine. Next, I needed the Java runtime environment installed as well. We were then required to install Leiningen, a tool used on the command line to manage Clojure projects. In layman’s terms, this tool allows you to run your Clojure code on the console/terminal using the command lein repl. Pretty simple!

 $ lein repl
User => (+ 3 4)

That was my first functional code! Mark had to remind me continuously that we are dealing with functions. It took me two trials before I understood what he meant, that I should basically put them in brackets. Talk of mindsets, this one changed my way of thinking completely. One of the main differences I noticed about Clojure is what the syntax looks like. Take for example: calculating (5 + 4) / 10

The syntax in Clojure would be:

(/ (+ 5 4) 10)

This is quite different from how it would be in other languages, but they say “different is good” and I agree!

I am not a master yet, but once you get started on functional programming, you appreciate the beauty of shorter lines of code and the power of functions. It is not something you can grasp overnight, but it is an enjoyable learning curve, although a steep one I must say.

First Clojure App, whoop!

By the end of my week, I had built my first web application in Clojure. A guestbook application that allows guests to leave a comment. Exciting right? Well, the goal of it all was not to build an application, but to make contributions to Zebra in my journey of becoming a great software developer.

I have always believed if it scares you, it’s probably worth doing, a principle I have lived by for a while. No programming language is easy and that goes for Clojure as well. It scares me when I have to write a function yet I am not sure what the exact syntax should be, but as long as I keep doing it then I will overcome the fear. It takes practice, time and a great team to build something excellent and I am glad Ona is giving me that opportunity.