The "dream book" for C# and .NET

This morning I showed my hand a little on Twitter. I’ve had a dream for a long time about the ultimate C# book. It’s a dream based on Effective Java, which is my favourite Java book, along with my experiences of writing C# in Depth.

Effective Java is written by Josh Bloch, who is an absolute giant in the Java world… and that’s both the problem and the opportunity. There’s no-one of quite the equivalent stature in the .NET world. Instead, there are many very smart people, a lot of whom blog and some of whom have their own books.

There are "best practices" books, of course: Microsoft’s own Framework Design Guidelines, and Bill Wagner’s Effective C# and More Effective C# being the most obvious examples. I’m in no way trying to knock these books, but I feel we could do even better. The Framework Design Guidelines (also available free to browse on MSDN) are really about how to create a good API – which is important, but not the be-all-and-end-all for many application developers who aren’t trying to ship a reusable class library and may well have different concerns. They want to know how to use the language most effectively, as well as the core types within the framework.

Bill’s books – and many others which cover the core framework, such as CLR via C#, Accelerated C# 2008 and C# 3.0 in a Nutshell – give plenty of advice, but often I’ve felt it’s a little one-sided. Each of these books is the work of a single person (or brothers in the case of Nutshell). Reading them, I’ve often wanted to give present a different point of view – or alternatively, to give a hearty "hear, hear." I believe that a book giving guidance would benefit greatly from being more of a conversation: where the authors all agree on something, that’s great; where they differ, it would be good to hear about the pros and cons of various approaches. The reader can then weigh up those factors as they apply to each particular real-world scenario.


So what would such a book contain? Opinions will vary of course, but I would like to see:

  • Effective ways of using language features such as lambda expressions, generic type inference (and indeed generics in general), optional parameters, named arguments and extension methods. Assume that the reader knows roughly what C# does, but give some extra details around things like iterator blocks and anonymous functions.
  • Guidance around class design (in a similar fashion to the FDG, but with more input from others in the community)
  • Core framework topics (again, assume the basics are understood):
    • Resource management (disposal etc)
    • Exceptions
    • Collections (including LINQ fundamentals)
    • Streams
    • Text (including internationalization)
    • Numeric types
    • Time-related APIs
    • Concurrency
    • Contracts
    • AppDomains
    • Security
    • Performance

I would prefer to avoid anything around the periphery of .NET (WPF, WinForms, ASP.NET, WCF) – I believe those are better handled in different topics.

Obstacles and format

There’s one big problem with this idea, but I think it may be a saving grace too. Many of the leading authors work for different publishers. Clearly no single publisher is going to attract all the best minds in the C# and .NET world. So how could this work in practice? Well…

Imagine a web site for the book, paid for jointly by all interested publishers. The web site would be the foremost delivery mechanism for the content, both to browse and probably to download in formats appropriate for offline reading (PDF etc). The content would be edited in a collaborative style obviously, but exactly how that would work is a detail to be thrashed out. If you’ve read the annotated C# or CLI specifications, they have about the right feel – opinions can be attributed in places, but not everything has a label.

Any contributing publisher could also take the material and publish it as hard copy if they so wished. Quite how this would work – with potentially multiple hard copy editions of the same content – would be interesting to see. There’s another reason against hard copy ever appearing though, which is that it would be immovable. I’d like to see this work evolve as new features appear and as more best practices are discovered. Publishers could monetize the web site via adverts, possibly according to how much they’re kicking into the site.

I don’t know how the authors would get paid, admittedly, and that’s another problem. Would this cannibalize the sales of the books listed earlier? It wouldn’t make them redundant – certainly not for the Nutshell type of book, which teaches the basics as well as giving guidance. It would hit Effective C# harder, I suspect – and I apologise to Bill Wagner in advance; if this ever takes off and it hurts his bottom line, I’m very sorry – I think it’s in a good cause though.

Dream Team

So who would contribute to this? Part of me would like to say "anyone and everyone" in a Wikipedia kind of approach – but I think that practically, it makes sense for industry experts to take their places. (A good feedback/comments mechanism for anyone to use would be crucial, however.) Here’s a list which isn’t meant to be exhaustive, but would make me happy – please don’t take offence if your name isn’t on here but should be, and I wouldn’t expect all of these people to be interested anyway.

  • Anders Hejlsberg
  • Eric Lippert
  • Mads Torgersen
  • Don Box
  • Brad Abrams
  • Krzysztof Cwalina
  • Joe Duffy
  • Vance Morrison
  • Rico Mariani
  • Erik Meijer
  • Don Symes
  • Wes Dyer
  • Jeff Richter
  • Joe and Ben Albahari
  • Andrew Troelsen
  • Bill Wagner
  • Trey Nash
  • Mark Michaelis
  • Jon Skeet (yeah, I want to contribute if I can)

