
First hundred days of Clojure - pron
http://www.niclas-meier.de/2012/04/first-hundred-days-of-clojure/
======
tferris
Thanks for the long post and sharing your experiences.

I learned from you that Clojure is appealing for folks coming from Java. I
read your conclusions and just got a vague feeling only. Coming from other
worlds (like node/js, Haskell, ocaml, Go, Erlang and for the sake of
completeness Ruby/Python, C++), I'd like to know good reasons why one should
try Clojure from your point of view? What is the main USP to dive into Clojure
(except the similarity to LISP)?

I just checked Wikipedia sayings things like 'treats code as data and has a
sophisticated macro system' or 'concurrent programming through software
transactional memory, an agent system, and a dynamic var system'—but I'd be
happy to get more explanations/reasoning on this and why Clojure is so special
compared to other languages.

~~~
samdk
Other people's attempts to answer your question seem to have not done what
you're looking for, so I'm going to try to be more specific.

First and foremost, Clojure is a Lisp. Many other people more qualified to
describe the benefits of Lisps have done so, so if you're looking to be
convinced about why that aspect of the language is valuable, go and read what
they've written. Looking at Clojure and ignoring the Lisp-related arguments is
a bit silly.

It's dynamically typed, which sets it apart from the ML family of languages
(SML, OCaml, Haskell, F#, etc). It has immutable data structures, which sets
it apart from some of the elements of ML-like languages. It's eager, which
sets it apart from Haskell (although Tyr42 rightly points out that many of its
sequence operations are lazy). It has good support for multi-processor
concurrency, unlike OCaml, because it has STM, and so doesn't have the problem
of a global lock.

It's functional, and its primary programming style is functional, and it has
immutable data structures, which sets it apart from Ruby, Python, Go, and to
some extent JS. It's higher-level than Go/C++/C. It doesn't rely on callbacks
for absolutely everything, like JS does. It's not object-oriented, which sets
it apart from Ruby/Python/JS. It's a new language, which means it doesn't have
the many accumulated years of cruft that Ruby/Python have, and it's well-
designed, which means it doesn't have the many, many problems JS has as a
language. It has multi-processor concurrency support that Ruby/Python/JS don't
have.

Compared to other Lisps, it's a very practical language. It has native syntax
support for vectors and hash tables. It's built on the JVM, which gives access
to a lot of existing tools and libraries.

~~~
Tyr42
Well, most of it's sequences are lazy. map, take, ect are all lazy. Which is
awesome because they are composable (at least, to me, coming from a Haskell
background).

------
fleitz
Why would you need an IoC framework in clojure? It's already built in, pass a
function.

~~~
JulianMorrison
I think the author wants something like parametrized modules, but the
idiomatic way to do it is to use vars created by (def) or (defn) with
(binding) which gives you thread-local global variables.

------
phzbOx
What scare me the most about Clojure is collaborate with other devs. I.e. In 2
years, who will maintain the project.

~~~
bkirkbri
We're switching to Clojure specifically because of maintainability. In Clojure
your functions tend to be concise, operate on immutable data structures (no
side effects) and can be tested/mocked easily. The lack of boilerplate alone
makes for a much better signal-to-noise ratio during review or refactoring.

I've been a Perl hacker for 15+ years and still spend too much time reviewing
code from CPAN to understand what's going on. I've been using Clojure for
about 6 months and find that I can read and understand many of the major
Clojure projects on GitHub quickly. Some may claim that says more about Perl
than Clojure, but I'm chalking it up to Clojure :)

~~~
prakashk
I'd be very much interested to know more about your experience and insights
comparing Perl and Clojure. Would you mind writing them up?

~~~
bkirkbri
I'd love to do a detailed blog post on it, but unfortunately I'm too swamped
right now.

The summary:

\- Any serious codebase is going to exceed the complexity you can hold in your
mind at one time

\- Once that happens, it's crucial that you can reason about the part you are
focusing on

\- Interactions between components are MUCH harder to reason about if they
share mutable data

\- It's possible to design cleanly isolated components in any language

\- But we found that Clojure makes it natural to write concise, testable and
isolated code

\- So much so that writing sloppy/badly designed systems _feels awkward_ in
Clojure

\- For us, that was more beneficial than a book full of patterns or best
practices

\- YMMV, but I'd try it out and be sure to get over any aversion to Lisp
before passing judgement

edited for formatting

------
samrat
What's a good place to start learning Clojure?

~~~
prakashk
I came across a HN comment recently that has a bunch of resources:
<http://news.ycombinator.com/item?id=1033503>

It's old, but still is useful.

Also, see <http://dev.clojure.org/display/doc/Getting+Started>

