small medium large xlarge

12 Jun 2014, 18:26
David Whittaker (4 posts)

In Chapter 2, we are introduced to the count-all-the-words-on-Wikipedia example. It would be great to use that example throughout the book to show how it can be reimplemented (more simply) in other languages using the new concepts. [Or use the translation server throughout] It seems like with the great constructs in Clojure, for example, there is a missed opportunity to show off the its power to easily construct something like this.

18 Jun 2014, 12:57
Paul Butcher (37 posts)

Sorry for the delayed reply, David. And thanks (as always) for taking the time to provide feedback.

I agree that there would have been value in having a consistent example across all seven weeks, and I did spend considerable time trying to find one. The Wikipedia word count example is the closest I could come up with, but it wouldn’t work for every chapter, however:

There is a Clojure implementation of the Wiki wordcount example in chapter 3 (Functional Programming). There are also Elixir (chapter 5, Actors), and MapReduce (chapter 8, The Lambda Architecture) versions - so together with the Java version in chapter 2 (Threads and Locks), 4 of the 7 weeks use that example.

There’s little value in using the same example in chapter 4 (The Clojure Way), as the functionally impure aspects of Clojure really don’t add anything helpful for this problem over and above what the reader’s already seen in chapter 3. If you can implement something with a purely functional approach in Clojure, you almost certainly should :-)

There’s a slightly different version of the word count example in chapter 6 (Communicating Sequential Processes) which counts words in RSS feeds rather than from Wikipedia. I could have implemented exactly the same example with CSP as I did with Actors, but it would have had so much in common with the Actor version that I didn’t think it would add much. And I wanted an example that demonstrated CSP’s strengths with IO, hence RSS feeds instead.

Counting words really wouldn’t be a good fit for chapter 7 (Data Parallelism) because text-processing isn’t GPGPU Programming’s strength.

You must be logged in to comment