#begin 

So.. recently I’ve finally gotten back into writing some Clojure and ClojureScript (cljs) again. It’s been a long time that I did some serious Clojure development but I decided to really get back into it in 2021. In this small blog I would like to write down my thoughts on getting back into Clojure development.

Currently I’m working on a project that includes some front-and-back-end web development with cljs and Clojure. I’ve created some small test apps in the past, but nothing really operational or serious.

I think it’s really fun to get back into Clojure again. Solving problems in Clojure, or any Lisp for that matter, is really different from imperative languages. It really forces (or challenges) you to tackle problems in a different way. It spices things up and makes my brain tick differently. I work with statically typed, imperative, OOP languages mostly and professionally. So getting some Clojure in on my free time is really interesting.

The IDE

My previous Clojure experience was mainly focused on Clojure, without any mention of cljs. The past month I changed my IDE from Intellij + Cursive to Atom with some Clojure/lisp packages and I’ll explain why.

I’ve always been a really big fan of JetBrains’ products (yeah Kotlin too! :D). Their IDE’s are simply superb and I’ve used them for such a long time now that anything I do within their IDE’s is simply muscle memory. My efficiency is really high and working with other IDE’s just makes my really annoyed when I miss some shortcut or functionality.

So when I was doing Clojure development before, I always used IntelliJ with Cursive. This allowed me to keep using my trusted IDE, shortcuts and functionality. This works perfectly well with Clojure development yet there are some unsupported things. Sometimes macro’s not not recognized or some namespacing issues arise. But I’ve always managed to work around these shortcomings so they never really bothered me and I know that Colin Flemming is working very hard to support as many Clojure and cljs features as he can. You can listen to a podcast with Colin about cursive here. He was a guest on one of my favorite podcasts, the ClojureScript podcast by Jacek Schae. Jacek is great and many cool guests from the Clojure community have appeared on the show. I promise I’ll talk some more about podcasts in another section of this post.

In this particular podcast, although it is a bit dated, Colin talks about how cljs support for cursive is a bit lacking. And, it still is to this day. That is why I changed my IDE from Cursive to ATOM. Why Atom? Well because Jacek recommended this setup in one of his courses I checked out before getting back into cljs development.

Jacek talks about how many other IDE’s feel to heavy and he was looking for a more lightweight approach to Clojure development. So he wrote a nice blog on how to setup Atom for Clojure development. I have experienced this too, Intellij + cursive (although Jacek was talking about Emacs)  seem to use a lot of RAM memory. I think this might be related to the way Intellij works in general. Intellij uses a lot of static analysis to provide many of it’s functionality. On my laptop, this uses a lot of my RAM, and when I have to host a web-server for development, my laptop tends to slow down way to much. You can read Jacek’s blog here.

So I followed up on his advice and setup Atom exactly as he describes in his blog and I have to say it works pretty nicely. I still do not have any of the keybinds trained into my muscle memory but I think the setup in general works great. I’ve also noticed my laptop does not slow down as much as with Intellij. Another advantage is that there is way better support for cljs which is very nice when you’re trying to write a cljs app :D.

The project

So I do not want to spoil the project I’m working on just yet, but what I would like to discuss is the tech stack. Which in the Clojure community is frequently used, but outside might seem very exotic.

As I hinted before I’m doing some front and back-end development..

For the front-end I’m using ShadowCLJS as a built tool. This tool is simply brilliant. With Shadowcljs you can use any Clojure(script) package and any npm package you like. Shadow will pull in all dependencies and make sure they are included in your project correctly. It will also be able to build and deploy correctly.

For a front-end framework I’m using Reagent, which provides a minimalist interface to React. I also combine this with a framework called re-frame. Re-frame is a functional and reactive framework you can use to make react apps which uses Reagent as the interface. The combination of both these frameworks is very nice, easy to use and learn.

