Another Rant About the Industry

 
event

The other day I was having a look at what was new on CodePlex when I stumbled upon the sample code that accompanies the book .NET Domain-Driven Design with C#: Problem - Design – Solution.

Not having heard of this book and being a fan of DDD who still struggles with some implementation details and is always open for good suggestions, I downloaded the code and started looking through it. Who knows, maybe the book is worth buying.
I almost felt off the chair with what I saw. Phew! That code? Example in a book about design? In a book about DDD? I am not going to start beating on the code, but I have to point some of the issues I saw, as they add some insight:

  • A sample about DDD and entities HAVE VERY LITTLE TO NONE BEHAVIOUR!!!! Only getters and setters all over the place. Aggregate structure is important, but… no behaviour? Why bother with DDD in the first place?
  • Wait a minute, entities taking care of their own validation? How about context-dependant validation? Not something I would do nor recommend. I’ve seen some heated discussions on the subject and there seems to be a common opinion to keep validation away from your entities most of the time
  • What? Static classes as services? I know it is a cheap way to have singletons… I also know it is a sure way to pay an expensive price later (I have done that in the past). But why would any author show such a poor practice in a book about design? Static service that use static factories to instantiate dependencies that in turn access configuration freely? wow :-O
  • Some behaviour inside an entity? Nah, sorry, my fault, it is just an entity taking a dependency on a static service for lazy initialization of some of the properties.
    Hey, wait a minute, that is a method that does something. It is transforming an entity into another. My eyes!!! They hurt!! Entities taking dependencies on services, again! No wonder why the sample ships with so little tests (and they are not top quality I have to admit), it must have hurt just trying

And then I stopped looking at the code and felt an unhealthy interest in looking at the Amazon reviews of the book. I saw some very positive reviews but a very honest negative review, that was picking on the poor quality of the code and pointed out that the data access code might suffer from SQL Injection attacks, caught my attention. Then I read a comment to that review and then I felt depressed.

Go on. Read the comment. Wipe away your tears and/or stop the nervous laugh. The guy commenting is actually complaining that because the subject of the book is not SQL or coding best practices, it is acceptable for the code to be sub-optimal. I am even in doubt (God forgive) he might be able to see any issues with the code. But even that argument does not hold itself, because THE CODE HAS SERIOUS DESIGN ISSUES. AND THE BOOK IS ABOUT DESIGN!!!!!

I got profoundly depressed. I started to compose a comment but for some reason Amazon rejected me as a non-customer (my European purchases don’t seem to count). But I had to let my grieve out and I happen to have a blog.

What is the state of this industry in which books are written with such a low standard?
What is the state of this industry when the few developers that are into reading technical books have the guts to defend an author that is not able to deliver good enough code to exemplify materials he should be more than proficient in?
What will be the state of this industry when less experienced developers start writing production systems that handle our data and money with the support of practices they were exposed by a published book recommended by fellow developers?
What is the state of this industry in which technical reviewers allow such abomination to hit the press?

Although I have not written any book myself, I know it must be hard. It must difficult and terribly time consuming.
Authors should have a responsibility with their readers. Even if the code was not published inside the book (I do not know as I have not read the book nor I plan to), the author refers to it as support material. That code is not an exercise of responsibility. I mean it. It is not.
Can you imagine a medicine book promoting sloppy surgical procedures? Can you depict the community of surgeons and physicians recommending such book? What about an architecture book with some poor construction practices as examples? Would it ever pass a technical revision?

We often complain about the state of our industry. Everyone of us have own share of the fault: book authors, reviewers, readers, developers, managers in all levels, CEOS, … We all should start with looking with critical eyes our own work as well as others. Promote higher standards and accept none lower that those. Maybe then we might be in a position of improvement.

Now I feel tired… very tired.

share class ,