19. October 2008 15:19
Back in the first Code Refactoring article in the AGT series I mentioned that I'd like to keep in mind flexibility for using aspects of the framework that were not specific to the designer issue on other projects. I sat down to do some work on another Silverlight project tonight, and found that I needed to do make some changes to the DamonPayne.AG.IoC framework. I didn't have to change much, and indeed many people would have foreseen these things before now. I am a big believer in Just in Time Design - plan for just as much as you know you need, or at least strongly suspect you'll need, and let other patterns emerge through use. This only works if you're doing enough Use to actually facilitate some meaningful Learning. Branching out to the second client project, one that does something utterly different than AGT, is a good step forward.
Refactor: I immediately found that I needed a way to Remove an IView that had served its purpose, and that this method was missing from the IRegionManager interface, so I added this.
Refactor: I found that there were some cases where I wanted an AggregateEvent to signify that something had happened, but there was no event payload type necessary. I changed EventAggregator to allow this and created AggregateEvent, differentiated from AggregateEvent<T>. While doing this, I found another instance where I was wasting time with ConstructorInfo instead of just using Activator.
In the end, that's not much refactoring for a first attempt at using a framework for another project. I'm getting ready to possibly use this for more Silverlight projects at CarSpot which should further increase the quality and flexibility of the codebase.