The difficulty however is that I’ve never been much of a web-developer, let alone, a front-end developer. So the real learning curve for me personally is to get to know all possible css features. Grasping css concepts is not really hard, but knowing all the properties, what they impact and how to combine them properly can be pretty daunting.

For the back-end, although I have not yet written any lines of code, I’m planning to write it all in Clojure. For the build tool here I’m probably going to use Leiningen. I’ve used this build tool before and I like the way it works. Leiningen makes it really easy to setup gradle and building the .jar files you eventually use to deploy.

The first thing I need in the back-end, is a nice Router. The best one I know, is Reitit. I’ve used this in a small prototype I made a coupe of months ago and I like it pretty good. It’s a data-driven router so you just define some data-structures with event handlers for all your routes. From there you can write what-ever code you want to handle each request. Reitit also allows you to add middleware is a simple way.

I’m not yet sure what I’m going to use for a database. Since I’m in the Clojure world the first thing that comes to mind is Datomic but I’m not sure yet. I may end up using something link Mongo, as long as I don’t have to write any SQL I’m OK. (yeah, I don’t like SQL).

Podcasts

I promised to get back on the subject of podcasts so… here it is. When it comes to Clojure related podcasts I listen to two podcasts for now.

First I started listening to the ClojureScript podcast hosted by Jacek Schae. I found out about this podcast summer 2020 and I really enjoyed it till now. I always listen to podcasts during sports and commute to work and since it was summer I was biking a lot. So I really “binged” the ClojureScript podcast in a matter of two or three weeks. I encourage anyone who is interested in Clojure to listen to this podcast since it is really hitting all the spots. I think Jacek even structured the seasons of his podcast to like; season 1, syntax and functionality of Clojure, season 2, IDE’s and build tools, season 3 frameworks etc. So when you are a total Clojure newby you can start listening from season 1 and get a grasp of all the concepts that are in the language.

The second Clojure related podcast I listen to the ClojureDesign (Functional design in Clojure) podcast hosted by Christoph Neumann and Nate Jones. This is also a really interesting podcast, but a totally different format. In this podcast it is just Christoph and Nate discussing how they would tackle problems in a functional style using Clojure. So there are no guests appearances, at least, not to the point to what I have listened of the podcast. This podcast is more hands on discussions of two developers doing some pair-programming and solving a problem. So, for example; in the beginning they are making a simple twitter scraping app that collects all posts related to Clojure or clojurescript. They talk about how to do this and discuss some idea’s of where to for example store the access tokens, comparing the dev and the live environment. Another really interesting set of podcasts they did was on REPL driven development. This is something I really did not grasp in the beginning. Listening to these podcasts really reminded me of how I was doing things. It’s really funny how many people appear to experience the same issues. And when finally people understand how Repl driven development works everything clicks all of the sudden. So I encourage anyone who wants some more hands on discussions about Clojure to listen to this podcast. Just for reference; currently there are 90 episodes of this podcast, and I’m only at episode 23 and already liking it very much!

There are even more interesting podcasts related to Clojure, ClojureScript or LISP in general. There is for example; the defn podcast hosted by Vijay Kiran. I’ve met Vijay when I appeared as a speaker at the Dutch Clojure Days 2019. He’s a cool guy haha. You can listen to all the episodes here.

Then there is the Cognicast, from Cognitect itself and LispCast from Eric Normand, a Clojure consultant and functional programming enthusiast.

Next?

I’m not sure. I’ve been doing this Clojure thing and some reading in the time between. I might do some book reviews in upcoming blogs or write in some more detail about the things I do with Clojure. Plus, I have one more blog about SOLID coming up, which I expect to be a large one since I think it is about the most important principle of them all. Without the Dependency Inversion Principle, OOP does not make any sense so I think this is going to be a large blog.

#end

01010010 01110101 01100010 01100101 01101110

Hey, sorry to bother you but you can subscribe to my blog here.

Never miss a blog post!

You have Successfully Subscribed!