What Is Your Take on "the Zen of Clojure?"

PEP 20 (aka “The Zen of Python”) is famous for establishing an ethos for the Python community.

This line, in particular, is often cited as a strength:

“There should be one—and preferably only one—obvious way to do it.”

Inspired by the Python example, the Ruby community has embraced the opposite maxim:

“There is more than one way to do it.”

Suppose you were tasked with wiring “The Zen of Clojure,” inspired by the Python example.

Abstract:

“Clojurian [your name] succinctly channels the BDFL’s guiding principles for Clojure’s design into [N] aphorisms.”

What would your version sound like?

3 Likes

What I feel I value the most about Clojure is its welcoming community. It’s taken years to build and the etiquette has been one of the cornerstones. That document is what I’d begin with.

7 Likes

Wouldn’t that just be the Rationale from here: Clojure - Rationale

Maybe I’m just dating myself here, but that’s Perl’s motto right there… Ruby did pick it up (and it’s better for it, I think…I’ve always found Python slightly annoying in comparison).

By contrast, this is one of the reasons I much prefer Python over Ruby in principle.

In reality, the 2.7/3.x schism prevented me from adopting Python, which I’m still a bit sad about.

(I am not sad about the many reasons that have prevented me from adopting Ruby)

Some people say Clojure leans toward Ruby rather than Python in that respect but I’m not so sure: there is idiomatic Clojure and it’s not just a plethora of alternatives, most of the time.

As for the “Zen of Clojure”, I totally agree with @jan and that is something that has repeatedly been voiced by both Rich and Stu over the years.

I agree this is available in various talks on YouTube, blog posts, documentation, and books. But I haven’t seen any attempt to summarize what Rich and Stu have said succinctly in one place. Some passages in the books “The Joy of Clojure” and “Elements of Clojure” come pretty close.

This page on the official website is the closest thing I’ve found.

Thanks, @jan! I hadn’t seen that article on etiquette. It does indeed lay down some clear values. And I second your impression of a welcoming community.

I assume you replied to my post before reading @jan 's post? :slight_smile: Since you agreed with the etiquette page rather than the rationale page?

For me the heart of doing Clojure is not making things more complicated than they need to be. It’s in the language design (hey, maybe you don’t need all those class hierarchies and adapters and whatnot, it’s just data), but it’s also deeply part of the culture. I have not found another community that allows itself to just do the simple thing, instead of fetishizing over their amazing architectures and monstrosities of tooling and whatnot.

5 Likes

To each their own, I suppose. I have not used Python a lot, but every time I do, I get this feeling of coding with a straightjacket on (for whatever “pythonic” means), not to mention the dumpster fire that is dealing with library installs and deploying stuff. Ruby I used for many, many small things, and it’s always been nicer to use for me, in that context.
I still much prefer Clojure to either, tbh…

But there’s definitely many ways to do things in Clojure, sometimes all idiomatic, and sometimes part of a refining process… For example, I often start with some data threaded through a bunch of fns, and end up with transducers. Or while working out some API, I may pass around a map as a “bag of arguments”, and refine the fn parameters, etc.

3 Likes

What I feel about Clojure is that the several ways of solving a problem seem to relate to one another like equivalent algebraic expressions: some may be more elegant than others but all are valid. I’ve never got this feeling with any other programming language. So it’s not just one way versus many.

To me the python quote can be adjusted to "There should be one—and preferably only one—obvious way to say it.” which is never true I think? It denies both the multi faceted nature of problems and the subjectivity of writers. I often hear experienced developers picked Clojure because it “got out of the way and let me focus on the problem.” I also think Clojure tries to explicitly tackle software growth in a way others do not. So for me a similar (hopefully not entirely meaningless) phrase for Clojure might be “There should a way to say it, and grow it, as I see it.”

4 Likes

A big part of the Clojure ethos to me is simplicity, whose dimensions I tried to describe in Holy on Dev: What is simplicity in programming and why does it matter?

3 Likes

Yeah, it seems I got the ordering messed up :sweat_smile:

The rationale page is also awesome!

1 Like

I agree about the growing. Not breaking APIs is something Clojure and Rich through his talks taught me.

“Do not thrash around in public”

I guess that’s more of a commandment.

“There is no change, only growth”

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.