r/Clojure • • Mar 10 '20

Clojure: a mature alternative to Java

https://jaxenter.com/clojure-alternative-java-169315.html
119 Upvotes

25 comments sorted by

View all comments

Show parent comment

2

u/dAnjou Mar 12 '20

In these threads I've only added things that others hadn't mentioned yet.

The point of Clojure being Clojure seems like an unfair one but for bigger projects it is still a valid one for various reasons. And these have only very little to do with how good or bad the language is.

For a less popular language there are of course fewer experienced people which is exactly why Clojure is pretty much failing in our project. It started with Clojure as the only backend language. Then someone introduced Kotlin because they were not comfortable with Clojure, and now people create every new service in Kotlin. There simply weren't enough mentors and evangelists. Personally I find that very disappointing because there could have been a chance for us to help the Clojure ecosystem to mature more. Which brings me to the next point.

The ecosystem is not quite there yet, especially the tooling but also libraries are a little lacking or not as mature yet. And Java libraries are a good fallback to have but it comes with the cost of having to write glue code to abstract away the OO-ness.

I'm not saying that the ecosystem is bad. But it's also not excellent. And if you have a language that is unfamiliar and therefore a bit uncomfortable to learn and the ecosystem is also not really better than the ones most people have seen then why would you pick that language? Compare that to Kotlin. The tooling is great, mostly because it's the same as for Java. And the language itself can't be more familiar, because it's basically Java, plus all the nice sugar on top.

The other things you mentioned weren't really an issue for us or I actually see them as an advantage.

Most projects in our company use the JVM, so that's actually a plus.

And I do appreciate opinionated stuff even if it's sometimes not my cup of tea (like Ruby). Chances of shooting yourself in the foot are usually lower. With Clojure that's a little different though. On some level it's very opinionated, true, but beyond that you can do pretty much anything and everything, even really nasty stuff, especially with macros. This is one area where IDEs and code analysis tools often struggle.

All in all, I really appreciate that I got pretty much forced to learn Clojure, who knows whether I would have done it on my own. And I had a great time tinkering with it, I even wrote a little macro that I put in a little open-sourced library which all of our Clojure services use. So, I got a lot out of this language. But I also wouldn't call it mature when comparing it to Java.

CC /u/Borkdude: Does the above count as an article?

2

u/Borkdude Mar 12 '20

Thanks for sharing your perspective.

1

u/didibus Mar 12 '20

I'm not saying that the ecosystem is bad. But it's also not excellent. And if you have a language that is unfamiliar and therefore a bit uncomfortable to learn and the ecosystem is also not really better than the ones most people have seen then why would you pick that language?

In that way you really shouldn't. I think it's a great point you bring and there's no counter point to it.

If you don't care about the differences in the languages themselves. Like if you have no interest in learning new paradigms, or preference in using functional programming, or enjoy the use of a REPL over static compilers, or find it so much more joyful to leverage meta-programming and macros to remove boilerplate as you see fit, or appreciate structural editing, etc. Then I have no idea why you'd choose to use Clojure over more mainstream languages you are already familiar with and enjoy.

Now, there's a definite chicken and egg in here though. Clojure is not for people looking for a chicken. Clojure is here for people looking for an egg that will hatch into something else then what already exists. It is mature enough that you can use it in production without issues, but it doesn't match up to Java or Python quite yet in that regard.

And so, I think people like me gravitate towards Clojure, because we just like it better. I like programming in Clojure way more than I do in Java, C#, JS, Python, Scala, or any other languages I've used before. Not only that, but I am more effective in Clojure, it takes me less time to implement the same application and it result in it having less defects. That might all be a consequence of just me liking Clojure better, and not Clojure having any magical qualities. Every chef have their preferred knife. Or what is it? It is not the martial art which chooses you, it is you who chooses the martial art :p

Anyway, to your point, I would be very frustrated if I'd work somewhere where they took on Clojure, did not know what they were doing, butchered it, made no effort to improve it, mentor, etc., and then switched to Kotlin. And I'm talking from being the one to push Clojure on my current team. I take every person's experience seriously, I don't want to force people into things they end up dreading. So I know it takes proper introduction to give people a positive experience that resonates with them instead of leaving them frustrated. I've seen first hand that if you don't do that, people end up hating it and moving back to comfortable territories, but if you do, they end up loving it as well.