Howard Dierking

howarddierking

Total Posts: 36
Channel 9 Blog for howarddierking
page 1 of 4
Posted By: howarddierking | Sep 11th @ 11:18 AM | Comments: 1
Extreme ASP.NET Makeover: Mr. Escher, Your Software is Ready - Refactoring Notification
The circular dependency problem between Pages and Users is due to each class implementing part of a larger notification feature. Once again this was not obvious when the two classes were coupled together via Singleton instances. Although the Single Responsibility Principle (SRP) would encourage us to have a separate Notification class, our primary job right now is to disentangle Pages and Users. Once the responsibility for notifications has been moved to one class or the other, it can be…[more ]
Posted By: howarddierking | Sep 11th @ 11:17 AM | Comments: 0
Extreme ASP.NET Makeover: Mr. Escher, Your Software is Ready - Circular Dependency Cycle
The only reason for Users to reference Host is to raise events on behalf of the Users class. We can quickly and easily remove this dependency by allowing Users to raise its own events[more ]
Posted By: howarddierking | Sep 11th @ 11:17 AM | Comments: 0
Extreme ASP.NET Makeover: Mr. Escher, Your Software is Ready - Host Users Dependency Cycle
We successfully refactored away Host’s dependency on Settings.Instance by allowing the IoC container to pass Host an instance of ISettings via its constructor. It seems like a simple matter to continue refactoring away Host’s dependencies on the other Singletons, but trouble is brewing just around the corner. The next Singleton we extract is Users.Instance. Following exactly the same procedure as Settings.Instance, we discover a horrible secret - a CircularDependencyException.

[more ]
Posted By: howarddierking | Sep 11th @ 11:17 AM | Comments: 0
Extreme ASP.NET Makeover: Mr. Escher, Your Software is Ready - Dependency
As we saw, the Host class delegates to a whole host of Singletons (bad pun intended), including Settings, Users, Pages, Snippets, NavigationPaths, and AuthWriter. Each of these Singletons refers to other Singletons, creating a morass of dependencies. Before we start refactoring Host, we need some tests in place to ensure that we are not breaking anything. Configuration of the application and infrastructure is done by the ApplicationBootstrapper, which we introduced in Part 8. Our tests are going…[more ]
Posted By: howarddierking | Sep 11th @ 11:17 AM | Comments: 0
Extreme ASP.NET Makeover: Mr. Escher, Your Software is Ready - Overview
We’re now on the ninth installment of Extreme ASP.NET Makeover. In part 8, we discovered that the ScrewTurn Wiki codebase suffers from dependency problems. Tight coupling of implementation classes caused by singletons and static classes result in a morass of objects, which is difficult to refactor. Dependency cycles between objects result in sensitive constructor and method orderings, which can lead to unexpected NullReferenceExceptions after apparently innocuous changes to the code. We…[more ]
Posted By: howarddierking | Aug 31st @ 5:10 PM | Comments: 0
Extreme ASP.NET Makeover: Disentangling Our Tangled Web-Overview - Refactoring
The constructor signature for AuthorizationChecker now looks like this:[more ]
Posted By: howarddierking | Aug 31st @ 5:10 PM | Comments: 0
Extreme ASP.NET Makeover: Disentangling Our Tangled Web-Overview - Overview
We’re now on the eighth installment of Extreme ASP.NET Makeover. In part 7, we examined the singleton pattern and refactored away the AuthChecker singleton. AuthorizationServices, which previously used the AuthChecker singleton, now depends on the IAuthorizationChecker interface and simply creates an instance of the AuthorizationChecker class in its constructor by calling the new operator. In this intallment, we will discuss better ways to manage dependencies in our applications using an…[more ]
Posted By: howarddierking | Aug 4th @ 4:57 PM | Comments: 0
Extreme ASP.NET Makeover: Singleton - Refactoring
Now that we have a new class, complete with functionality, we can start to refactor other parts of the application to use it instead of the AuthChecker singleton.  Like all the other refactorings we’ve done thus far in this article, it’s not that big of a deal.  As our example, we’re going to continue to refactor the AuthorizationServices class (see the previous Separation of Concerns article for the initial refactoring for this).  In AuthorizationServices, we want to eliminate the use of…[more ]
Posted By: howarddierking | Aug 4th @ 4:57 PM | Comments: 0
Extreme ASP.NET Makeover: Singleton - AuthChecker Class
So where should we start?  How about the AuthChecker class, since that’s what we’ve discussed through the first part of this article.  Earlier, we decided that there was no reason for it to continue to be a singleton, since there was no compelling reason for one, and only one, instance of it to exist for the life of the application.[more ]
Posted By: howarddierking | Aug 4th @ 4:57 PM | Comments: 0
Extreme ASP.NET Makeover: Singleton - Testability
We have a few issues with singletons. The easiest argument to make is that singletons make your code hard to test. If you make a call to a singleton in a class, then you must make sure the singleton is initialized whenever the test is run. If the singleton requires a connection to a database or the existence of a Web service, these must be configured prior to running the test. If you want reasons why this is a bad practice, look no further than our previous article on separation of concerns.[more ]
page 1 of 4
Microsoft Communities