Thursday, October 05, 2006

Applying Domain-Driven Design and Patterns - Boring Rant

If you haven't read Jimmy Nilssons book on DDD in .NET this will be boring, in fact its probably boring even if you have read it.

I should first say that I like the book but have issues with it as I explained in my Amazon review for it. However there's one part of the book thats annoyed me quite a bit, and I think it displays a problem that seems to happen when the authors in books don't think enough about the readers.

Its the section on "Test-Driving A Web Form" in chapter 11.

First off I won't be rushing out to unit test GUI's left right and center, especially not when it adds to the complexity so much. However its an interesting topic that could have been quite enjoyable to read about...

...except for the fact that the author of that section seemed to be more interested in force feeding the reader his views on unrelated topics.

In particular the author doesn't like prefixing I on interfaces. Fine. However it annoys me that his examples don't use the prefix despite the fact that the majority of his readers and (nearly) the entire FCL uses it. He even goes as far as to stick an entire page in the middle of his discussion describing why he doesn't use the I prefix. Its ridiculous, all he's done is confuse and sidetrack the reader with information that would have been better in an appendix (or at the end of the section, or in the bin).

Anyway I think his argument is questionable, even if every developer now stopped using the I prefix we'd still be stuck with it on all the existing interfaces. Do you really want people reading your code to have to deal with a prefix that is only used on some interfaces? I think not. Anyway interfaces are treated differently in languages that don't support multiple inheritance so I find the seperation useful.

Even if the argument wasn't weak though, and even if I felt the I prefix was the cause of global warming AND the darkness in the hearts of men, I wouldn't want it to be shoved down my throat in the middle of a discussion about something completely different!

On the flipside if you want examples of books that give you lots and lots of information in a relatively concise manner, that are enjoyable to read and that have good code examples then I'd recommend looking at Robert C Martins agile development book and Eric Evans DDD book.

Both are superb. Heck I'd rather read the Java samples carefully chosen by people like Robert Martin or Eric Evans than the C# examples in some C# books. Put it this way would they put code like this in an example:

// using A=NUnit.Framework.Assert
A.AreEqual(SrcPanel, "a> b> c ");

Share This - Digg It Save to del.icio.us Stumble It! Kick It DZone

4 comments:

  1. Anonymous2:39 pm

    Ok, Col - I've just bought the DDD book you recommend. I read relatively few of these sorts of books because I generally can't stand them. 'The Pragmatic Programmer' and the like are normally filled with such rubbish code, annoyingly pretentious quotes at the start of every chapter, claims that the book presents a pattern langauge when the authors have done no more than present cross references at the end of a chapter BUT...I'll try to love again!

    In summary, it better not suck cos I have a fairly good idea where you live, and will be round demanding you refund my money before you can call the ASBO hotline that I know you have on speed dial :)

    ReplyDelete
  2. Oh dear, don't be trusting anything I say.

    Did you buy the Eric Evans one, if so I'm confident you'll like it. So confident that I'll bet you that it'll be your new favorite book (knocking "Trotsky For Dummies" down to second).

    If its the one thats the topic of this post then I wouldn't recommend you get it right now, especially as I'm not sure you'd enjoy the chatty style.

    ReplyDelete
  3. Anonymous4:16 pm

    Er...I bought the one you said was good (Evans) and not the one you said was crap.

    ReplyDelete
  4. Ahh, so you actually read the rant.

    Very dedicated of you, I must admit that I find these sorts of rants boring so I closed my eyes when I was typing it in to avoid reading it.

    Na you'll definitely like the book you've ordered, it gets two thumbs up from me.

    ReplyDelete