Adaptive Code via C#: Agile coding with design patterns and SOLID principles (Developer Reference) (英語) ペーパーバック – 2014/10/19
Kindle 端末は必要ありません。無料 Kindle アプリのいずれかをダウンロードすると、スマートフォン、タブレットPCで Kindle 本をお読みいただけます。
Agile coding with design patterns and SOLID principles
As every developer knows, requirements are subject to change. But when you build adaptability into your code, you can respond to change more easily and avoid disruptive rework. Focusing on Agile programming, this book describes the best practices, principles, and patterns that enable you to create flexible, adaptive code--and deliver better business value.
Expert guidance to bridge the gap between theory and practice
- Get grounded in Scrum: artifacts, roles, metrics, phases
- Organize and manage architectural dependencies
- Review best practices for patterns and anti-patterns
- Master SOLID principles: single-responsibility, open/closed, Liskov substitution
- Manage the versatility of interfaces for adaptive code
- Perform unit testing and refactoring in tandem
- See how delegation and abstraction impact code adaptability
- Learn best ways to implement dependency interjection
- Apply what you learn to a pragmatic, agile coding project
Get code samples at:
Gary McLean Hall specializes in patterns and practices, with particular focus on creating code that is adaptive to change.
Okay, first let me give a little bit of my background so that you will know whether or not this book is for you. First of all, I do not have a formal computer science degree. I do have a degree in electrical/computer engineering, but not computer science. I have had a few formal classes in object-oriented design, data structures and algorithms, operating systems, and an elective in web programming. As far as my experience goes, I have about 1 years of professional software development experience with .NET and C#. I knew nothing about SOLID or TDD at the time I started reading the book. I actually didn't even know what an interface was, but did know that I needed to improve my software design skills. On the back of the book it actually says "Not for beginner programmers... for experienced developers", but I would still consider myself a beginner with C#. Maybe Gary just explains things so well, and makes the concepts easy to understand.
Now, for the review. I have skipped the first chapter which is about SCRUM and some project management concepts I am not interested in right now. That being said, I am about 70 pages in and wow... I've had my eyes opened up to the way that software is supposed to be done. The second chapter of the book (where I started) talks about the basics of layering patterns and managing dependencies through simple interfaces. I immediately started finding examples that I could go and apply at work. That's the great thing about this book, Gary will explain a concept, and is right there with an example to show you how its done.
How exactly did this book help me? I was able to design some interfaces (not previously knowing what they were) using some of Gary's patterns and I have a much better way of managing my libraries/dependencies now.
Gary's formula for describing the different problems in software, and then explaining/giving examples on how to handle them makes this a great buy!
I will update this review if things change as I continue into the book.
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. 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.
I had one programming style (resulting code nothing but a big pile of mud) until I read this book. A game changer.
There are some comments from experienced developers that there were coding errors in this book. Even then, for a beginner to an intermediate programmer, this book is a must-read if the programmer does not know SOLID principles.
There are also some comments about the lack of necessity regarding 1st section of the book, covering Scrum. This is debatable. I thought that it laid a foundation quickly why Adaptive Coding to an Agile environment is required.