top | item 3640241

Clojure Programming

194 points| turbinemonkey | 14 years ago |clojurebook.com | reply

36 comments

order
[+] buddy_nuggs|14 years ago|reply
I have been interested in learning Clojure for some time (spent many years as a Java dev, and intrigued by the chance to develop again on the JVM and learn a Lisp style language). This is a resource I have bookmarked as potentially helpful when I get around to learning: http://blackstag.com/blog.posting?id=5

I haven't had the chance to check it out yet so can't vouch for quality. But it seemed that a few people on the thread are considering getting into Clojure, so I thought I'd share.

[+] krosaen|14 years ago|reply
Anyone have insight into how this might complement / compare with "The Joy of Clojure" http://joyofclojure.com/the-book? At first glance, having read JOC and seeing the TOC for this new book, what most piques my interest are the sections on macros, protocols, and the web stuff.
[+] elangoc|14 years ago|reply
I imagine that Clojure Programming is going to be similar to Programming Clojure, when compared to the others (for a better rundown of others books: http://stackoverflow.com/a/2928998) Or as this answer from SO puts it, Clojure Programming probably teaches the "what" of Clojure: http://stackoverflow.com/a/2579877

Personally, I think Joy of Clojure is the "why" as well as "how to do it well". I learned the "what" mostly from Practical Clojure, which was good enough, but definitely not great. Programming Clojure (2nd ed. for clj v 1.3, still in progress) seems organized like a conversation in chapters, i.e., you'd have to read it entirely sequentially, and targeted random-access might be difficult for first-time learners. I don't how Clojure Programming will be, but I hope it raises the bar for teaching newbies.

[+] gcv|14 years ago|reply
IIRC, O'Reilly was flat-out refusing to publish any Lisp books as recently as 2005. How things have changed. :)
[+] cemerick|14 years ago|reply
Last I looked, their author proposal FAQ still has that exclusion.

FYI, a Common Lisp book nearly made it out of the gate a couple of years ago, Nick Levine's 'Lisp Out of the Box'. The contents of it are available under a Creative Commons license:

http://lisp-book.org/

[+] nonrecursive|14 years ago|reply
Just curious, does anyone know why O'Reilly would refuse to publish any Lisp books?
[+] buckwild|14 years ago|reply
Does anyone know of a good web framework for Clojure? Perhaps a rails of django equivalent?

I love using Java for the exact reason the author claims Clojure is so powerful--the magnitude of libraries.

If a decent web framework is available, then I would be inclined to give it a go.

[+] lukev|14 years ago|reply
There's some (none so mature as django or Rails)... take a look at Noir (http://webnoir.org/)

However, the Clojure philosophy seems to be trending towards building your own composition of highly composable micro-libraries, rather than being handed one monolithic framework. It works very well, but does have the side effect that there isn't real "one stop shop" for beginners.

And when you're designing a webapp (or any app) in Clojure, you'll notice that you have a much higher degree of freedom regarding how to do things. There's no "one true way" the way there is with Rails. Again, this is extremely powerful, but it makes the next step somewhat less obvious for beginners.

[+] ibdknox|14 years ago|reply
I wrote Noir primarily to help people new to Clojure to get up and running really quickly. It provides a simple set of core abstractions that allow you build whatever you want. As others have said though, I don't think something like Rails or Django should exist in Clojure. Large frameworks like those are very limiting and I would argue don't really end up letting you build real apps any faster than you can using simple composable libraries.

There's immense value in the approach the Clojure ecosystem has taken. For example, how many other places can you seamlessly swap out your webapp's server from something like jetty (thread-based) to tomcat (battle-hardened) to netty (NIO) to ...

FWIW, https://www.readyforzero.com/ is a non-trivial app in production that is built entirely on Noir.

[+] cemerick|14 years ago|reply
Nearly everything web in Clojure is built on Ring. I personally like using Compojure (which bundles together clout for routing and a bunch of good defaults for sites or web services) and Enlive (for templating). This is the stack we describe in depth in the web portion of the book.

Frameworks are largely not used, at least in the monolithic, un-composable way that 'frameworks' generally are in other languages. This is what makes it so easy for alternative conceptualizations of the problem to come about (i.e. Noir, which also uses Ring and Compojure, but with different defaults, some macro sugar, and hiccup for templating), and themselves to be mixed/integrated with other web codebases. For example, you can trivially compose a noir application with a couple of "low level" Ring handlers with another app written using Moustache and stringtemplate.

That is all to say, yes, you'll find all the pieces you need for web development.

[+] SkyMarshal|14 years ago|reply
If you love Java and want a magnitude of libraries, and don't have any particular attachment to Lisp syntax or dynamic typing (which 'love Java' seems to imply), then it would benefit you to check out the Play [1] and Lift [2] frameworks as well. Lift is Scala-based but is 100% interoperable with Java libraries, and Play apps can be written in either Java or Scala and is also 100% interoperable with Java. Play is quicker to learn, Lift has superb built-in security and very easy Ajax/Comet.

1. http://www.playframework.org/

2. http://liftweb.net/

[+] francoisdevlin|14 years ago|reply
There's Noir, which is more minimalistic that Rails, but it's easier to customize as a result. I've had some fun playing around with it, but I personally haven't used it in production yet.

webnoir.org

[+] MatthewPhillips|14 years ago|reply
I'd still love to see a ClojureScript book that doesn't assume you already know Clojure. Put me in a repl and have me modifying a web-page, as opposed to writing command-line applications.
[+] malandrew|14 years ago|reply
Now that you've written a full technical book, what are your thoughts about how technical book publishing is done and how it can both better serve the authors creating the content and be better presented to your readers?
[+] SonicSoul|14 years ago|reply
is anyone putting Clojure to good use? i've been reading about it for a while, but still can't find a practical use for it. i know .Net framework in and out, and it just makes everything so easy.. not sure what Clojure could offer me at this stage, even though i love its notation (the little that i know so far).
[+] moomin|14 years ago|reply
The truth is, if you're a .NET programmer, you're going to find Clojure slightly painful because you're switching ecosystems. Using it for work will encounter the same problem and ClojureCLR is a second class citizen.

That's not to say it isn't great and useful, it is. I'm noticing a couple of trends in Clojure development: big data and esoteric. Take a look at Storm (twitter's data processing engine) and Overtone.

[+] blario|14 years ago|reply
Why Clojure? What makes it better than anything from the huge range of choice developers already have?
[+] moomin|14 years ago|reply
Very quickly: Simplicity, Speed, Power.

Simplicity: it's easier to reason about a Clojure program. Speed: Idiomatic Clojure tends to be as fast as Java when it matters. Power: If an abstraction you need isn't present, you can write your own. Code reuse is insanely high.