r/programming • • Jan 07 '24

Why is Jepsen Written in Clojure?

https://aphyr.com/posts/367-why-is-jepsen-written-in-clojure
67 Upvotes

30 comments sorted by

57

u/Main-Drag-4975 Jan 07 '24 edited Jan 07 '24

tl;dr:

  1. Interop with Java ecosystem for broad database driver support

  2. Lisp goodies like macros and a REPL

  3. Clojure is a stable language

Incidentally all three of those provide high leverage to Aphyr — less code to write for the first two, less code to rewrite for the third.

Seems just right for a project where 95% of the code is written by a single incredibly gifted programmer.

9

u/devraj7 Jan 08 '24

Good luck when that programmer moves on to another job/project.

Now you're stuck with not just an esoteric language, but one that's dynamically typed. Better pray you have a lot of tests and be ready to rewrite your code base in a more mainstream language.

7

u/SKabanov Jan 08 '24

This is exactly what happened in a client's project I worked on in 2022. Some dev who was obsessed with functional programming - they hand-rolled an FP-based validation mechanism in a Java codebase instead of using Javax/Jakarta - wrote a key component application in Clojure, and the development on that codebase floundered after they left because the majority of the other devs in the project were afraid of even touching the code.

3

u/Rakn Jan 08 '24

I've worked for a company that had a Clojure team at one point. It also happened to be responsible for a pretty central piece of infrastructure. Keeping that team staffed and the services alive was a constant concern.

That in turn lead to an aversion of trying anything else than the one blessed language (Java).

6

u/[deleted] Jan 08 '24

whats so esoteric about it, i've learned it quickly myself to work on something I was integrating with and then ended up enjoying the language and I'm not even a good programmer... is the bar so low anymore that people can't be helped learn something so simple?

3

u/SKabanov Jan 08 '24
  1. Polish notation takes a bit of time to get used to, especially given it's wholly unlike the syntax of mainstream languages like Python, Java, or Javascript.

  2. The mass of parentheses that get piled up in complex expressions are extremely fatiguing. Rainbow Brackets is a useful plugin for working with bracketed code like Java/Kotlin or HTML files; for Clojure, it's nigh-on required to track just which parenthesis belongs to which nested expression.

I agree with you that the learning curve isn't that bad once you power through the initial barriers, but given that Clojure isn't a language that's in wide use just within the JVM ecosystem, most devs are just going to focus on ventures that have more immediate and obvious payoff.

3

u/Main-Drag-4975 Jan 08 '24

Jepsen is a database engine testing tool. I’m sure folks could build their own in a more mainstream if they expect they’ll use it enough to justify the expense.

I’ve only worked on one day job project that involved clojure, and it wasn’t a problem to update it as needed. We were using it for some funky shell scripting to transform a bunch of source code files before handing it over to customers.

4

u/pavlik_enemy Jan 08 '24

Yep. I wanted to use Jepsen to test ClickHouse back in the day but gave up because of Clojure even though I wrote some Lisp (for SICP obviously)

-14

u/pavlik_enemy Jan 07 '24

And that makes it difficult to contribute to. But maybe it’s also one of the unstated goals

27

u/Main-Drag-4975 Jan 07 '24

Can’t really fault someone for choosing the right tool for a job they created for themselves. I imagine there weren’t a lot of volunteers to write the first few thousand lines of Jepsen.

-9

u/pavlik_enemy Jan 07 '24

Well, “right” just means author liked. The nature of Jepsen is such that any number of languages would’ve been just as suitable

9

u/trilobyte-dev Jan 08 '24

Well, in this case it meant an incredibly expressive language that could interop with one of the most prolific languages at the time, which was not very expressive at the time. Why blame Kyle for not wanting to write lots of Java garbage boilerplate?

-1

u/pavlik_enemy Jan 08 '24

It obviously had to be JVM cause it has the best database drivers but the language could have been Ruby or Scala

5

u/codemuncher Jan 08 '24

He literally says in the article:

“Libraries don’t “rot” anywhere near as quickly as in Scala or Ruby.”

So there’s your answer.

0

u/pavlik_enemy Jan 08 '24

That’s some definition of “rot”. I worked on a nine-year old Ruby project with like 250 dependencies and we managed to keep it up do date.

2

u/twinklehood Jan 08 '24

You may have managed, but as a rubyist with much love for the language, I of course have to concede that the upkeep is rather high, compared to less popular ecosystems.

Rot is normally associated with bitrot, ie. the passive decay of software despite nothing changing. So if your team was keeping dependencies up to date (which for sure is no automatic task in the ruby ecosystem) then rot is not really a concept you can say much about, as you would not have been exposed to it.

Picking tools where the upkeep is low is a completely fair choice.

0

u/pavlik_enemy Jan 08 '24

Well, no one forces you to update a dependency that works

→ More replies (0)

2

u/Plenty-Effect6207 Jan 08 '24

Maybe it’s time to admire what others have accomplished and shared, and think «that’s awesome, I wish I had it in me to do something like that.»

32

u/Brilliant-Sky2969 Jan 07 '24

Why x.y.z was written in a.b.c, is often because it's the language you know best.

17

u/wuteverman Jan 07 '24

Or the language where the assumptions and beliefs about what’s desirable and important best match your own.

7

u/pavlik_enemy Jan 07 '24

Or want to know

11

u/karmicthreat Jan 08 '24

Because code witches love lispy languages.

3

u/Dragdu Jan 08 '24

Love performance being mentioned in the same breath as "within 1-2 orders of magnitude from Java".

Just a completely different world.

1

u/CurtainDog Jan 08 '24

Just a completely different world.

Uh huh, a world where you don't invent problems that don't need to be solved.

Aphyr's point was that idiomatic clojure was fast enough, and if you want to mangle it to make it faster clojure doesn't really stand in your way.

1

u/Dragdu Jan 08 '24

mhm, I am not criticizing him, you don't have to jump to his defense.

In my world, you will find explicit SIMD and manual prefetching in hot loops. Reading someone talking about reasonable performance being within orders of magnitude of Java is just an interesting look into a completely different one.

1

u/rpd9803 Jan 09 '24

I remember my first beer

-8

u/PurpleWazard Jan 08 '24

I read this as “why is Japan written in culture”