Friday, January 06, 2012

The book the world needs

The world needs "Introduction to Functional Programming Using Clojure".

This is needed for at least two reasons. First, the existing books on Clojure require an understanding of basic functional programming. All of the currently available books do a good job of explaining the language. For the average Java or Python programmer, though, it would be tough to learn Clojure if the only resource were one of those books (or all of them, for that matter).

Second, "introductions" to functional programming are usually too academic. SICP, for as much as I love that book, is a book about computer science, not software development. Scheme will never, ever be a programming language embraced by industry. That doesn't mean there's anything wrong with Scheme, but it does mean that if you use Scheme, the perception will be that functional programming is not something you'd do with a "real" language, so I guess that is something wrong with Scheme.

I've been reading about Standard ML recently, and while I have learned a lot, I can't imagine anyone taking ML (SML or OCaml) seriously. I mean, in the sense that the perception would be any better than the perception of Scheme. Moreover, I've tried to read about Haskell, but it's hard to go more than about five minutes without falling asleep. There's just too much religion about pure functional programming. I can see why it appeals to mathematicians, and I can see the point of Steve Yegge's post on Haskell.

Even worse, there's discussion of type systems, which is an advanced topic. It's my belief that dynamic typing is better for beginners. Don't get me wrong: on technical grounds, the ML and Haskell crowds might be right. I'm not sufficiently informed to take sides in the debate. It's just a matter of perception, and ML and Haskell are non-starters IMO.

Clojure's not-so-secret weapon is the JVM. It can run any Java libraries, and thus it has instant credibility. Unlike Scala, it has dynamic typing. It has the coolness factor, too, because of all the concurrency-related stuff that makes it appear to be cutting edge. The language has an outstanding community with members that have - get this - people skills. The creator gives interesting talks. He is happy to incorporate academic ideas, yet comes at everything from a practical perspective, based on years of real world software development.

Perception matters. Clojure may be what those of us who believe in functional programming have been waiting for, in terms of acceptance. The fans of Scheme, Common Lisp, Haskell, ML, and all other functional languages should be happy about this. Clojure is the first functional programming language that doesn't have to worry about the perception problem. Once a functional programming language, as opposed to functional features in non-functional languages, gains acceptance, developers will ask "Which functional language should I use?" Then the door is open for all the other languages.

So back to the book. I promise I'll preorder it when it becomes available. You can even use my title.

8 comments:

Unknown said...

Maybe you would be interested in this:

Functional Programming for the Object-Oriented Programmer
by Brian Marick

lmf said...

Yep, that's the book I want to read and to give to others. Brian Marick better get busy writing it, or someone will read my post and beat him to it.

Anonymous said...

I'll go along with your Clojure book suggestion, if there's an emphasis on sequences and when and when not to use recursion.

I think many current authors would argue their books teach functional programming, along with Clojure.

However, they seem to miss how you would take a C/C++/Java mindset and transfer it to any functional language, Clojure or Haskell.

I thought I was at a disadvantage not having done a lot of work except sustaining engineering in Java, but other than better knowledge of builds, I missed nothing. This is probably not true, however, if I had programmed in Ruby or Scala.

lmf said...

I think many current authors would argue their books teach functional programming, along with Clojure.

However, they seem to miss how you would take a C/C++/Java mindset and transfer it to any functional language, Clojure or Haskell.


That's a much better summary of what I'm thinking than I wrote!

Anonymous said...

you are rigth..when u learn clojure the first wall than you need pass is the change to functional thinking...and that is hard...I love clojure but I don't know much about java and when I was learning clojure I need learn functional programming, lisp-clojure and java at the same time...I wish a book than learn u functional language using clojure and explain a bit about java..comparing f# books..many them teach some things about .NET and do a good introduction about f#-.NET interaction ...all clojure books assume than u know java...
by the way f# and clojure aren't purity languages and they are great for write in the JVM or .NET

I like "Learn You a Haskell for Great Good! .." book was very pleasant to read and it gives u a very basic introduction to functional languages but it's very practice, a bit basic but let you learn important concepts about functional langs...

Joe Snikeris said...

In the meantime:
http://www.htdp.org/

lmf said...

HTDP is a decent book, but Racket, Scheme, and Common Lisp are all non-starters. The response to "show me a list of 3 large corporations using Racket" is silence.

شركة تنظيف بالاحساء said...

شركة تنظيف بالاحساء
شركة تسليك مجاري بالاحساء
شركة تنظيف سجاد بالاحساء
شركة تنظيف بالقطيف
شركة تنظيف بالجبيل