
Elements of Clojure - tosh
https://www.therepl.net/episodes/23/
======
valw
Don't let the title fool you - 90% of the advice given in this book isn't
specific to Clojure, and boy is it good advice.

This book contains some of the deepest programming insights I've encountered,
to be put on the same level as SICP or the Pragmatic Programmer.

The discussions on naming and abstraction are particularly illuminating,
exposing some fundamental tradeoffs like synthetic vs natural names, or
principled vs adaptable systems of abstractions. Were these notions more
widespread, a lot of the pointless rants and debates we hear in programming
circles would disappear.

I would not recommend this book to beginners - this book is most useful when
you are experienced enough that your struggle is to make choices, not to get
things to work.

~~~
kccqzy
Contrarian opinion here: I've instead found the constant philosophizing
tiring. But I still commend his effort because as he explained, he's trying to
articulate the inarticulate and the visceral. Most programmers would probably
benefit from reading a book in the style of Effective C++ (Scott Meyers) or
Effective Java (Joshua Bloch), where recommendations are more concrete and
more unequivocal. Once you've done that, the matter of software design only
really comes with experience—experience designing software and having an
almost tactile reaction to the future maintainability and readability of the
code; it doesn't really come from reading a book like this.

~~~
macando
I can't recommend Effective Java enough. Even if one hates Java with passion.
I haven't managed to find a better book on how to design an API in any
language. It learned me to think about the consumers of my code all the time
(even if I'm the only author on a given project) The chapters on exceptions,
defensive coding, generics are brilliant. The whole book is written in an
effective manner. Dense with information, short and still readable. The second
best: Eloquent Ruby. Brilliantly written and mature. Instead of hyping
everything up, the author elaborates the downsides of each described technique
and power tool.

------
TickMark
I thought I wouldn't live to see the day for Clojure related link to be the
top link on HN. I had to reload 5 times.

Clojure's cool, I am glad I got to work with it professionally. I did go back
to Javascript, but it made me a better developer. It strikes a nice balance
between being a pure functional language and being practical.

~~~
hombre_fatal
5-8 years ago, Clojure was constantly on HN! Then it fell out of HN attention.

~~~
dominotw
Yes not sure what happened to clojure. The rise and fall of clojure is really
intriguing.

Looks like everyone just went back to java.

~~~
snapey
It hasn't fallen. The Clojure community has been growing steadily and
continues to grow (it's a great community, I'll add). Things have just settled
down since, that's why there are fewer announcement.

As an aside, the 2019 SO survey shows Clojure programmers are the best paid
[1].

Most Clojure programmers I know (myself included) would not choose to go back
to Java.

[1]
[https://insights.stackoverflow.com/survey/2019#technology-_-...](https://insights.stackoverflow.com/survey/2019#technology-
_-what-languages-are-associated-with-the-highest-salaries-worldwide)

~~~
WillPostForFood
Is it growing? It is a difficult metric to quantify, but looking at thing like
Github, or Reddit, it seems flat or declining. Clojure initially benefited as
the preferred Java escape path, but it seems like that has been supplanted by
Kotlin.

[https://github.com/oprogramador/github-languages#most-
failin...](https://github.com/oprogramador/github-languages#most-failing)

[https://www.benfrederickson.com/ranking-programming-
language...](https://www.benfrederickson.com/ranking-programming-languages-by-
github-users/)

~~~
yogthos
I really don't understand why people obsesses over popularity so much. The
only question worth asking is whether the language has a big enough community
to be sustainable, especially when dealing with a hosted language that
leverages the underlying ecosystem.

In case of Clojure the answer is unequivocally yes. It's got a large active
community around it, and there are many companies of all kinds using it in
production. Whether it's growing rapidly or slowly doesn't really affect its
effectiveness compared to the other options available.

~~~
WillPostForFood
It has a small active community with many abandoned libraries, no killer app,
and painful tooling. I like the language in spite of that, but size of
community matters. To your point, as a hosted language you can make up
Clojure's deficiencies by using Java libraries, but if you aren't a Java
developer (or are a disgruntled Java developer) that isn't a great answer.

 _The only question worth asking is whether the language has a big enough
community to be sustainable_

Exactly, and I'd argue Clojure was on a path to yes, but has lost momentum and
is leaning toward no.

~~~
iLemming
> It has a small active community

Wrong. Clojure community is only smaller in comparison to mainstream
languages: Java, JS/TS, Python, Ruby, Go. Today it has more conferences than
Haskell, F#, OCaml, Elm, Elixir, Erlang. More meetups and more podcasts. Just
this year alone there were announcements for Clojure confs in India, Brazil,
Canada, Russia and Belgium (and these are just for new ones)

> many abandoned libraries

Wrong. Clojure emphasizes modularity and composability, library that supposed
to be doing one thing and well is usually just that. Besides, Clojure is also
legendary for stability and backward-compatibility. I don't know any other
language where you can pick a project of a few years old, update a few
dependencies and still expect it to work. You don't have to re-write things
every time TC39 gets browsers to support yet another Javascript feature. Read
this passage from one of the Clojure libs
[https://github.com/candera/causatum#liveness-
advisory](https://github.com/candera/causatum#liveness-advisory) to understand
why Clojure libs don't get updated very often.

There are hundreds of Emacs packages that people still download and use but
they haven't seen any updates for decades. Does that make them "abandoned"?

> no killer app

Wrong. Clojure often offers multiple choices for any domain. Being hosted
makes it even broader. Yes, some knowledge of the language you're trying to
interop with is required, but you don't have to be an expert to successfully
build and maintain things. If someone doesn't qualify Figwheel, Re-frame,
Fulcro, Lacinia, etc. as "killer apps" I don't know, maybe they are just
pathologically ever unhappy.

> painful tooling

Wrong. Again. It used to be difficult, because only Emacs used to have nice
support for Clojure. Today you can write Clojure in Emacs, IntelliJ, Atom,
VSCode, Vim, Eclipse. And tooling is a lot nicer in comparison with other tech
stacks.

So no, Clojure has never "lost the momentum". It is still growing, but less
rapidly. The ecosystem has reached levels of hedonic adaptation, where people
are just happily using it without too much excitement and/or frustration.
Clojure has become a "boring" language. It just works. And arguably it is
probably the best tool for what it is made for.

~~~
WillPostForFood
Maybe conferences isn't a great metric there have been a bunch of
cancellations like SYNC and Clojure West. People have already mentioned
Incanter in this thread, one of many abandoned and out of date libraries.
Lacinia is nice, but a killer app? What language doesn't have a GraphQL
library? Have many partially supported editors doesn't make better tooling.
Clojure still has potential, but by every other metric, besides conferences (

~~~
yogthos
The recent Clojure/north conference [1] focused specifically on commercial
usage of Clojure with plenty of companies presenting why and how they're using
Clojure to solve their business needs.

There are tons of new libraries and tools being built with Clojure every year.
Some recent examples are Spectre, Crux, Metabase, Braid, Neanderthal, and many
others.

Meanwhile, the tooling around Clojure is far better than vast majority of
languages out there. Leiningen is a one stop shop for managing dependencies,
testing, building, and packaging the application. Uberjars are effectively
containers that you can drop on any system that has a JVM on it and run them.
Compare this to the nightmarish tooling of Node, Python, or Ruby.

Furthermore, if you're doing web development then you get a single consistent
setup with Clojure/Script, and once again benefit from superior tooling where
you can reliably hot load code in the browser, something that simply doesn't
work in Js, do code pruning down to function level, and minification including
libraries.

There's a good reason that you rarely see companies switch from Clojure to
other languages once they start using it.

[1]
[https://www.youtube.com/channel/UClJshc6QtMWRqIAwJy85sfA](https://www.youtube.com/channel/UClJshc6QtMWRqIAwJy85sfA)

~~~
WillPostForFood
I'm not sure what you are arguing. Clojure is a cool language, with a small
community, and declining interest. Why do you think searches trend down if
interest isn't trending down.

[https://trends.google.com/trends/explore?date=today%205-y&ge...](https://trends.google.com/trends/explore?date=today%205-y&geo=US&q=clojure)

You can still be adding a few new libraries, and some new users while interest
declines. Clojure had the potential to be the default Lisp, the default
functional language, and perhaps the default alternative to the c family of
languages. Unfortunately, it is heading towards being just another niche
language. Tooling is a big problem, not because the once you learn emacs and
cider it is insufficient, but because it is a pain to setup and learn emacs
and cider. Not because Atom and proto-repl are bad tools, but because to get
it set up you need 10 plugins and 20 config setting and it ends up being
fragile - complected in a major way. Another part of the problem is that
Clojure advocates vastly overvalue the what unique benefits Clojure adds
things like hot reloading and the REPL. Clojure and ClojureScript might have
better or more pure implementations, but everyone has some form of these
features now. It isn't a compelling argument to say switch to Clojure, change
programming paradigms, learn Lisp, learn emacs, learn java, so you can get a
hot reload that is 15% better than what you have now.

BTW, when I started getting interested in Clojure, one of the videos I learned
from was your Philly ETE presentation. So I have a lot of respect for where
you are coming from, but I wish the Clojure community was less defensive, and
more unified around a strategy to promote and grow the language.

~~~
yogthos
The claim that there's declining interest is absurd, and that's what I'm
arguing. Google trends are simply not a measure of anything interesting in
practice. It's about as useful as throwing around TIOBE rankings.

>Tooling is a big problem, not because the once you learn emacs and cider it
is insufficient, but because it is a pain to setup and learn emacs and cider.
Not because Atom and proto-repl are bad tools, but because to get it set up
you need 10 plugins and 20 config setting and it ends up being fragile -
complected in a major way.

It's quite clear you haven't used Clojure tooling if that's your impression of
it. Again, Clojure has some of the best tooling I've used in any language and
I've been doing development for around 2 decades now. Intellij and Cursive are
a fantastic combination that takes minutes to install. Calva is another great
option for VS Code and it's also a one click install. Both these projects are
actually being funded. Cursive is a commercial product and Calva is funded via
Clojurists Together. Both Cursive and Calva show just how much the community
has grown, since people and companies are willing to pay for tooling nowadays.
That's a real measure of growth.

>Another part of the problem is that Clojure advocates vastly overvalue the
what unique benefits Clojure adds things like hot reloading and the REPL.
Clojure and ClojureScript might have better or more pure implementations, but
everyone has some form of these features now.

Again, this is completely false. I'm not aware of any mainstream languages
that facilitate anything remotely like this workflow:
[https://vvvvalvalval.github.io/posts/what-makes-a-good-
repl....](https://vvvvalvalval.github.io/posts/what-makes-a-good-repl.html)

>It isn't a compelling argument to say switch to Clojure, change programming
paradigms, learn Lisp, learn emacs, learn java, so you can get a hot reload
that is 15% better than what you have now.

Switching to Clojure provides far more benefits than just having hot
reloading, and these benefits are very convincing for plenty of companies
using Clojure today. These benefits also tend to appeal predominantly to
experienced developers: [https://insights.stackoverflow.com/survey/2019#work-
_-salary...](https://insights.stackoverflow.com/survey/2019#work-_-salary-and-
experience-by-developer-type)

------
voidhorse
This is great! I really enjoy the author’s use of philosophy as a guiding
context/point of analogy—I feel like the majority of software engineers aren’t
necessarily aware that nearly that many of the principles of software
development date back to developments in logic and mathematics in the 19th
century (we are doing little more than using formal langauges, after all)
(actually the use of the term “indirection” is a great example of this—in the
software industry, people have invented terms for things that have had long
standing names and terminology around them already in logic and philosophy).

Hope this book also introduces some engineers to analytic philosophy too, a
discipline that I feel is crucial for understanding any formal pursuits, and
that is given far too little attention (thanks to the hyper-specialization of
domains and knowledge).

------
chungus
Bought it, read it, liked it. Most of it is applicable to any programming
language. I remember there being very little code examples in the book.

~~~
motform
Definitely! Chapter two deals directly with Clojure idioms, but other than
that the content is quite general. Zach has said in multiple interviews that
one of his future projects could be something like an "Elements of Software".
Fingers crossed!

------
ninetax
I really enjoyed this book, especially the chapter on naming.

As a programmer I named dozens of things a day, yet I never really got much
advice on what makes a good name other than the standard "make it clear". I
wish there were more books out there that went as deep as this book on that
topic.

Anyone have any recommendations?

------
CameronBarre
Yay Clojure! It's such a natural tool once you go all in on it.

------
slifin
Thank you for the link, I brought the book to add to my collection of Clojure
books, Programming Clojure by Alex Miller, Stuart Halloway and Aaron Bedra has
been my favourite so far

Would be good to get a Datomic Cloud book but I don't know of any yet

------
fastbmk
Observed facts of Google Trends:

1\. Clojure is less than 1% of Java market.

2\. Clojure popularity is trending down.

------
dmix
I love the design of that web-based audio player.

