For some time now I've been working on a project that I've not been able to talk about. Well today, I am finally able to let the cat out of the bag. One of the challenges we've been hearing about from customers is around patterns. We hear they are way too hard to grok, and to implement.
What customers want is for us to help them with guidance on how to implement those patterns in the real world. In the past we've done this through several means starting with guidance, and moving toward code. Time and time again when we have delivered pure "guidance" we hear that is not enough, we need more, we need code, we need tools! We've done specific tooling for things like Service Factory, CAB, and WCSF, but we still hear this is not enough. We want general pattern guidance.
Now this is just one segment of our audience, though a pretty big segment.
At the same time technology has been constantly evolving which opens up new ways to tackle different challenges. In this case today, we believe we reached the point to solve what I'll deem "The pattern problem"
So this is were the Patterns Factory comes in. So what is it? The Patterns factory is planned to be an interactive tooling experience in Visual Studio that will generate artifacts that implement patterns. Want a factory, point the tool at an existing class and you can generate a factory that will create that class. Point at an interface and it will generate a factory for creating classes that implement that interface. Check the dynamic factory check box, and you get a factory that loads from config. You can even select your specific factory to be DI Enabled, and supply the type of container for it to use. OOTB we'll support Unity (of course), Structure Map, Windsor, and NHibernate. We're planning for even more containers to be supported. I know your probably worrying at this point about all the oodles of codegen. Yes, there will be alot of code, but we're using partial classes and partial methods so that you can regen at any time.
OK, so that tells you what you can do with factories. But that's not where it ends, we've actually built up a library of all GOF patterns that you can generate artifacts. That means you can create implementations of flyweight, visitor, state, and any other patterns you can think of. Yes we've also added MVP, MVC, and Presentation Model support. There's an extensible XML repository where you can define your own patterns and their associated artifacts. I am planning a 10 part series to explain how you configure the repository, it's pretty easy once you know all the rules.
With all this talk about patterns, you may be thinking about the tooling aspect, i.e. what is the designer experience in Visual Studio? Well thanks to the work Don Smith and the service factory team have done, that answer has been provided for us. I am happy to say that the Patterns Factory, will leverage DSL designers both for defining the pattern repository, and for generating the patterns. Using the designers, you can model all the aspects of the system and what patterns are in play. You can save the pattern schema to allow you to create new apps leveraging all the same patterns. We also have Pattern detail collection screens. These screens use the DSL powertoy to allow you to collect specific information on each pattern similar to what i mentioned earlier. For example if I create a new State pattern instance, then I get a set of screens where i can define the list of states. They Flyweight screen is really cool which allows me to key in all my Flyweight instances statically if I want to, you can also link it up to a database through the Entity Framework and allow it to pull all the Flyweight instance metadata directly in.
The other nice part in all of this is that it's completely extensible. It's all XML anyway 🙂 Allright, so you can hear the enthusiasm on my part about this new work. I've not been able to talk about it before, because I didn't know if it would actually get off the ground. It's been my personal project that I've been writing on the side. Fortunately for all our execs in p&p this was a no-brainer.
Within p&p we're really excited about the new Patterns factory. We think with the factory, you'll be dragging and dropping your way to a scaleable enterprise architecture. And because it's April fools the factory is available today for download at http://www.codeplex.com/aprilfools.
More to come on this in the future.