Current book project: Real World Functional Programming

Now that it’s all official, I can reveal that since the tail end of last year I’ve been helping out with Real World Functional Programming by Tomáš Petříček (and me, ish).

I’m doing the same kinds of things I did with Groovy in Action, coming to the text with fresh eyes: I’m technically competent but don’t have any expertise in the subject matter. This means I can see it as a “real” reader would, challenge the assumptions, point out places which need more explanation etc. I’m also polishing the language a bit and adding a few informative notes. I suspect by the end there won’t be a single paragraph that I’ve written in its entirety, but there’ll also be few paragraphs which I haven’t touched at all.

It’s exciting to get a chance to work on the book, and I hope I’m improving it. Check it out, join the MEAP, and give us feedback :)

I have a couple of other books on the back-burner at the moment too; hopefully I’ll be able to give more details reasonably soon.

14 thoughts on “Current book project: Real World Functional Programming”

  1. Good to know you’re still writing

    I am reading C# in depth for the second time and I consider it as the best C# book available

    Do you plan to write a book on C#4? (I know it is a lot of work and would understand a negative answer ;))

    Like

  2. Glad to hear that C# in Depth is worth a reread :)

    There are certainly vague plans to update it for C# 4 – probably keeping the existing content (rather than removing the C# 2 stuff – I think it’s still important as an anchor) and just adding an extra “part” at the end. That risks turning the book into yet another massive tome, but I don’t think there’s going to be *that* much in C# 4. Maybe 100 pages, at a guess? Anyway, it’s all very preliminary at the moment – suggestions of what you might like to see would be very welcome.

    In particular, would it be worth a chapter on .NET 4.0 (i.e. framework features) instead of just language stuff? There’s more framework than language in v4, as far as I can see – Parallel Extensions, Code Contracts and the DLR to name just three big features! I was considering a pitstop tour, just like chapter 12 took for LINQ providers – but I don’t know whether that’s entirely appropriate, particularly if we’re worried about length.

    Like

  3. Just great, Jon. C# in Depth is the best book on C# 3.0/2.0 and what should be in C# 4.0, and Tomas’ book, which I have already read in parts as an MEAP edition, is a passionate presentation of functional programming in F# with plenty of C# examples by an author who already knows C# in depth. I am sure that your contributions will make this the definitive book on how to use F# for real-world programming and show C# programmers how to use the dynamic features of the forthcoming .NET 4.0, regardless of whether they are programming in F# or C# 4.0. With your input, Tomas’ book just got a whole lot better, and while no offense is meant to Tomas as a Czech, I also hope that you as a Brit will help him a bit with his language, which can sometimes be disturbing in his writing but which in no way detracts from the excellent content of his book so far.

    Like

  4. Glad to hear that C# in Depth is worth a reread :).
    Yeah it’s. I am planning take it to my village -fabulous calm place for reading- in the vacation this summer to reread for second time, beside I almost reread about 50% of it while referring to for some stuff in particular. And it’s great news to hear you will add c# 4.0 stuff to the book, please do it.

    Like

  5. Great to hear you’re working on another book!

    However, after looking at the description on Manning.com I was wondering who is the target audience?

    Is it .net devs who want to learn F#?? If so why provide CSharp examples?

    Or CSharp devs who want to learn to more fully use the new functional features already in CSharp? If so, why all the F# examples? I would think at the rate new functional features are going in any new/updated Csharp book would have spend some time trying to address writing functional code and the needed “thinking change” everybody keeps talking about.

    Like

  6. Another thought … there are a bunch of ‘functional’ concepts that I dont get … like ‘currying’ (not the spice!) recursion and ‘continuations’ … I would love to see this explained in a CSharp context.

    I admit, as a java developer, before reading your explanation of ‘closures’ in CSID I didnt get it at all. I knew in Java that you could only use final variables in a method local inner class but thats about it.

    Like

  7. Keith – I think that understanding some of the functional concepts like continuations and currying only in the C# language would be a bit difficult. The Real-World Functional Programming book in fact shows both of these concepts in C#, but they just look a bit weird. When you see them side-by-side with a more realistic use in F#, it becomes more obvious that the concepts can be quite useful (and aren’t just a totally odd way to confuse anyone who would be reading your C# code). After all, continuations don’t make any sense in C#, because there is not tail-call optimization, so it can be demonstrated, but it won’t really work…

    Like

  8. Jon great to hear you are contributing on the book.. I have ordered the rough cuts..

    I too recommend showing all examples in C#, and if you just give me two minutes before thinking “no we have to show continuations etc..” and analyze the situation then I think it might be worth a second thought.. Remember sometimes knowing when to be flexible pays off..

    My 2 cents for your consideration go like this..

    I am sure that you would agree that “General Acceptance”, as Dijkstra defines it matters to writers of computer books.. http://www.cs.utexas.edu/users/EWD/transcriptions/EWD04xx/EWD447.html

    And since we now know the 2008 computer book market share number and that they show that in terms of units sold, C# was the number 1 language in book volume with 15.58% and the market share of F# units sold was .10% market share.

    http://radar.oreilly.com/2009/02/state-of-the-computer-book-mar-22.html

    Just maybe to achieve your end goal and reach/teach the largest number of .NET programmers to use a functional style you should make it possible for them to learn first in the language they use the most.

    Since if you introduce both a new style and a new language at the same time you might just be teaching the small number of folks that have the time/energy to learn a completely new language or those programmers that are already using F# and they probably don’t need the book anyway..

    Thanks for your open mindedness.

    Like

  9. To me, this book is great *specifically* because it clearly explains functional concepts, explains why they are good and shows how they are reflected in C# 3.0 and in F#.
    I think it already greatly improved my C# style and helped to understand, that LINQ is not a esoteric way of working with SQL directly in C#, but first of all – a way to program in a functional C#.
    A F# line of this book is very gentle, and at the same time it gives an understanding of why such a strange for C# programmer syntax is good and how it allows to express algorithms in much more concise way that C#.
    So, I’m sure that combining these three lines: functional programming, C#, and F# is a great idea.

    Like

  10. @Vladmir: I’m so glad you like the book so far – I do hope I’ll be improving it from your point of view, and not ruining it :)

    I’ll pass on your comments to Tomas – I’m sure he’ll be thrilled to hear them.

    Like

  11. Jon,

    I hope that you realized that I wasn’t saying that you take out the F# examples at this stage of the game, but that in addition to the F# you show all examples in both F# and C#, thus I was really saying the same thing as Vladimir..

    Regards,

    Anthony

    Like

  12. @Anthony: We do try to show a lot of examples in C#. I haven’t checked what the state of the downloadable code is, but I’ll work with Tomas to try to make sure we’ve got as many C# “parallel examples” in code as possible, even if we can’t get them into the book itself.

    I don’t think it makes sense to show *all* the examples in C#, as some of the “equivalent” solutions in C# really aren’t the best way of tackling things, but we do try to discuss and compare solutions wherever possible. I suspect that my involvement has increased that level, too :)

    My contribution is largely that of “belligerent C# advocate who really needs to be convinced of things” – I bully Tomas about every claimed functional/F# advantage until the text makes the advantage obvious, with any luck.

    As such the amount of text I’ll have actually contributed to the book by the end will probably be quite small – but hopefully the *impact* on the book will be more significant.

    Like

Leave a comment