codebase ep. 2: Clojure with Ykä
codebase is a new developer community show on Youtube. It's a celebration of technology and different people working with different technologies. Each episode, I'm joined by a guest who knows something I don't. Together we chat about life and tech and build something live on stream.
In the second episode of codebase, aired live on April 27th, I sat down with Yrjö Kari-Koskinen – or Ykä as I know him – because I knew of his interest towards Clojure. In addition to being a Clojure developer, Ykä is also a host of Finnish backend technology podcast Koodia pinnan alla which I am a big fan of, so it was super nice to sit down with him to talk about life and technology.
If you want to know when new episodes of codebase come out, subscribe to the Youtube channel.
What is Clojure?
Clojure is a dialect of Lisp developed by Rich Hickey, first published in 2007. It's a predominantly functional programming language that runs on top of Java Virtual Machine (JVM). Its Java connection offers access to the wide Java ecosystem directly from Clojure itself.
(println "Hello codebase!")
A great place to start learning Clojure is its official guide Learn Clojure.
One of the neat workflows of working with Clojure that we got to see in our live coding session is how Clojure is being developed with a very tight feedback loop using a REPL built into the editor.
With Clojure, it felt much more tightly knit into the workflow though. In the stream (around 38:15 onwards), you can see an example of how Ykä was building the data flow from external API to what our functions needed to return by working in the REPL, verifying the code and data was working as expected and then transferring the code into the source code files.
Building a bit of web backend
In the livestream, Ykä showed how to build a bit of web backend that fetches data from one source (in this case, 3rd party API) and translates that into the data we want to send to our frontend. You can find the example code that was used from ykarikos/hello-codebase.
In this example, we used MetaWeather's API to find temperatures for a given city for a time period and calculated the average temperature that would then be sent to the caller of our backend API.
The example is bit contrived since we only have a limited amount of time to live code in the streams but it provides a really good starting point in case you want to start experimenting and learning Clojure with something that's more real-life suitable than just a todo app.
Get involved with the Clojure communities
If you're interested in Clojure or are already working with it, you should definitely join the Clojure communities near you. There are global Clojure community discussions in for example at Slack, Zulip and IRC.
Here in Finland, there's also a very active community that organizes meetups and ClojuTRE conference and ClojureBridge workshops. Local Clojurians can also been seen in Koodiklinikka's Slack's #clojure channel and in #clojure-finland channel in the global Clojurians Slack.
By searching for "clojure [your city]" in your favorite search engine, you can find your local Clojure community. I personally find developer communities great places to spend time and get to know fellow developers who share the same interests as you do. And they are great for the moments when you get stuck or have trouble understanding something.
Sign up for Syntax Error, a monthly newsletter that helps developers turn a stressful debugging situation into a joyful exploration.