Why Clojure?

4 minute read

In this blog I would like to tell why I am choosing Clojure. I hope you like it.

Bigger and bigger projects

As a software architect, I am looking at bigger and bigger projects. Some projects are about 0.2+ million lines. It was written in Ruby on Rails, and had no tests, maintaining it was a nightmare. I was in another project which had 0.1+ million lines, and it did have 80% test coverage, but still it looked like a nightmare.

I was also involved in projects where Ruby on Rails was combined with Kafka, but all those design patterns what they used sucked and was not practical. They were into the design pattern and theoretical perfection rabbit hole and considered themselves perfect. Nothing can be done, their destiny is to create programmer misery.

I am also dragged into projects where lot of data processing is needed, I used to code to pull huge data for financial institutions, health sector, e-commerce etc. For all this strangely Ruby on Rails was used without considering pure Ruby as an option.

As I said before 0.2+ million lines of code means lots of business logic, so imagine, lot of things and states to remember if you are using OOP. I want to escape these things and want to explore Clojure.

JavaScript hell

I use Ruby on Rails to develop web applications. In early days, I think in Rails 3 we had a thing called RJS (Ruby Jaava Script), where Prototype and Scriptaclous were hidden behind neat Ruby interface. Then Rails switched to jQuery and CoffeeScript, jQuery needed investment and time to learn, though CoffeeScript eased the transition by making us write less code. Now JavaScript in Rails is a mess, we have Vue, React, Angular, Ember etc.

If you know Rails, they are slapping a label that you are a full stack developer and telling one to learn JavaScript framework, which sucks.

I Love the way Blazor and Rails 7 has taken. Blazor lets you target the browser with C#, and in Rails 7 one could have complex interactions without using JavaScript.

I have been tormented by Rails community a lot. I live in a world where people choose front end frameworks without knowing what value it adds. They don’t know if it would speed up or slow down the pace of project, they don’t give proper justification. The only justification is that lots of people use it, so do we.

If you tell an engineer to build an airplane with paper rather than metal because there are more paper planes on this planet, I don’t know what to do. I have to consider those people as not worthy of software engineering.

Design patterns are a problem

When you approach deci million lines of code, object oriented design becomes hell. Some random object talks with another, you try to streamline it going into design patterns, that might give an illusion that that things are fine, but things would become hell.

Design patterns are itself a problem. They are just a carpet where we can sweep our dust under.

Lot of people talk about Clojure

Richard Stallman

Richard Stallman, arguably the best hacker around talks great about Lisp, Clojure is a dialect of Lisp. What ever Stallman has said has come true. He said tech companies are spies and it became true. He said libre software is the only way out, and we in the world now are realizing it. He is a visionary. Possibly one of the most intelligent man on Earth.

Uncle Bob

Robert Marting who is a very respected programmer has got to say this stuff about Clojure, watch the video above. This video is one of the prime factors why I started to look into Clojure.

I would highly recommend any one to read Clean Code, which would teach any one to program better.

Targets almost everything

Clojure targets everything. It’s targets JVM, so I can write server side code; it targets JavaScript (see Clojure Script), so I can write code for browser without even thinking about messy JavaScript; it targets Dart (see ClojureDart ), so I can even write apps in Flutter. This one language fits all.

Data Science & Artificial Intelligence

Scicloj

My college did not allow me to study Artificial Intelligence, I badly wanted to learn it thoroughly, I did few projects in it using the Python libraries available and then switched to Julia. But do you know Clojure was initially fueled by Data Science?

There is a project called Scicloj https://scicloj.github.io/ where you can find info on how to use Clojure for Data Science.

REPL driven development

I really don’t know what REPL driven development is, but I am beginning to find out slowly what it is. I tried to use cider with Emacs, but I failed. I am experimenting with Calva with VSCodium. I will be blogging those experience soon.

Conclusion

Join me in this wonderful journey I will take. Hope it will enlighten your coding experience.

Updated: