Book Review: Adaptive Code via C#

      No Comments on Book Review: Adaptive Code via C#

I recently finished reading Adaptive Code via C#, and I highly recommend it. It’s not for the absolute beginner, but if you’re an intermediate or even senior programmer I think you’ll find this book very helpful.

The book starts with a summary of Scrum, and I think it makes a good quick reference. For a more in-depth description of Scrum, see the book Scrum: The Art of Doing Twice the Work in Half the Time, which I also recommend (I actually listened to the audiobook).

The chapter on dependencies and layering was an excellent discussion on organizing projects in Visual Studio solutions. The idea is to minimize dependencies between your code and external APIs (like ESAPI). This helps to untangle your code and keep its components isolated, which makes it easier to maintain them. I applied this concept to one of my projects and I immediately saw the benefits.

The book has a chapter on unit testing, but it’s more of a refresher. If you really want to understand unit testing well, read The Art of Unit Testing and Growing Object-Oriented Software, Guided by Tests. Also, I much prefer using NUnit and NSubstitute as my unit testing and mocking frameworks. The book uses MSTest and Moq.

The second part of the book discusses the SOLID principles. Each principle gets its own chapter, so it’s quite detailed. What I really like about these chapters is that the author doesn’t stop at theory or simply tell you what your code should look like. He actually goes through relevant examples and shows you how to make your code follow the SOLID principles.

The decorator pattern described in the chapter on the single responsibility principle was a huge eye-opener. I’ve known about this pattern before, but the way that he uses it to make code more adaptive is something I hadn’t seen before. It elevates interfaces as major players in your code.

The third and final part of the book contains chapters that go through a couple of iterations of a sample project. The characters in these chapters use Scrum to plan the project and use the adaptive patterns in the book to develop it. It felt realistic and it was entertaining, and it helped to remind me of the practices recommended in the book.

There wasn’t much that I disliked about the book, but one thing stands out. A lot of the examples (and even the sample project) focused on ASP.NET MVC development. Being a desktop app developer, I’m more interested in WPF and MVVM. He mentions them a few times, but only to say that the same principles as MVC apply to them. I don’t think they do. WPF and MVVM focus on data-binding, which make view models much more dynamic than the static view models in an ASP.NET MVC application.

In summary, this book will help you in becoming a better developer. Your code will go from being a big ball of mud to clean code that is adaptive to change.

Leave a Reply

Your email address will not be published. Required fields are marked *