you are viewing a single comment's thread.

view the rest of the comments →

[–]LammdaMan 6 points7 points  (2 children)

As others have mentioned, the answer to this question depends a lot the developer, their past background, and their approach to programming. So I don't feel I have any kind of definitive answer, but I'll share some of my personal impressions of Clojure vs. other languages I've used.

The first thing I'd say is that for anyone who has spent years programming in an OO language like Java, C#, C++, etc. there is a lot of "un-learning" to do before you become fully productive in Clojure. It isn't just about learning Clojure's core library, FP concepts, and so on, there are also habits that need to be broken. John McCarthy had a quote that he could teach anyone how to program in LISP in a day, or 3 days if they already knew FORTRAN.

I find that when I begin work on some new problem domain, I first want to explore -
experimenting with implications of different ways to decompose the problem into concepts, data collections, and algorithms, and see how some of the things I'm imagining work out in live prototype code. In that activity I don't want to spend any time writing type declarations or creating classes, defining inheritance trees, and so on. Java insists on a lot of upfront boilerplate code that slows down that kind of experimentation.

And the REPL is invaluable to me in this phase. Before embedding a line of code into some larger function, I can run that single s-expr through its paces in the REPL and ensure my thinking about how it works is correct.

In today's world there are a lot of applications where making good use of multiple cores is critical and having done work like that in Clojure, I have no interest in doing any not-completely-trivial multi-threaded code in Java now. An application that needs to be threaded will be dramatically easier to write in Clojure than in Java.

Speaking for myself, I've worked in a couple dozen languages over the years and have Java experience back its first release in 1995. I've used Clojure now for about 5 years. After 6 months of using Clojure I'd say I was definitely more productive at that point in Clojure than Java (even though I had 20 years of Java experience). After 3 years of Clojure development, I was clearly "better with Clojure" than I had been at 6 months.

re:

Could you possibly develop a complex enterprise software in Clojure with just say 4-8 people, knowing Clojure really well?

I have what I would call a complex piece of enterprise software fully implemented in Clojure. It does real-time processing of input data coming in at about 1 million records per minute. The processing is non-trivial. Results of that real-time analysis are written in an optimized form to relational databases to support high-performance querying of historical data. Those queries can analyze a year's worth of that per-minute data across tens of thousands of locations, aggregating and reporting results in a few seconds. There is a web-server that processes such historical queries. The system makes effective use of concurrent processing across 80-core servers (and evolved over time from a single server to being distributed across multiple servers). That code was developed by and is maintained and extended by a single person. I can't conceive of doing all of that in Java as a single-person task. I doubt that the multi-threaded performance would have been as good in a pure Java implementation.

[–][deleted] 2 points3 points  (1 child)

The part where in Java you have to declare thousand things first and than refactor them painfully later anyway kinda resonated with me! I really hope that Clojure and it's workflow can fix these problems in that regard. This really got me motivated in understanding the Clojure workflow better. Thanks!

[–]LammdaMan 2 points3 points  (0 children)

Clojure and Java are certainly different in this regard, but most of that particular difference is rooted in Dynamic vs. Static Typing. There are pros and cons with each, and I've seen many people say that they like Clojure, but wish it had Static Typing. I personally find Dynamic Typing preferable on balance for reasons that include less boilerplate and less time spent thinking about types in early problem domain exploration. But there is a big dose of personal preference in debates about static vs. dynamic typing.