When we think about what makes a programming book good, what separates a classic from a run-of-the-mill for-dummies-learn-in-X-days book, it's not hard to get to the conclusion that the examples are an important piece of what we perceive as quality. I would say that this is even more so for books on programming languages: K&R had great examples; Practical Common Lisp has great examples that are now being copied by many authors; the list could go on.
So it was not that surprising to discover that one of the reasons of all the praise received by Dr. Jon Harrop's book OCaml for Scientists is its set of examples. There are even two entire chapters devoted to examples, the first for simple and the second for more significative ones. They are really good: well-chosen, interesting and well-written. Most of them have a scientific flavor, in keeping with the book's title, but to me this is a plus. Also, I don't recall seeing wavelet transforms as examples in a programming language book before; originality also counts.
The book's title is accurate: it is a book about OCaml primarily targeted for scientific applications. But most of the topics covered are really useful to anyone wanting to learn the OCaml language. Of all the ten chapters, I would say only one -- Chapter 4, Numerical Analysis -- is mostly directed to scientists. Well, probably game programmers too. And programmers of computer graphics applications, and anyone using floating-point arithmetic. Anyway, the other chapters that have somewhat of a scientific bent are: Chapter 6, Visualization, which is really about how to use OpenGL and GLUT in OCaml, which is quite cool in itself; and Chapter 10, Complete Examples, but each example is well explained and can be (mostly) understood without previous knowledge.
To give some idea about the book's contents, here is a quick tour: Chapter 1 is a quick introduction, covering most important concepts of the core language. Chapter 2 is about how to structure bigger programs, including function nesting, modules, objects, and how to manage dependencies and compilation. Chapter 3 is a very interesting chapter on data structures in OCaml, beginning with a section on algorithmic complexity; it covers the more important containers provided in the library, and also how to implement and work with trees. Chapter 4 is the one about numerical analysis, covering the basics about doing calculations with limited-precision numbers, and how to use more precise forms of arithmetic. Chapter 5 tackles input and output in OCaml, going beyond the call of duty to present the lexer generator (ocamllex) and parser generator (ocamlyacc) in the OCaml toolset. Chapter 6 is about visualization with OpenGL and GLUT, Chapter 7 is a very good one about optimization, and Chapter 8 a very useful one about libraries. The final two chapters have examples, and don't be fooled by the title of Chapter 9, Simple Examples. There is good stuff there. There are also two appendices, about more advanced features and troubleshooting advice respectivelly.
To be fair, the book has some small weaknesses that, in the end, are not that important, if you consider its target audience and what's common OCaml style. One is the treatment of objects: it is very cursory, and one of the examples (about real and complex numbers) could easily be considered a bad case of OO design. Considering most OCaml programmers rarely use objects, this is not so troubling. The other weakness I'd like to cite is more of a wish from my part: I wish there were more about advanced topics, especially functors (only very lightly touched in Appendix A).
But it's really a very good book about OCaml, both for beginners and for people with some previous exposure to it. It has advice on good programming style throughout, great examples (shown in color, properly syntax-highlighted), and distilled practical experience on some important topics (optimization, using libraries) that is hard to get elsewhere. It is remarkable not only in the very restricted universe of OCaml books, but as a programming book, in general: it stands between the best I've seen.
Monday, September 24, 2007
Subscribe to:
Post Comments (Atom)
16 comments:
No matter how good or bad this book is: The way it gets advertised is a shame for the whole CS book industry!
All this trolling and spamming is getting on my nerves.
This book looks very interesting... I've been thinking of buying it for months now. However, with the current exchange rate it's around $170 US! I don't think I can justify that expense (I know I can't, my wife would kill me - "You paid how much for that book?!" )
Anybody know of any used copies around out there?
no, but there are other good texts freely available :
http://www.cs.caltech.edu/courses/cs134/cs134b/book.pdf
http://caml.inria.fr/distrib/ocaml-3.10/ocaml-3.10-refman.pdf
I agree with the other anonymous reader.
Dr Harrop's spamming made me turn away from OCaml and this book.
I wish he realized he's not doing anyone any good with all the trolling on different usenet newsgroups and his advertisements on reddit.
First of all, I certainly didn't do any spamming, much less trolling, by posting a book review on my own blog. So the comments about spam are out of place here.
But I also don't agree about your characterization of Dr. Harrop's messages as spam. I don't read newsgroups often, but in caml-list he's a frequent and helpful contributor, that once in a while, if it's appropriate to the thread, advertises his book. Spamming would be just the advertising, with little or no contribution to the topic.
And you have to realize the book is self-published, and as such doesn't have any marketing behind it, as it would be the case with a established publisher.
I agree with tautologico.
I read a lot of different newsgroups. I don't find Dr Harrop's contributions offensive in any way (and certainly wouldn't class them as spam). This also applies to the lisp groups where I find the comments made by others far more offensive.
I find his comments about lisp interesting. Some lispers seem to feel the need to resort to personal attacks on Dr Harrop but that only reflects badly on them.
I bought his book and found it to be excellent. His contributions on various newsgroups are helpful and informative. He is one of the reasons I decided to try OCaml and I have not regretted it.
I'm looking forward to the release of his F# for scientists book.
That last message by Bob, "a science graduate from the University of Cambridge", smells a bit fishy...
having bought and read this pedantically titled book while learning OCaml I have to say it is overrated and overpriced. It has valuable information but it does no justice to the price (neither do the numerous typos in it).
Moreover, the recent troll like behaviour the author of the book displayed in comp.lang.lisp is somewhat shameful...
IMHO, the free materials and the ocaml-beginners group are enough to learn the language.
I don't consider Jon's comments as advertising (at least on the caml lists, don't know of the lisp one).
The ratio good comments/bad comments about Jon Harrop here is quite unfair compared to the good he does for the ocaml community.
Yes, it is overrated and extremely overpriced. I also found it quite boring, but this is probablyjust my personal perception. You can probably learn ocaml from the freely available Docs or from the Cousineau/Mauny book a lot better.
I purchased this book after reading many glowing reviews on the web. The authors put their names to the reviews which is significant to me when reading a book review.
The negative comments appear to come only from the Lisp community. This is to be expected. As I prefer OCaml to Lisp I don’t give much credence to their objections. As far as I can tell they dislike Dr Harrop because he criticises their beloved language. It is no surprise that certain vocal Lispers dislike his book (although I doubt they have actually read any of it in reality) – OCaml is a little beyond their capabilities. Most intelligent Lispers move onto better languages when they reach puberty.
Another freely available good one !
http://caml.inria.fr/pub/docs/u3-ocaml/index.html
That comment about OCaml being beyond Lispers capability is ludicrous... I suggest you go and tell Steele or Friedman that ! PLT, THAT's what really matters... As for Jon Harrop , I think he's perceived as being a bit arrogant, not good, no matter how clever you are....
I have Practical OCaml and OCaml for Scientists. Dr Harrop's book is simply excellent. Dr Harrop has been extremely helpful to me and others on the OCaml newsgroups. Not arrogant in anyway and exceptionally good.
As for the comment above about Lispers. Apart from being hilarious it is also accurate. I have yet to stumble upon a Lisper who isn't arrogant and/or deluded. Steele and Friedman aren't giving me shivers. OCaml post dates Common Lisp and is superior.
Thank you for the wonderful review Andrei!
Sorry about the barrage of ad-hominem attacks from the Lispers. They seem to follow me everywhere these days. Always good to see some anti-Lispers saying what I'm thinking too. ;-)
I would be ungrateful not to say a word to defend Jon here.
Numerous times I asked a question on the excellent OCaml-Beginners list, Jon answered me very usefully, often exhibiting a piece of code that efficiently did the job.
Moreover if he mentions his book deals with the question you are speaking about, I feel this kind of advertisement as the cleanest as possible, because it answers to your need.
Post a Comment