Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comments for "Dependency Injection Principles, Practices, and Patterns" #3

dotnetjunkie opened this issue Jul 9, 2019 · 1 comment


Copy link

dotnetjunkie commented Jul 9, 2019

In the section below, you can leave your comments for this blog post:

Please be aware that a comment posted here will be shown in the comment section of the blog post, using JavaScript. This means that you should consider this a comment directly on my weblog—not as a post on GitHub.

This means that I might

  • Alter your comment—For instance, to correct spelling or make style and layout corrections
  • Delete your comment—In case I delete your comment, I will typically try to contact you to get your question answered. I can, for instance, delete your comment when I feel that the comment
    • Is not constructive
    • Is not related to the topic
    • Is too long
    • Is not helpful to most of my readers
Copy link
Owner Author

dotnetjunkie commented Jul 9, 2019

The book forum on Manning's website contained a more detailed description of the changes we made in the second edition but, unfortunatelly, Manning pulled the plug on the forum. With it, all posts including that description turned to dust.

Below is a (slightly altered) copy of that description:

What the motivation is for the second edition, and, what's new?

Our main motivation for writing a the second edition is to share our new knowledge with a broad audience. Although blog posts, presentations, and Pluralsight videos allow us to get this message across, there is no medium as suited to get a complicated story across as a book.

Because writing a new book is a major undertaking, Mark has asked me to help him. It was simply too much to chew off for Mark alone.

What will not change:
  • The second edition will still be solely about implementing DI in statically typed object-oriented languages. Examples are still just in C#. Functional Programming has its own patterns and practices and deserves a book of its own.
  • Each chapter will still start with a cooking analogy.
What will change:

The second edition focusses even more on patterns & practices than the first edition already did. There are several areas you will notice this:

  • The discussion of DI Containers is completely moved to Part 4. The first 3 parts of the book are completely container agnostic.
  • More examples are added and many parts are completely re-written throughout the book.
  • The Ambient Context pattern is now considered an anti-pattern and we describe in detail why that is (see section 5.3).
  • The original DI refactorings chapter (6) is almost completely rewritten—it now describes code smells (see chapter 6).
  • We added new sidebars and new sections where we warn about bad practices and bad design decisions and describe our own personal experiences.
  • We start referring to the SOLID principles much earlier in the book (in the first edition they were first mentioned in chapter 9).
  • We removed some complexity and ambiguity in the book's running code samples. This allows the reader to focus more on applying the patterns and practices.
  • The Interception chapter (9) is rewritten for the most part. We added this much information that we decided to split up the chapter in three distinct chapters (9, 10, and 11. In chapter 9, we focus on the Decorator pattern as method of interception.
  • Chapter 10 contains complete new material discussing how to apply Aspect-Oriented Programming (AOP) based on the SOLID design principles and -of course- DI. In many ways, we consider chapter 10 to be the climax of the book.
  • Chapter 11 focusses on applying AOP using Dynamic Interception and Compile-Time Weaving tooling. This information was available in chapter 9 of the first edition, but we elaborated the discussion to explain all the downsides that these approaches have compared to the methods described in chapter 10.
  • We now consider compile-time weaving a DI anti-pattern and section 11.2 describes in detail why compile-time weaving is a bad practice when it comes to applying Volatile Dependencies.
  • Chapter 12 describes the basics of DI Containers and goes into details how to choose between Pure DI and a DI Container. This chapter is an updated version of chapter 3 of the first edition.
  • This edition discusses three DI Containers: Autofac, Simple Injector, and Microsoft.Extensions.DependencyInjection. Each container gets its own chapter, and although these chapters are based on the first edition, they also describe how to use those containers in combination with new concepts described in this edition, such as the "AOP by design" approach, laid out in chapter 10, and domain events from chapter 6.
  • Chapter 15 describes the Microsoft.Extensions.DependencyInjection container, and discusses in much detail what the limitations and downsides of this simplistic DI Container implementations are, while we do show how to work around some of its limitations. (spoiler alert: it won't be pretty, and it's impossible to work around all limitations)
  • With the help of Manning’s readability experts, the second edition did an even better job to get the message across.

The book focusses on .NET Core and its frameworks. Although there is still a lot of code that works for any .NET version, especially the parts that show how to integrate (most notably chapter 7), are focused on .NET Core and ASP.NET Core.

We incorporated many of the lessons we learned and knowledge we gained since the first edition was published. This will sometimes manifest itself in small notes or warnings, up to sidebars or even complete sections or chapters.

Repository owner locked and limited conversation to collaborators Jul 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
None yet

No branches or pull requests

1 participant