I imagine "principal" authors for specific topics (e.g. Joe Duffy for concurrency) but with all the authors dropping in comments in other places too.

Dream or reality?

I have no idea whether this will ever happen or not. I’d dearly love it to, and I’ve spoken to a few people before today who’ve been encouraging about the idea. I haven’t been putting any work into getting it off the ground – don’t worry, it’s not been delaying the second edition of C# in Depth. One day though, one day…

Am I being hopelessly naΓ―ve to even consider such a venture? Is the scope too broad? Is the content valuable but not money-making? We’ll see.

32 thoughts on “The "dream book" for C# and .NET

  1. I don’t think I would call it naive for thinking about such a book. Look at the book Beautiful Code. It has input from all different types of people across the globe.

  2. Sounds like the kind of book I’d read. For the most part, I don’t think the scope is too broad. Maybe subjects like concurrency and security are too big to be covered in the amount of detail that you’d like however? The book would feel incomplete if they were not addressed at all though.

    I like your list of authors. Erik Meijer was one of the best teachers I’ve had in university πŸ˜‰

    Hypothetically, if you were to do this, who would take the lead on the project? It couldn’t be more than just a few people πŸ™‚

  3. @Jeff: What *doesn’t* exist is effectively conversations between the different people I’m talking about. The opinions exist separately, but I believe they would give more value if they were all in one easy-to-find place, and were able to respond to each other’s points.

  4. I would say 100% of material is already written by those authors. Hence you have three tasks ahead of you:

    1) Pull this material together in a coherent fashion from their books/blogs/articles.

    2) Receive a feedback from those authors regarding the rest of the book.

    3)Incorporate their feedback, arguments, pros and cons

    I would definitely buy this book…

  5. Hm interesting idea, but honestly I do not see this happening anytime too soon. People are too greedy nowadays to come together..

  6. I’d love to see more collaboration between the big names, and a “living document” is an excellent idea for such a young language.

    Sorry, but I just don’t believe that *anyone* can know what C# best practices are right now. It’s a language that continues to be in a lot of flux, and that people just don’t have enough experience with (Effective C++ was published when the language was almost 20 years old, and it was the *first* “best practices” book in the field to be taken seriously). There’s just no way that any “C# best practice” printed book can be taken as gospel. Some of the classics like Framework Design Guidelines are really starting to show their age.

    On the other hand, having a living document – including discussions from the top minds about tradeoffs – would be awesome!

    As a favor to me, please allow some way for some of us Mere Mortals to at least suggest discussion about some topics. I’ve read most of the books you referenced, and many of them periodically ignore superior solutions. Having the room for a discussion would at least show that alternate solutions were not chosen and why. That alone would be groundbreaking.

  7. I wonder why it wouldn’t work. Are any of the authors mentioned actually making a serious living from their books? I’m sceptical – it’s more likely that writing is a combination of boastfulness (see how much I know!) and altruism (you too can know how much I know!), with helpings of fulfilment (writing something other than code that someone else actually reads) and maybe some pocket money. Oh, and the very 21st Century building of the “personal brand”. I’m not knocking technical authors at all – whatever motivates them to write the books I buy and read and benefit from is fine with me, I’m just not convinced it’s so much about the cash.

    So given that, why wouldn’t those on the list be motivated to write just one measly chapter each of a book that would scratch so many of those itches? If there has to be money and a publishing deal is tricky, how about a PDF on and an even split?

  8. Whatever form this takes, one feature I’d really like to see is tagging of the content based on the language/framework versions it applies to… things change, and with most books I find it very hard to judge what advice is still valid. As performance optimisations get made inside the framework to support common use-cases, all kinds of trade-offs might change. Note that simply updating the content might not be best either, since there may genuinely still be people on the previous version that could benefit from the earlier balance in a trade-off.

  9. Does that mean Josh Block = Anders + Don + Wes + …. + Jon? πŸ™‚

    I mean – Does “Effective Java” have all the related things that you mention above?

  10. @Kalpesh: EJ doesn’t have all of them, but it was the inspiration for the idea. It *does* cover an amazing number of subjects incredibly well for such a slim book.

  11. Thanks Jon.
    I must admit that there are lot of things I don’t yet understand as a developer.

    I wish there were books on each topic which help developer understand the unchanging basics.

    e.g. Windows Security (roles, shares, impersonation, network, active directory).
    DB security (could be specific to a DBMS).
    Concepts related to IIS (authentication, security for web, caching).

    Do you know of any such source?

  12. u have definitely forgotten about DDD, BDD, TDD, AOP, IoC, ATDD, ORM and a zillion things that the .Net community keeps arrogantly ignoring

  13. The problem I see is that when so many authors are collaboratively writing some content, it might not have that integrated flow and consistent feel. that **one** mind brings. I am also worried about how the content flow will be controlled. There are tons of content scattered all over internet but I still I buy Skeet’s book because it gives me an opportunity to cover each topic in a sequential and consistent manner. How will that be achieved on a web-site?

  14. @Mike: I haven’t forgotten about them – I just don’t think they’d be appropriate for this particular book.

  15. What about Juval Lowy?

    His “Programming .NET Components, 2nd edition” is a must have. Unfortunately, it is focused on the Framework 2.

    Many of the topic you touched up are largely discussed in the underlying book. For advanced users, definitely.

  16. 1. Why would any publishers fund a website that not only will not make them any money but will likely cannibalize sales of their existing books?

    2. Why would any experts who essentially advertise their own expertise in their writing take their insights to a collaborative website where they are just one voice among many? Worse, a website that exists for the specific purpose of disputing their statements?

    Those experts aren’t academics whose job requires debating with other academics. On the other hand, they might need the mutual support network of their colleagues to get new jobs or projects, and that’s what usually limits their comments on those colleagues’ writing to uncritical praise.

    We’ve got only one good example for actual expert debate in the .NET world, and that’s the book “Framework Design Guidelines.” But in this case the published discussions have already happened during the design process, so there was no extra effort expended or antagonism created. Moreover, the publisher (Microsoft) has a vested interest in preemptively defending the subject matter (the BCL) from criticism.

    I can certainly see Microsoft produce other books or websites like this, also with the goal of clarifying the use of MS libraries and preemptively defending them. Many MS technology blogs focus on questions that can be summarized as “Why did we make product X work this way and not another”, but always presented as a finished discussion where all the expertes have already reached agreement.

    By the way, the third edition of “The C# Programming Language” added a very timid attempt to reproduce the kind of printed debate that makes the FDG so useful, but interestingly it falls flat — the comments mostly just offer clarifications rather than any actual debate.

    In other words, I don’t think your idea is going anywhere unless you can get a university to fund a departement for C# research. πŸ™‚

  17. I think you’d have to be careful that it didn’t get bogged down, as with so many voices involved it may be quite hard to draw firm conclusions. Maybe pick the discussions in such way that the answer isn’t always a resounding ‘it depends’ and the opinions aren’t always wildly diverging. I guess I’m just impatient, but I like to come away from each chapter of a book with something I can point at and say “this is true.”

  18. I want to see more books like (more) Effective C#. Books that give advice, show you the pitfalls, common mistakes developers make, better way of doing something.. etc.

    I don’t want to see books which are a rehash of languages and framework documentation available on Microsoft’s sites like MSDN. I want to see information which is hard to find, real world experience from developers. How they solved hard problems.

    98# of current books are boring. They are just better in organizing information which is available on the web. That’s why I don’t buy books anymore. I just browse relevant chapters at the bookstores. (Sorry Skeet. I read parts of your book for free) I did buy Effective C#. I learned from the 50 advices.

  19. Wasn’t this sort of thing the promise of RSS syndication of blogs?

    Much of this information is already in blogs, and many writers already respond to each others posts, what’s needed is just something that aggregates just the experts (unlike MSDN blogs which drowns the technical advice in a flood of posts from non-English speakers and “evangelists”). Automatically producing links of related posts from other experts (using keywords and statistically significant phrase analysis) would also be helpful.

  20. Personally I’d like to see a bridging between the ‘language\framework’ book and the ‘pattern’ book.

    Something that demonstrates how to use generics, lambdas, expressions to implement common patterns like repository, validation, specification patterns. These would be given as examples of usage after the detail technical knowledge of the specific area.

  21. Having picked up a few multi-authur Red .NET books in the past, I think the dream team approach leads to a very disjointed and overlapping set of chapters.

  22. I hope you go for it – anything that comes out of this would be an interesting read even if it took a couple of editions/revs to get to the full scope. No concrete ideas but something this big and with so many authors might lend itself to format other than the traditional book?

  23. The first object of the scope: “Effective ways…” contains much functional programming based practices. However, your dream team does not seem to have so much functional programming gurus. πŸ˜‰

Comments are closed.