by tensor · 6y ago · 0 comments
1. Tooling. You end up spending way more time getting your tooling setup than it should be. 2. Difficulty in learning. 3. Clear best practices and frameworks. The philosophy of composing libraries is extremely powerful, but to gain broader adoption you still need straight forward frameworks and opinionated best practices.
The last point has many unintuitive consequences. Clojure tends to attract people who enjoy doing new things, or excelling in their craft. But mass adoption also means catering to people who need to do "boring" things where people just want to get their job done. For boring code, which is the reality for many developers, they just want a clear best practice to get the stuff done.
This could be a clear standard library or framework for a task, a clear architectural pattern, and it certainly means easy to access code snippets. There have been some attempts at these things, e.g. Luminous for the web, but the community hasn't rallied around them with enough weight to make newcomers comfortable.
So when faced with choosing: a testing library, any number of libraries compose into a web service, any number of approaches to client side, then in the end still having 100 equally good ways to architect a given piece of code that requires thinking mathematically, well, it's daunting. Especially when you are new to the language and just want to get your boring CRUD app working.
Maybe this is best summed up as saying that Clojure caters to the creative, but to gain widespread adoption it also needs to cater to those stuck writing boring code and just want to be done with it as fast as possible.
In 2017 a customer wanted a set of services written in Clojure. Based on their Java experience they wanted to hire 10 devs. When I arrived they had 4, over the 1.5-year period I was there, they hired and fired 4. When I left they had 3. All 3 were not experienced in Clojure prior to the project (Java), but by 2018 each knew the entire codebase and was able to modify it and able to step in for each other. They spent less than half of their budget and all goals were met ahead of schedule.
IME learning how to put Clojure and its ecosystem in good use takes more time and effort than other languages, but its effectiveness really compensates.
If I could make my own language and stack, I too would be mega-productive. However, others likely wouldn't like it and be confused by it, even though it's dirt obvious to me. Roll-your-own has limits. Sometimes 2 or 3 like-minded Lisp developers connect and roll for a while, but over time they will find it a lucky match-up that the real-world can't repeatedly recreate. Lightning in a bottle evaporates easily.
The bottleneck of "paycheck" programming productivity is communicating between human beings, who may shift over time. Cranking out compact code fast is secondary to this. Program for people, not machines and not cleverness graders.
Cyc is developed by a team since the early 80s. Reduce since the mid 70s. The SBCL and CMUCL Lisp implementations come out of the early 80s. Maxima has its roots in the late 60s/early 70s. The commercial Lisp systems from Franz and LispWorks are developed since the mid/end 80s. ACL2 (a theorem prover used in the chip business) comes from the early 90s. ITA (now Google) started mid 90s. GNU Emacs is from the early 80s. Autocd/Autolisp comes from the early 80s. PTC's Lisp-based CAD system (with a few million lines of Lisp code) must have been originally 2000 or earlier...
Their code was never touched by those who stayed and were able to work together. Later it was rewritten, because in spite of tons of unit tests (which passed), it was full of bugs. The code was considered "write-only". The rewrites averaged at 5-10% LOC.
I agree there's a sometimes frustrating lack of branding and documentation for the one true way of doing things
But I'd be careful what you wish for, Clojure is still fertile land, nothing has come along and crushed all alternatives yet and I think our community is right to think long and hard before promoting the new one true way because most of us are refugees from other languages where it's already happened
On the other hand, to start with just picking something reasonably mainstream (in Clojure terms) is a perfectly good strategy. The choice will be poorly informed, but that's a given if you're a beginner in any case. And such a beginner isn't really in a place anyway to make this choice for a significant project (for any platform/language).
Once an initial choice is made, it seems to me (so far) pretty easy with leinigen templates & plugins just to get started on something. Time from tool setup to coding hasn't been any longer for me than other things I've learned in recent years.
The leaky abstractions were the other painful part – Clojure itself wasn't so bad, but Clojurescript (which would sidestep the startup issue) always seemed to leave me in callback hell.
Ultimately rust (and go to some extent) seemed to fit my use cases better.
If I had to do a web app from scratch I would think long and hard about going Clojure if only because it leverages such a widely used VM. Points 1 & 2 weren't issues for me, but #3 was (and there are similar problems with Elixir).
Building CLI tools in C/C++ is silly. If you like Rust/Go, sure, knock yourself out.
But the obvious choices are the scripting languages with runtimes that are already distributed as part of the OS .On Linux most CLI tools are built in Python or Perl and Ruby or Node.js are decent choices too.
JVM languages aren't an ideal choice due to the startup time, but given the size of the ecosystem you can find a library for pretty much anything you need and now we've got GraalVM to help with the startup time. So not a bad choice either.
Idk - If I wrote a tool in any of those languages and used state-of-the-art features then you would not be able to use them with the system interpreter and you’re back to square one.
I made a couple of simple command line programs at my previous workplace and the functional style of Clojure combined with lazy sequences made processing an unknown amount of resources on our server a breeze.
I would think that the language of choice for a command line program would have more to do with the task you need the program for and not the command line format itself.
Obviously for performance critical stuff such as implementing something like ffmpeg you would want to use rust to squeeze out every last bit of performance.
1. you get all JVM libraries (eg JDBC) 2. it's very compact to write and maintain 3. you can develop stuff using a REPL, and this is very handy for ill-defined problems. 4. if the result is worth it, I can create a Graal native for it (but I hardly ever use this)
I ended up as an author of a thing to minimize the boilerplate involved: https://github.com/l3nz/cli-matic
- Babashka: https://github.com/borkdude/babashka
- Clj-kondo: https://github.com/borkdude/clj-kondo
- Sci: https://github.com/borkdude/sci
- Jet: https://github.com/borkdude/jet
But again, those are tools (especially babashka) from a Clojurist's perspective
In ClojureScript you can use core.async to write async code in straight-line form. But I find myself using it pretty seldom, as handling events explicitly in functions feels pretty natural in Clojure especially given how naturally closures work in the language.
Case in point the var/agent/ref system is fantastic and probably critical to how to think about Clojure projects - but the problems being solved by it are a long way away from the concerns of someone at the beginner-intermediate type level. They don't need to solve multithreading right now. They don't see their data model as an urgent priority.
Compare that to Python where most of the core language is (1) call function, solve problem or (2) feature does something you could already do but with a little less typing.
I prefer Clojure but it is easy to see that the lack of an opinionated onboarding process is going to hurt the language.
But tools-deps don't care about packaging, deploy, install, etc. Like its name, it's focusing on `deps`.
I use tools-deps and shadow-cljs.
Having leiningen not bundled into the clojure distribution, is in strong contrast to the "batteries included" approach of python.
There were also complexities in including local jars into projects, as it required setting up a local maven repository, which is tedious job.
Also when exeptions occur clojure does not give an interactive repl like other lisps.
The problem is that Cognitect (the company behind Clojure) don’t use Leiningen themselves, and instead have released their own tool called deps.edn.
This has only fragmented the community even further, making it even more difficult for newcomers, with questionable benefits.
First, it is not called deps.edn, it is called tools.deps.
Second, it is without a doubt, 100% untrue that projects that Cognitect employees work on, exclusively use tools.deps. Cognitect has client projects they start from 0, and existing projects they shepherd and grow responsibly. Their first priority is to help their clients succeed in their goals, not change the build tool. I have worked with them, and the attitude was always pragmatic > dogmatic.
Where I will agree with you is that some folks in the community took an alpha release of tools.deps and treated it like it was the new lein or boot. It isn’t. It’s different, and as a Clojure programmer of 10+ years I use it in exactly 0 production projects. That said, it improves greatly upon “lein checkouts” by allowing one to refer to git SHAs as versions and do cross-project interactive development.
Like I mentioned Windows tooling and distribution seems not get much focus.
Emacs, cider, nrepl workflow on Linux is too complex with many moving parts, and very brittle(may be things have improved recently).
A major pain point for me specifically is that on an exception you don't get a live repl, you only get the stack trace of a dead program.
Even some minor inconsistencies lambda positional argument numbers seem to start from 1, than 0, which is where indexes start in all other cases.
Anyway, I'm mostly concerned by the fragmentation of it all. It doesn't help that there are now three (or four if you include maven) package / build tools for Clojure. The community is barely large enough to support a single one.
It currently have alpha support for Windows. They are still ironing out the quirks: https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Wind...
You no longer need local Maven repo, because tools.deps supports local dependencies, you can basically just depend on local folders. It also can depend on git repos.
If you look at Python, Pip appeared in 2011, where as Python launched in 1991. And if you look at the Python scene, it's pretty messy as well, just read this guide: https://packaging.python.org/guides/tool-recommendations/
Pip isn't even the recommended one to use anymore, slowly being superseded by Pipenv, yet you also have Poetry and conda and to package things you still need setup tools and you have to use twine to submit wheels to pypi, etc. And I still see a lot of guides telling you to use easyinstall still.
In Clojure, you had Maven first as the de facto, then Leiningen became de facto, and now you have an official one with tools.deps as the new de facto.
For what it's worth, I am a system administrator (or DevOps engineer or infrastructure architect or whatever the trendy name is now). I've written several non-trivial automation tools where I had the option to use pretty much any language I wanted. The startup time and overall awkwardness of deploying the JVM for scripting was the undeniable deal-breaker. (I used Python instead).
> For boring code, which is the reality for many developers, they just want a clear best practice to get the stuff done.
More likely they just need a solution with the least-necessary added complexity or observable downsides, and that rules out the bulky JVM with its slow start-up time and the fact that Java has been under the jurisdiction of Mordor since 2010.
I think Clojure’s sweet spot is a small team working on a large enterprise project.
If you want to get started, Clojurists will insist you learn emacs. After all it's so great you must learn it.
Now I have nothing against emacs.
But I don't expect to have to invest significant effort to learn a specific editor in order to use a programming language. No other programming language has this requirement.
I was surprised at how many Clojure users took this as an attack upon emacs. It took some careful explaining to make the point that I have better things to invest my time into, such as building more code in Clojure, rather than learning yet another tool, that does something for which I have other tools already.
There were some great IDEs for Clojure. But they have all fallen into disrepair and being unmaintained.
Not sure where you get the disrepair part, Cursive is alive and well and seems to be a sustainable business for the author, and Calva also seems to do be doing well.
It's true that there have been various open source IDE efforts that are dead now (Counterclockwise for Eclipse went the way of Eclipse, Lighttable and Nightcode were probably a bit too experimental / radical)
I did use Eclipse and Counterclockwise for quite a while and enjoyed it very much.
It's on the wrong side of history in that respect.
I know it's trying very hard to catch up to statically typed languages now by retrofitting some type system, but it's too little, too late.
Static types are where the current state of the art is, and we're not going back. Clojure missed that train and will never catch it now.
Types solve 2% of programming errors. They lead to coupling for the sake of the compiler, and make code harder to change, harder to write, and often needlessly constrain the utility of the code where they're applied.
But they do make the IDE code-completion go, so there's that.
They also make code easier to reason about since the coupling that exists because of types is the result of an explicit and thoughtful decision on the part of the author. You don't as often get into situations where the code appears to work based on superficial similarity of data, only to find out there is some deep difference which prevents it from ever working.
It's also the truth that the more expressive the type system is, the less coupling you are required to do. For instance, if the language supports type classes (traits), you can codify the fact that a part of the system requires not data of a particular type, but of any type supporting some set of operations. This is the very thing you imply is lost when coming from dynamic types, only this time it's tool-backed and not merely accidental.
When you get a totally unfamiliar code base, only if you can run it over and over, or at least run the tests over and over, then you can talk about the refactoring. If you can't, the refactoring is almost impossible, not matter how strong the type system is.
For an argument which require type of string, the behavior could be unexpected if you just give it a string.
Very often it feels like they're "elegantly" trying to solve some made-up, bullshit problems for some questionable gain. Feels like bureaucracy for the sake of bureaucracy.
Totally like OOP shit that we're still trying to make sense of, like:
public abstract class Ellipse2D extends RectangularShape
What's the problem? Ellipses are rectangles with some extreme rounded corners. That's exactly how Euclid described them.
For me, Clojure definitely made me way more productive. My background was in statically typed language mostly prior, though I had done some Python and JavaScript as well. With Clojure I feel I'm between 30% to 300% more productive overall. I think some of this is personal, depends on your style and your own strengths and weaknesses.
Typescript can be annoying but usually it helps a lot with refactoring. It's also pretty great for detecting unused props with react.
I don't use IDEs so my defense of typescript is only based on its type checking merits
Edit: Googled and nope, can't find anything.
https://dev.to/danlebrero/the-broken-promise-of-static-typin...
https://www.i-programmer.info/news/98-languages/11184-which-...
https://nextjournal.com/PRL-PRG/toplas-analysis
One thing to note is that the absolute difference in terms of bugs from the worst language to the best is still minimal. So language choice doesn't seem to make or break software.
Another thing to note is that while overall static languages faired better in terms of having lower defects, Clojure did best of all.
I knew of another one but can't find it again.
Then there are a few where they had beginner programmers implement trivial programs in different programming language and checked how many errors/time it took them. But I consider those all pretty bad since the experiments are so reductionist. So I won't list them. They aren't conclusive either. Some end up saying static and dynamic are same, some say dynamic is more productive at equal defect, and some say static had less defects at equal productivity.
Vastly understated in my experience. Even trivial python programs contain errors that could be prevented with a trivial type system like Go's
And performance. Not being fast enough is a bug. Consuming much more energy is a bug, in my book.
Sufficiently expressive type systems are better than dynamic typing. They prevent so many errors, especially in FP-inspired high level data transformation functions. I am saying this as a person who doesn't even like most of FP. (You can infer from my comment history).
or Python's. It even has generics.
That said, I still like some dynamic languages for certain things.
I like static typing and agree that it will eventually "win", but I really don't see where you're coming from here.
> I know it's trying very hard to catch up to statically typed languages now by retrofitting some type system
What makes you say that?
I think dynamic languages are generally a good default, but the current world also matches them pretty well because programs talk to the outside world in a lot more varied ways than before and static typing is not that very good across distributed systems.
Static has a better case when talking about more powerful type systems than what mainstream languages have, but those don't really show accelerating signs of breaking through to mainstream. Rust is an exception in the recent history but it's not really poised to become a widely applicable app programming language.
I'm seeing Clojure related posts on top of HN almost every week. And I'm watching people trying Clojure, coming with all sorts of different backgrounds. I have worked with people who came to Clojure from C++, Ruby, Python, C#, Haskell, Go, Scala, OCaml, JavaScript, CL; people with no programming experience at all.
Of course, that all is incomparable with the craze that something like Typescript receives. And I used to feel anxious, worried that this would be the last ever job where I happily used Clojure. But after my third job where Clojure was the primary language, I stopped sweating about that.
I think Clojure, at this point, has stabilized in the industry and slowly and steadily would continue to attract people. The only thing that can genuinely kill Clojure - is a better version of its fork.
But as you say, it's popular "for a Lisp dialect" and I don't expect it to reach past that. I would love to be proven wrong.
That being said, your post made me realize that instead of lamenting the nicheness of Lisps, I should be encouraging other people to give Clojure a shot. And not only to help Clojure be more successful, but also to bring a little bit of joy to their daily life like Clojure often does. (It sounds trite but it's true.)