Welcome to MSDN Blogs Sign in | Join | Help

Apologies', I've been somewhat away from the blogsphere for some time, and been meaning to get back into it. Something like 'writer's block' has prevented that, so I am hoping to will that away presently. This first one 'back' has been very hard to frame, since there has been much to talk about. (I have the willingness, just not the capacity to capture it all).

In the last few months there have been several things to be made sense of in this space. It's been a period of time where we have had to broaden the view of where we are going with factories and how exactly we are going to get there. Factories has captured many differing points of views in the industry, some are in support or empathetic from similar initiatives, and some are criticism from the confusion and overloading of the term factories have stirred up recently. However almost all looked poised to see what becomes of it from Microsoft.

What's New?

The most significant event recently from a Microsoft perspective, is that Jack Greenfield has now moved out of the darkness of the product unit and into the light of the Architecture Strategy Group. Now more visible and more closely connected with our customers, the plan is to formalize and publish software factories methodology in a way that makes them more accessible to the general development marketplace, so our customers can standardize on the methodology process and practices. Jack outlines that charter in the inaugural post of the new team blog 'Software Factories 2.0'

The other big news here is that we have just created a new team blog for the Software Factories Initiative, where the team will be posting information and materials about the initiative as we move forward.

We are also undergoing at Microsoft what many large companies struggle to do themselves with internal factory adoption by the business. By no means an easy feat as you can imagine with ever tighter budgets, and the paradigm change that factories call for. Fortunately though, like many large product companies, most of the businesses internally are seeking ways of improving product adoption and improving productivity with our products and solutions. So at the very least, the various businesses recognize the need for a paradigm shift towards reuse, modeling and automation. But getting the message through about factories has been tough. Hey it's Microsoft!

We are also starting to see some very significant investments in software factories methodology and process by our customers. Several leaders in various software markets are recognizing shrinking marketplaces for their hand crafted products using current manual methods. With so much knowledge and expertise in their respective business domains, it seems that for the market leaders the pain of the software crisis is too acute nowadays to ignore anymore. And for those creating repeated solutions, they are turning to software factories methodology to provide a warranted competitive advantage for them.

Where are we at today?

Time for some retrospection. The latest release of the WSSF Modeling Edition (a few months back) initially exploded. Downloads of it are now well over 40,000 or so, as reported by a few in the team. It seems to be the de facto software factory and domain example everyone refers to when evangelizing, demonstrating customization of existing factories. Being p&p's first and flagship factory, WSSF addresses probably the easiest, most topical domain today that illustrates the value of factories for a common technology domain. With the boom of SOA and the S+S (software plus services) strategy emerging from the company, ironically the success of the WSSF has quite rightly been somewhat overshadowed by new business opportunities for services, and as such it is on the verge of being taken for granted as the de-facto designer tool for implementing services in this space. Which is huge news for all of us, and testament to its value and ability to lower the bar significantly for those quickly building compliant/secure web services to the point its ubiquitous for building services. This has been a good initial start for demonstrating at least one of the values of factories.

Nonetheless, the current generation of Microsoft software factories (from p&p), like it or not, have not been really compelling enough yet to drive factory building adoption as fast as many of us would have liked to see. The end-game we've been moving towards has always been to build and use factories that target more specific (vertical) application domains, but beyond the few horizontal technology factories we can point to today, what is there to compel an organization to adopt factory methodology and tools and start building these vertical factories themselves?

The development savvy practitioners among you would probably say "...give us the Tools, product Support, Process and Methodology!". Which is kind of cart before the horse in this case, but clearly we first need a well defined methodology to adopt, followed up by industry acceptance, and then supported by a toolset integrated with the current development processes and tools. But as developers consuming this stuff, it means very little to our day-to-day lives until we have reached the point where we can build and consume factories in our supported development environments as part of our agile processes. What we really need to see for broad developer adoption is: File -> New -> Software Factory, and have our tools supporting a standardized factories methodology.

As Microsoft (outward facing), at present, we don't seem to have much else right now to point to (apart from the four p&p factories) to compel our customers towards this goal, that demonstrate better capabilities and more compelling value of factories automation beyond DSL's, GAX Recipes and basic IDE extensibility.

And I have to say that is, and has been for a long time, very frustrating. Particularly for those customers following this closely who do see the larger potential of factories. Yet for them, they still have the tough organizational issues of conveying that to their businesses by proving viable return on investment, without being able to demonstrate most of that potential value up-front. What software business easily swallows the development investment pill: "It's going to cost us more time and money to build this factory, and then we expect to sell its products much later but much cheaper"?

There's more compelling capabilities than what we see in factories today. For starters, a factory schema to relate product architecture to separate views or aspects (with accompanying configurations of tools in the IDE). A meta- model of the product architecture you can work with in multiple views. Guidance automation that for each part of the architecture tells you what to do to complete it. What tasks you can and can't do right now and why, and what you have done, where tasks are linked to the right tools to perform the actions the guidance prescribes. Support for team development, so that multiple developers can use the same factory at the same time and build the product collaboratively, whilst metrics can be reported on the progress of the product using the factory.

So, even with what we have today, why is the value we see in factories today, whilst a great step forward, still not quite enough to tip organizations over to wide adoption of software factories as a business strategy moving forward?

I'd say the reason is because they (the businesses) haven't witnessed enough success with factories that are relevant to their businesses yet. What do I mean by this?

Verticalization is where it is at!

If you look at the organizations that have embraced software factories based upon the factories released by p&p.

[I am referring to the ones who take the factories and build products for their customers or internal projects. Not the ones who use it on a single one-off project and move on].

Then you will see that in almost all cases, they'll want to modify the factory in some way and tweak it to build multiple solutions that are slightly different in some but unique way for their business, but similar for each of their customers. In short, they want to customize the factory towards a slightly narrower (vertical) domain than the broad horizontal domains the factories were built for. Called 'Verticalization' of a factory, you would do this in the cases where you want to deliver solutions for a more specific business need than the one addressed by an existing factory.

Say for example, you wanted to build financial web services for your customers. You would customize the WSSF to abstract the details of the standardized data contracts, operations and security profiles prescribed in the financial data exchange world. Build higher level models that simplify the selection and configuration of those standardized choices. You would have a very specific factory for that vertical domain.

The other option you have is of course is just to build your own factory (models and processes and automation) and perhaps borrow the reusable assets (e.g. libraries, frameworks, code templates etc) from existing horizontal domain factories combined and composed into yours. In either case though, the bar to doing this with the current factories technologies, uncertain processes and rudimentary authoring tools is too high for most organizations to invest it. Indeed there are some that try and some that do succeed here. However, I am certain that these wins are not visible to most of the potential factory building market at present.

The fact that building factories to vertical domains is very hard technically today, and perceived to be 'expensive' to a business right now is what is holding broad adoption back. But you can't have more benefit and value for less money.

If we can make building your own vertical factory easier to do technically, with the development processes you use today, then its pretty hard for a business to ignore the revenue opportunity of selling the products created from them at a fraction of the cost of hand crafting them today. And furthermore ignoring the new business opportunities that would arise from this new delivery capability.

But where do you see examples of this today that would give you the confidence to adopt this approach? I'd say you don't for a couple of good reasons right now:

  • It's hard to deliver this capability (to my earlier point about technical difficulty, paradigm change etc.).
  • It's even harder to convince your organization to invest in factories as a a strategy, because it requires profound appreciation of the looming software crisis, understanding of the gains to be made with this methodology, and a firm financial and cultural commitment to make a change in development paradigm.
  • An organization that has adopted this approach, and executed it successfully, is not going to advertise it to their competitors.

...there is a reason why its a business strategy.

So clearly at this stage in the game of adoption we (Microsoft) need to enable customizing and building factories to be much easier. So more people can do it, and demonstrate more wins publicly. We need to explain and demonstrate how organizations can take actionable steps towards adopting this as a strategy. And to the last point raised by competitive advantage, probably in these early stages won't change much until the factories approach is adopted across all major players in specific solution marketplaces. Only then might the competitors in that marketplace come out and say, "its no big secret, everyone in this space is doing it using factories anyway now, so what else's new?"

A Methodology, Processes and Tools

The Microsoft Software Factories Initiative recognizes these challenges, and we are on point to deliver these capabilities. First we are planning to deliver a methodology and specification for defining and executing software factories processes. That should enable other market leaders to adopt the approach and build their factories. We are also working with a few early adopting customers and community to implement that strategy.

Once the methodology is more broadly adopted and accepted, I could see us Microsoft (and the development communities) producing the development tools and environments to the spec to author factories, and have the necessary runtimes for them to execute in. I can't say we have all those pieces completely figured out yet, considering that no doubt as we go along other new techniques and applications of factories will evolve.

So what will the factories look like that come from that initiative? How will they differ from what we see today? We touched on that above, but the answer is: dramatically different.

I promised to post a bit more now, so I am leaving that discussion for the next post.

I am a bit tardy on the blogs about this, but if you haven't heard yet - we recently opened a new site dedicated to building and sharing a community of knowledge around Software Factories.

http://sf.devrevolution.com/

Huge thanks to Martin Danner who has hosted the site for us, and Edward Bakker who has championed the creation of the community. For some time we have aimed to provide a central place online we, as a community, can collect, discuss, rank, comment and order content about factories and Visual Studio Extensibility as this methodology gains momentum.

There is a mother site to this one (DevRevolution) which aims to address other industry topics such as Agile Development and Application Lifecycle Management as revolutions to the software development industry. However we are starting of humbly primarily focusing our attention on software factories at present. [Which just quietly, I see as an evolution not necessarily a full revolution to how we build some types of software - anyhow]

There are many sites and resources on the web about and around software factories from many of the great folks who have pioneered this space before, and heaps of information about its fundamental technologies and practices (i.e. domain modeling, automation, generative programming etc.) so we wanted to provide a central place to bring this knowledge together and have you guys - the community - view it all in one place. The idea is to then have the community collate, rate, comment and sort the content so that anyone visiting the site can find the most relevant content to consume based upon there understanding of this space. Clearly, no one wants to trawl hundreds of disparate links to sources of info to mine and find the best or the highest quality information on this topic. So having the community rank, comment and direct the visitors to the best content is an important attribute. So this is our primary goal - to enable that. We also want a place for people to come to and feel part of a larger industry group of like minded folks practicing this methodology developing its tools and practices.

We are currently a little centered on Visual Studio Extensibility as the platform for software factories at present simply because Microsoft is leading the Software Factories initiative at present, but we would like to think that the concepts and practices are not necessarily exclusive to Microsoft technologies, and would like to support ideas from other platforms and technologies in the industry.

Of course we realize that much of the relevant content out there for consumption is addressable only in the heads of many of the people involved in and around the factories initiative. We have linked some resources (as you can see), but we are relying on you to add whatever resources you are aware of.

image

We are focusing on refining the site and providing improved means (over what you see there now) to provide a better user experience and means to better add, rank, comment and sort the content best. Basically we are aiming to have each piece of content referenced on the site to support attributes, comments, ratings and categorization.

Currently the modules we have are a step in that direction, some parts allow this capability, others don't. So we have much work to do to reach that goal. It's a little ambitious for us, but we recognize that others are reaching out for such as resource.

However, we still need more content and feedback to help drive that.

Please have a look and let us know if you think this is useful, what is missing and how it should work to be the tool this evolving community will treasure.

[If you visit the site, and don't submit any content or offer any honest constructive feedback, then I hope you leave feeling guilty that you have not really participated in bettering the community as a whole - we especially need and value your comments and feedback.]

Some links:

Geez, if you haven't heard next week is the patterns & practices Summit in Redmond, Washington.

The agenda is packed with all good things factories, agile, frameworks, architecture etc. from some of the best in the industry.

Session Agenda

It's a little late news, its not been well advertised, but the day not to miss for us is Thursday  - all about factories.

See you there...

(And if you missed it here, I hope you can catch it again another time. Next one is in Quebec City, Canada in May 2008)

We are happy to announce our latest white papers on Software Factory implementation. There is a small mini-series on the MSDN Architecture Center called "Packaging & Building Software Factories". There are two parts to the series:

  • Part 1 - Packaging with Visual Studio 2005
    • Discusses how to package the various software factory project types (VSX, GAT and DSL) into a single combined MSI installer, that can be used to deploy a whole software factory solution, (either using a standard VS setup project or WIX Setup projects)
  • Part 2 - Automated Builds with Team Foundation Server
    • Discusses how to implement TFS Team Builds that build software factory project types (VSX, GAT and DSL) solutions in team build scenarios.

If you are building factory solutions today with Visual Studio 2005 and are blocked with packaging and/or with team build scenarios with Team Foundation Server, we hope these papers provide the details to help you develop and deliver your solutions.

Both these papers are accompanied with sample reference implementations to get started with. Just download the code, and modify.

We also support the second part of the series with a CodePlex project (codeplex.com/SFTeamBuild) for adding new MSBUILD tasks and check-in policies for factory project build automation.

I want to say a very special thanks to my coauthors Edward Bakker and Rene Schrieken at LogicaCMG in the Netherlands, and especially to Mark Nichols, and David Scruggs of Microsoft Consulting Services for their invaluable contributions, and also to Attila Hajdrik, Gareth Jones and Pablo Galliano for their valuable feedback and input to the papers.

MSDN has (finally) published the first part of our series on "Building Software Factories" on MSDN.

Just a little worried that some of this content is now a little out of date considering we wrote it more than 6 months ago based upon our blog series Building Software Factories - Factories 201. However, the up coming parts of the series will be more up to date with recent experiences and perspectives evolving as the products and processes from Microsoft are.

This is just the first part of the 3 part "Building Software Factories" series, which goes:

  1. What are we building and why?
    • Describes what a factory is in concrete terms, what it means and takes to build a factory and why we want to do that
  2. What's going to take?
    • Tackles the critical issues of getting your organization’s management bought into a software factories approach, and what your organization needs to do to support the development of factories to give it a good chance to succeed.
  3. How are we going to do that?
    • Addresses directly how to build software factories on the existing Microsoft platform, which tools, processes and practices to use to develop and release your factories, and how to get started.

Stay tuned for the later parts in this series.

We also have another series on factories coming soon called 'Packaging and Building Software Factories" which tackles creating installers and team builds using Team Foundation Server. We will announce these articles when published soon separately.

For those big into Software Factories in Europe - it is TechEd Developers in Barcelona again! (November 7th)

There are a few sessions on factories, including ours "ARC 301 - Build Your Own Software Factory"

Software factories are emerging automation and guidance tools that address many of the chronic problems in building software for our customers, partners, and industry today. This session explores the what, the why, and the how of building software factories, and shares the "real life" experiences of designing, implementing, and customizing factories available today. Receive guidance on the processes, patterns, and tools needed to build your own software factories that can succeed and survive on today's and tomorrow's evolving platforms.

This will be the same session Edward and I presented at TechEd US in Orlando in June, and TechEd Japan in Yokohama in August, however this one has a little twist to it - my good friend and colleague Don Smith is going to be your host!!

Don has kindly offered to deliver this talk in my absence, basically because I cant make it and he kindly stepped up. We have delivered this talk together so he knows the content (and to be fair he is a better speaker than I am - don't tell him I said that though). You'll love him.

Don is also delivering "TLA304-  Building Services with the Service Factory: Modeling Edition" (also on the 7th Nov) which for some of you will be a massive revelation and insight into the potential of software factories of the future.

Being an extremely useful tool for architects and developers, the next release of the Service Factory adds one of the most often requested features: a graphical tool for designing message contracts and service interfaces based on the Visual Studio SDK, DSL Toolkit and Guidance Automation Toolkit. There are clear advantages of using a modeling environment when building services. The development team has more flexibility when the modeling environment includes logical models that don’t force platform and language decisions too early in the project. When this environment has a great deal of extensibility, the capabilities are only limited by imagination. The Web Service Software Factory: Modeling Edition provides this type of modeling environment. Attend this demo-heavy session to see how the Service Factory can be used and extended by your service development team.

If you haven't seen the Service Factory (Modeling Edition) recently, you really need to, this will blow you away!!

Just a quick study note.

Now this could be my short post I have so desperately wanted to write for sometime!

It dawned on me today that we may be losing sight of the big picture here. I am picking that a great number of people are confused by all this DSL, GAT and Software Factory talk. What is the relationship here? How come we can't talk about factories without talking about DSL's and GAT? Which one is related to the other?

I've been trying to put this succinctly to those whom I discuss about this, so here goes the 20 second elevator pitch on what a factory is today with today's technologies, used for building today's solutions. (there are plenty of other scenarios, but this is the commonly conceived one). Remember this is a practical description (NOT definition!).

A factory is a collection of related DSL's (views) that describe the components of a product from different perspectives (view points). We use recipes (GAT) to automate the configuring of those DSL's or the artifacts that are created by them, or development of them as a whole. The generated product (using DSL's and GAT) is implemented in code that is generated to configure underlying frameworks and class libraries already targeted at this type of solution. The views are related by a logical product architecture, inferred or explicitly represented in artifacts (could be solution items such as source code or configuration files).

In all this work we've been doing, bringing people up to speed with how to build factories with and how they relate to what patterns & practices are releasing, it easy to lose sight of what we are actually doing here.

I have to say this. If you understand the difference between problem domain and solution domain in software design, you will know that factories are all about the solution domain. We are so far away from modeling problem domain and turning it into software just yet - forget it for now. It has proven impractical at this time, it is too big a step at this point, we need to evolve to that later.

If you wonder what your DSL's should model in the context of software factories, then always "model existing solution domain components". In other words, model a solution (or part of solution) that already exists or one you derived from what already exists from multiple instances of that solution that someone built before. A framework is the greatest starting point. Take your framework and model it. Build your DSL's to expose its variable parts (basically its API's and their parameters). Your DSL's will generate 'configuration code' that runs on that framework. You can try to relate these DSL's through various cross-references or naming. Either way, you will want to tie them into some overall product architecture somehow. How you do that is up to you. Innovate! We did this in the EFx Factory by creating a mapping layer from DSL to generated artifacts (source files). Basically a logical to physical architecture mapping. You can do it however it makes sense for your factory. Just make sure you base it upon existing solution domain concepts.

There, I did it, a short post.

I have been meaning to write this post about software factory verticalization for some time now. I actually started this post at the start of the year, but we've been busy writing a number of MSDN white papers recently which have gotten in the way, which in retrospect has been good because some enlightenment has come my way about this since then.

The title of this post would not mean anything if you didn't know what 'horizontal' and 'vertical' software factories were. In that case then for simplification, ‘Factory Verticalization’ merely means ‘Factory Specialization’. Ironically enough though, most of the factories being build today are ‘Horizontal Factories’, so specialization in these cases means ‘Factory Verticalization’.

In almost all my interactions with customers about factories I am constantly reminded that ‘verticalization’ is the one key principal aspects of software factories today which is largely going unaddressed (and poorly understood). I am convinced that there is a clear and immediate requirement that we need to deal with more effectively in the present. I go so far to say that without catering for Verticalization of any factory, would seriously limit the adoption of factories in the future. It is such an important aspect to provide for if we are to realize the full vision of product lines and asset reuse.

What are these axes?

Before I get into this lengthy discussion about different aspects of verticalization, I think I need to explain what we mean by 'Horizontal' and 'Vertical' software factories in order to set the right context for the discussion.

In software factories we use these terms (vertical and horizontal) in the respect as they use them to describe markets. In software development these terms are generally well understood to differentiate broad skill-sets (or more general capabilities) typically focused at particular technologies and platforms, from the skill-sets/capabilities applied to specific industry domains (e.g. finance, manufacturing, retail, etc). The intersection of these axes in software engineering, in theory at least, applies the expert technical solution people to build instances of solutions for particular vertical domains, under the guidance and knowledge provided by the industry domain experts. The assumption is that the horizontal assets (people and artifacts) can be reused (with some specialization) across many vertical domains - it’s really a synergy of the two axes.

If you think about it more deeply, when applied, vertical domains provides a specific abstraction of the solution that can then be mapped down to multiple horizontal domains. Which is starting to sound a little like what part of the vision of MDA was attempting to do, but we are not going into MDA versus Software Factories in this discussion (you can use your own blog for arguing that issue!).

Specialization/Customization

In order for a horizontal software factory itself to be reusable in multiple vertical domains (which is where it is ultimately destined for) there has to be some level of customization that allows it to be specialized towards any particular vertical domain. If we don’t allow this, then we simply can’t adapt a factory to create specific enough product lines, which means we are limited to the productivity we can achieve with it as a reusable asset. That’s not to say we can’t. We can do the product lines, but the overhead of doing so is much larger than it needs to be, because some things in the particular domain will either be common, or specific across the whole product line for that domain. Remember, the power of factories is in how specific they can be.

A practical example:

Take a web service software factory (you can take the new version of the Web Service Software Factory (Modeling Edition) from the patterns & practices team as an example). One point of variability of the product this factory creates (a web service) would have to be the data contracts (Service Operations use Data Contracts to define the schema of the messages the operations exchange). The assumption the web service factory builder made (accommodated for) when he designed the factory was that each instance of a data contract created by the factory could be wildly different between instances of the web service solutions the factory builds (hence the point of variability). Therefore the factory provides a ‘view’ (as we call it) to expose the data contracts and allows the developers using the factory to configure them (might be using a DSL or XML file for example). Now, let’s use this factory to create a real web service.

The Modeling Edition of the Web Service Software Factory predictably uses multiple DSL’s to define data contracts and service operations.

A service operation in a financial web service would certainly have a different data contract than a service operation for a retail (shopping) web service (in fact both the service contract and the data contract are variable). The factory correctly defines data contracts as variable and as such provides views (abstractions) that allow you configure them different for these vastly different domains.

Now, suppose your company (assuming you want to use this factory to create web services for your customers) only builds financial web services for your banking customers. You are experienced experts in this industry domain, and you know what finance customers want in the financial web service solutions. Finance web services would be limited to certain functionality, and compliance and industry standards, and as such the industry has defined certain specific data standards for the data contracts and service operations you should use in your financial web services. Suddenly, pieces of a web service are very predictable (not variable and common), and you wouldn’t want to invest time and money into configuring them with the factory to the same known value every time you go to create a finance solution with the factory. What you would want to do is tell the factory that this variable piece can be predetermined for certain types of financial web services. And you wouldn’t want those using the factory to bother with those parts. Furthermore, some parts for this domain, may have special names. For example, messages in this domain are known as ‘advice’.

So you are likely to want to do is customize the basic (horizontal) web service factory in two main different ways, and create your own very specific financial (vertical) web service factory that creates only financial web services the way you like them. Specialization through Customization.

Firstly, you might want to predefine parts of the solution the factory is building, without having your developers wasting their time configuring them. You may also want to rename the parts of architecture used in factory so that finance domain experts understand the moving parts better. Let’s call this type of specialization, the ability to fix certain variability points to fixed values.

Secondly, there may be modifications to the how the factory creates its web service solution for your particular finance domain, for your particular organization. Perhaps the code templates need tweaking or modifying, or need to use some of your organizations binary assets (i.e. frameworks for example). You might need to add other aspects to the architecture of the web service that are specific to finance web services, and have these new aspects exposed by the factory. Let’s call this type of specialization, the ability to extend certain variability points.

To do both these types of things, you would want to customize the (horizontal) web service factory and create your own vertical factory variant specific to your financial domain.

In the cases where you want to fix some point of variability, you want to achieve higher productivity in using the factory, and tailor its naming to suit those who understand this domain better. In the cases you want to extend some point of variability, you want to achieve flexibility, extensibility and reuse. In practice you want the ability to alter the base (horizontal) factory and thus create your own vertical factory.

(see later for practical means to do this today)

You might be surprised to know how many people desire this specialization capability. And then you might be more surprised just how hard it is to customize a software factory to be able to achieve this today, based upon current technology. I am confident there is a good amount of evidence at Microsoft patterns & practices to support this view, from customers trying to use their factories.

Let's assume then, that any instance of a software factory used in real development will have a vertical factory component and a horizontal factory component – whether intentional or not. The final resulting factory will be a synergy of both these axes. We are going to expand further a little more on horizontal and vertical factories in the next sections, but I first wanted to introduce the parties who play this factory building game.

In practice, there are several parties involved in building factories since they consist of both vertical and horizontal factory assets. Since once we get into this, things get interesting as far as who does what. Consider the parties involved in the software factory development lifecycle (building, using, consuming etc), as follows:

  • Those that own the factory, and develop/maintain it – we will call these the engineers (i.e something a software vendor would do)
  • Those that use the factory to create products – we will call these the developers (i.e something a solution integrator would do)
  • Those that consume the products – we will call these the customers (i.e. something a business or end-customer would do)

Clearly we have other parties involved here too, such as:

  • Those that define the requirements for a factory – these are typically the customers, and developers.
  • Those that own the assets of the factory itself – these are typically the engineers.
  • Those that own the assets of the factory-made products – these may be the engineers, the developers or the customers.

Horizontal Factories

Let’s just have a deeper look at what horizontal factories are, where they come from, why they are popular now and what they mean in the bigger picture.

Horizontal factories usually provide particular patterns, architecture or technology implementation. This would help explain why most of the factories we see today are horizontal factories.

Primarily, from a technology perspective, patterns, and architecture (models) are highly reusable for whole classes of solutions. Those who want to provide guidance on correct architecture, patterns and technology use would provide these initially. Which would explain why Microsoft has tackled these first.

From a marketing perspective, if you can call it that (which is really isn’t), one of the primary reasons Microsoft currently releases only horizontal factories is that: at present, software factories are a new concept to the industry, and Microsoft is leading the charge here. It makes perfect sense that the first factories from Microsoft must have some large significance and impact and benefit to the existing marketplace. So they chose horizontal factories to tackle first. I am not saying this was ever consciously intentional by Microsoft patterns & practices, but it just makes sense that that more people who can gain value from these new ‘things’, the larger the impact and better the chance of success of them (via feedback channels) since this was new ground to cover. By the way, patterns & practices goes after solving significant real world enterprise problems, so picking the horizontal domains of the software factories that they did covers a large proportion of the application types being built today in the enterprise, and the source of a great deal of pain for most enterprise developers.

If you think about it, if they had instead chosen to implement only specific vertical factories, say they did a ‘financial payments web services’ instead. How limited would that impact be with general enterprise development? Not really applicable to most enterprises, all that guidance goes to waste away from the general enterprise development populace. These would only solve problems for niche markets, and would make it much harder to leverage reusable infrastructure and assets for other similar verticals. Not much feedback could be collected from that and this would slow the progress of software factory development.

Reuse

Now, whilst it is feasible to create vertical factories initially without creating horizontal factories first (i.e. very highly specific factories), (a) you still have the same set of horizontal technology problems to solve (albeit at a different level of abstraction), and (b) you won’t have much to reuse of your factory in other similar domains. Reuse is a key goal in the game of factories, and by the nature of the domain specific beast it is by design that specialized domains (assets and models) aren’t easily generalized. You will notice that as your assets become more specialized, reuse of them rapidly declines. (This is exactly way they are so powerful, because they are so specific).

Architecture, patterns and their models are highly reusable across multiple more specific domains.

Horizontal factories are (should be) characterized by being very customizable to be specialized towards any specific business domain (within the general domain they address). The value of them today is that they proffer reuse, and convey foundation patterns and reusable logical architecture.

Although many of the current generation of factories do provide mapping from domain model to physical solution, their most valuable assets are in fact the domain models, patterns and architectures they codify.

The new Web Service Software Factory (Modeling Edition) also provides very valuable infrastructure assets that ideally should be part of a general software factory platform (for all factories use), and this infrastructure is also highly reusable, but for the purposes of this discussion should be considered as part of the base infrastructure that all factories are built upon.

So how reusable is all this stuff? For the purposes of the discussion following, you can consider that are really two layers combined together in most horizontal software factories today.

The top layer of the factory cake is the domain models that describe the patterns and architecture of the solution domain. These types of assets describe the logical architecture of the product being built.

The second layer of this cake contains the mapping from logical architecture to physical solution domain. Since there is this mapping between logical and physical solution, this mapping may well vary depending on the underlying implementation created upon the architecture.

Now, I don’t want to set the expectation that this mapping can or should be platform independent (such that MDA promotes) since, platform independence is a much larger challenge than technology or implementation independence. And one that practical software factories in general avoid. Platform independence requires platform independent architectures, and effective specific software factories will define successful platform specific architectures. Remember, software factories are very solution domain specific. Platform independent models are likely to be too abstract to become practically useful for product line development.

The second layer is where you map the given architecture defined in the models to executable code (compiled or otherwise). This could be source code, configuration files or other solution artifacts in most cases. This mapping will very much depend on the solution based assets you use in the particular solution the factory builds (such as frameworks, class libraries etc), and will be typically composed of source code templates.

As an example, the web service factory could create web services that could be implemented on several different frameworks and class libraries. Perhaps my enterprise organization has already invested heavily in some framework or class libraries assets which support web service implementations and we need to reuse those assets because of corporate standards, IT investments and the like.

In defiance of current thinking, as we will see later, I assert that it is not always a valid assumption that the person creating the top layer of the cake will be able to control the orchestration of the physical assets used in the mapping of the second layer of the cake. Thus the second layer of the cake needs to be highly customizable, but yet remain specific to the architecture and platform used in the actual solution.

For many of the Microsoft factories you see today from patterns & practices, the basic assumption they make is that the horizontal factory defines the solution based assets as well. Which is fine, as long as that is possible and feasible in your particular enterprise to buy into, and eat, the whole cake as it were. In other words, that you are able to adopt lock-stock-and-barrel not only the architecture but the underlying technology solution based assets (i.e. code templates, libraries and frameworks and technologies used). However, as I discovered in some world markets this assumption does not always stand as far as IP ownership of these implementation assets goes, and those building the factory will not always be able to assume the solution assets. Some customers just can’t adopt and deploy the latest and greatest either.

We will come back to this last point a little later in the challenges discussed in the next sections.

Vertical Factories

As described before, vertical factories are the specialization pieces, and should almost always be the end-developer factories used to build a solution instance. Again, this is not to be taken to say that you can’t actually use a horizontal factory as is – you can. But it is very likely in most cases you will want to refine these horizontal factories for you particular organizations solutions. A horizontal factory can be viewed in this respect as an unrefined factory. (Sounds harsh, but you get my drift)

Vertical factories will not in all cases be built upon horizontal factories, but regardless, will more than likely always contain horizontal assets (remember that a factory is also an asset). These horizontal assets will be harvested from the patterns and architectures and implementation layers from existing solutions that the factory also prescribes in its products.

Personally, my opinion alone, I believe the future of factories will provide design principals and practical means to compose multiple horizontal factories together and define the specialization of them contained within the vertical factory (entity of some kind) that actually builds the solution. I guess time will tell if and how that materializes.

To expand our factory cake picture from earlier, it will be the vertical factory that provides the specificity of the top 2 layers of the cake; both the logical architecture and the implementation mapping. In other words, the vertical factory will contain the specific stuff to the particular instances of the products being built, and that specific stuff could be customizations to both the top layers of the cake (provided by most art by the horizontal factory).

In extreme cases, the vertical factory may provide the entire second layer of the cake, and the horizontal factory may only define the top logical layer.

Vertical Challenges

So let’s have a look at some of the practical challenges raised by practical implementation of vertical factories, and how the above model of a factory can be used to aid in the solutions to these problems.

Who owns the factory?

Today, we often think of a very simple ownership/use/consume model when it comes to factory authoring, factory use, and the consumption of factory built products.

We tend to think that one party (the vendor for example) will create the factory and another party (the solution provider) will use the factory to create products for another party (the end-customer). We gave these parties names at the start, and will use them here for clarity. We will say that the engineers create the factory, and the developers use the factory to create products for the end-customers.

For a practical example today using a classic outsourcing model, Microsoft patterns & practices (vendor engineers) create the (horizontal) software factory and ACME Consulting (solution integrator developers) use the factory to create products for their enterprise customers (end-customers).

We have discussed the extension this model in this article to include the development of a vertical factory (which contains the customizations to the horizontal factory). In this case our simple model changes a little since it will be the solution integrator (engineers) who aggregate the horizontal factories and create/compose a vertical factory to be used by their developers, since they understand the various vertical markets they have end-customers for.

When dealing with IP ownership of the assets involved in factory building it is often assumed that the party building the horizontal factory are the same party defining the logical architecture and the mapping to physical assets of the products the factory builds (i.e. the vendor engineers). We also assume that this party is the same party that actually owns and defines the product assets (i.e. class libraries, frameworks etc.). As we will show, in some markets and situations this cannot always be the case.

In our modified model now, assuming the creation of a vertical factory, the party that creates the physical assets could be either the author of the horizontal factory (vendor engineers) or the author of the vertical factory (solution integrator engineers). In reality it will be a mix of both in most cases. So, this implies that the engineers of the solution integrators will provide customizations in the vertical factory to be used by the developers in their organizations. So far so good?

So now, what happens in the cases where the end-customers have existing solution assets they need re-used in their products that the solution integrators are building for them, because of corporate policies or existing technology investments? Furthermore, what happens when these solution assets are protected by intellectual property (IP) constraints? For example, in cases where the solution integrators don’t have unlimited access to these end-customer protected assets?

I recently visited one such global market in Japan where that was the case, and I see there are other such cases, for example in government classified projects.

Then who owns, develops and maintains each piece of the factory puzzle?

If you are paying attention you might say “no factory deal! – go build a one-off solution!”. Since, we are basically saying that the solution integrator needs to build a custom vertical factory specific to this particular customer’s specific solution domain needs, which can’t achieve economies of scale or scope for them. A factory solution cannot help here, unless the end-customer will require multiple product instances to be created for them. However, if they do require multiple instances to be created for them, then the extra investment could be worth it to the customer. But because of IP issues again, it would appear then that it could only be the end-customer who could build the entire factory stack because only they can see the whole picture and have access to all the necessary pieces?

But then this does not hold true in reality, since the end-customer is unlikely to have the technology resources to build and maintain a factory. So it would appear that the solution integrator, with the end customer, under a special IP agreement would need to create an end-customer specific vertical factory tailored to creating products specifically to that end-customer.

Using the modified model described earlier, this division of labor (between solution integrator and customer) becomes feasible when you can separate the logical architecture from the physical mapping, and this is the basis for enhanced model (cake layers) of a horizontal factory - due to the separation of concerns.

How do you verticalize today?

Verticalizing a factory today can seem impossible given the tool-sets we have at our disposal.

For most customizations of today’s factories you need to ‘crack open’ the factory and mess about with the source code internals of the recipes, DSL’s and the like. This is not a guided experience, and requires very deep technical knowledge of the factory, and deep technical VS extensibility skills. Not an easy ramp-up for those new to factories.

Extending a factory today is a function of what external interfaces the factory may expose today (if any at all!). For example the patterns & practices Web Service Software Factory does a good job of providing a number of extensibility points and interfaces, both via a programming model and configuration. But anything beyond what it supports at the programming API level, and you'll have to crack it wide open, effectively voiding the warranty and support policy of the factory. It’s wild-west country from there onwards.

Ideally, what we need is firstly a structured authoring environment to build factories to have a well defined structure, with tools that create standard factory asset types (recipes, DSL’s, templates and the like). These tools would be an abstraction levels above the DSL’s and GAT recipes we build today. Basically they define a meta-model (architecture) of your factory product that can generate the required assets such as recipes and DSL’s and the like. This is basically a part of the software factory schema, transformed into the factory template, that has been quite difficult to support with today’s tooling and technology.

Once we have that though, for verticalization purposes alone, we would need a way of formally declaring the points of variability of the product architecture of a base (horizontal) factory. These declared points of variability could then be provided with default values/views/assets by the base factory. Or the factory may declare them ‘abstract’ requiring vertical factories to be built to subclass them and extend these points through customization interfaces.

We would then need a ‘customization authoring tool’ that we use to load the base factory into, and extend these pre-defined customization points with standard tools, that creates for us a set of customized assets output into a vertical factory in some form.

In this way we would not have to crack open a software factory any alter recipes or DSL’s just to predefine say, the data contracts of a web service product. Instead we can provide a simple subclass that hooks into a predefined point of variability customization interface and either provide fixed factory configuration, or extend the architecture of the product.

However, I feel this customization capability may be too far out for us right now. Instead we need to look at practical means today to achieve the same net effect (albeit a less guided experience).

Practical Verticalization Today

In absence of authoring tools that allow us systematic guided and structured customizations of existing factories and their assets, we still need to find ways of achieving verticalization with known techniques and tools today.

When you consider what verticalization really means you’ll understand that specialization can imply both simplification of, and extensions to, base models.

One practical means to achieve this is through model transformation.

Few people have entertained the possibility that DSL instances can render other DSL instances. Since you can transform models to create other textual artifacts, and a DSL is by default persisted simply as XML, it is entirely feasible to have one model instance generate another model instance. In the terms being discussed here, it is feasible to have instances of vertical models transformed into instances of horizontal models.

For the case where the vertical factory fixes points of variability of a horizontal factory (such as fixing the data contract of our web service), the vertical factory can provide simplified models defined in the horizontal factory. Once configured, these vertical models could then use built-in transformation rules (containing the fixed configuration) to generate the pre-configured horizontal factory models.

By the same means, your vertical models can extend the base horizontal models and expose new aspects of the architecture for your particular vertical domain. These vertical models can again then either be transformed into pre-configured horizontal models, or can be transformed directly into other solution artifacts.

Basically the vertical models contain metadata that is used to render the horizontal models, and developers using the factory would only need to configure these vertical meta-models.

It's not actually that simple in practice, you still need to manage synchronization between higher level (vertical) models and lower level (horizontal) models, which is not that trivial. And you have to somehow enforce a policy of not editing lower level models.

Your vertical factory could also contain modified mapping assets such as modified artifact templates and solution based assets if that type of customization is required.

As a follow-on example, our financial payments web service (vertical) factory could simply be an enhancement to the original (horizontal) web service factory, just simply adding additional DSL’s, and modified artifact templates.

These additional DSL’s would define domain models that were a simplification of a general web service architecture. Perhaps devoid of specific data contracts and service operations. Perhaps only offering the user basic configuration settings (metadata) such as web service name and ‘payment advice’ message names for example. In addition, it may, for example, define additional configuration a special security authentication model that only banks use over and above the standard ones the general web service factory supports.

Again all this can be configured within this new vertical model (a simplification and extension to the base models provided by the horizontal factory). When this vertical model is saved, it could for example, automatically generate the solution artifacts for the data contracts and service operations, (whether they are defined in DSL’s or other solution artifacts). These artifacts could be hidden from the user by some means (perhaps hidden solution folders in Visual Studio) and the developer prevented from editing them (perhaps source control locks and the like).

In these ways a solution integrator can take an existing horizontal factory (created by a technology vender), and customize it easily by adding new DSL artifacts to it to expose only the required extensibility points pertinent to the particular vertical domain. Then hand it off to their developers to use only the vertical abstractions to create the specific solutions.

In this way, they very quickly increase the productivity of the factory developers at the minimal amount of customization development and cost, without having to crack open the horizontal factory and understand all the internal workings of it.

Of course there well maybe other types of customizations that cannot be easily achieved without cracking open the factory and modifying it. For example, modifying some recipes.

I would love to continue the discussion, and hear some of your thoughts on practical verticalization techniques.

Clearly this was never going to be the short post I am striving to write one day - bummer, maybe next time...

Just a recent observation. Agile vs. Formal processes in the context of factories - any confusion there?

It's pretty much a given these days in software engineering we accept that we have been misled over the last couple of decades into believing that software development should follow a manufacturing process (see from your own experience the evidence in past failed development projects). Manufacturing implies 'assembly' of predictable software solutions from well designed plans. (I am sure there are more formal definitions you can insert here). For new software development projects this approach obviously fails in practice because its not so easy to plan what you don't know about what will change in the near term future, and new developments require ample amounts of discovery, learning, design, research and prototyping - all of which you are suppose to squeeze-in for free, without impact, within fixed time and resource budgets of formal processes.

Formal processes work only in practice for a small number of organisations where the outcomes of the project are highly predictable at the start, the inputs tightly controlled and the resources highly tuned and available. You can find these in very few established software businesses where the products they build don't afford large unknown variance in scope/technology etc., and can actually be predicted pretty well.

Because software development businesses need to minimize risk, meet customer expectations and a changing requirements etc., you simply can't get away with saying to your customers "it will be ready when its ready" - and herein lies the rub, because in order to have any level of predictability, you need solid planning.

Formal processes and practices were based upon the fundamental assumption of manufacturing, that you could predict how long and how much cost, and what resources any development project would take. Which is part of the reason why its taken years (and much failure) to realise the basic assumption was incorrect for the majority of new development projects today. I don't know about you but I felt robbed! What were they smoking?

We, as software engineers, all knew this smelled to be broken somewhere, but no-one really had a practical alternative to push back to meet business goals until we decided to face the music of failure and agile was allowed to emerge - sometimes out of desperation. The beauty of agile of course is that it simply pays respect to the way most of us were actually trying to develop new software within the constraints of formal processes in the first place, and that puts the natural, empirical progress foremost.

We now, as an industry, accept superior agile processes and practices deal far better to the reality of creative new software development projects (although many organisations are sadly still to make this realization). But is agile the right process to use in all cases?

Isn't the predictable assembly of products, like in manufacturing, exactly the mantra of Software Factories? On the outside, there appears to be a disparity here - or is there?

It appears that we are saying "use factories to create your solutions". Which sounds like factories are implying to take us a step backwards again to formal practices. Is it any wonder the message is being confused?

If you or someone else came to a similar conclusion, you/they are not listening close enough, and must be confusing the case when to use software factories, and when not to use software factories to build software.

You never build a software factory for building a one-off solution from scratch, where you don't already know the solution domain from past experience.

The clarity here is this:

We definitely should be moving software development (as much that is already known) to a manufactured process - which is what factories are all about helping to do, and what the industry needs to move forward. Yes, so, this also means that you should use formal processes, with the factories as part of the solution, to build software in the future! But when we say this we mean that the formal process should be built around the use of factories to assemble the solution.

We are not saying, use formal processes to build your new, one-off solutions. No, for those you should be using agile processes, simply because these solutions are likely to be unique to you and unknown to you at the start (i.e. requires: discovery, learning, design, research prototyping etc).

So, no factories in the solution -> no predictability to the development of the solution -> no formal process -> use agile process.

But, if factories in the solutions -> high predictability in the development of the solution  -> use formal process.

This will hold true only for the parts of the whole solution which the factories themselves create. For all other parts of the solution, i.e. the glue, that require discovery, learning, design, research etc, you should employ agile processes to manage that. (Which for most software factory created solutions should be the last 20-40% of the development considering the expectation that factories today can't create the entire solution, and that the solution will always require some level of manual customization).

Now, all this supports the fact that: you should be using agile processes to create your Software Factories themselves. Since you also won't know what they look like at the start and they also require much discovery, design, research and prototyping etc. You can treat a software factory building project as a one-off solution development project in this respect - since it will almost always be a one-off development project.

So, I find it kind of ironic, that whilst the industry, as a whole, is still moving us to agile development, software factories appear to be countering that by moving us back to formal development! Of course, you know better than to confuse the two different types of software development now - right?

In actual fact, if you understand this clearly now you will know that agile development (process) is used to help design and implement new, unknown solutions to meet changing requirements. Whereas, Software Factories (tool) are used to help manufacture existing solutions, each with similar requirements.

Edward and I have just finished delivering another TechEd, in Japan this time, on 'Building Your Own Software Factory'.  It has been a very good trip with certainly some interesting experiences. It's the first time we have delivered this session with live translation - and everyone here is extraordinarily polite.

I found it particularly interesting that the Japanese market has little exposure in this space from a global perspective, considering these guys are certainly strongly behind this initiative, and several large manufacturing companies are executing this vision today. There is a historical tie here with Software Factories from as early as the 70's - 80's based upon work done by Dr. Matsumoto, who even today, although retired, is a huge active proponent of the software factories work, based upon his preface to the Japanese translation of Jack's and Keith's book. (It has sold over 2000 copies in Japan alone!). I was very grateful to receive a printed copy of this book from one of the Japanese translators - Kazuyuki Nomura - whom happens to be one of the top leads for software factories at Microsoft Japan. (We are hoping the community hears more from the local team here and we fully expect them to contribute some new factory papers based on their experiences in this part of the world).

Reuse Challenges

We spent some time in subsequent discussions with various local solution integrators, partners and customers. It became clear that the software development model in Japan, [the relationship between end-customer and partner (Solution Integrator)], is much more formalized and rigid here than perhaps in other regions of the world. This introduces new practical challenges when adopting a software factory approach for several reasons related to: IP protection, the division of labour between these two parties, and the requirement to reuse existing assets and IP solely owned by the end-customers.

The key issue area's here are related to "Software Factory Verticalization" (factory specialization and factory extensibility), a topic very close to my heart right now. I will be exploring the story of this more fully with practical resolutions to them in a subsequent posts, but the experiences here have challenged the fundamental assumptions we have when discussing custom software factory specialization with respect to the specific challenges they face here. (I am certain that other world markets will have the same issues to much the same degree).

For example, considering the standard end-customer/solution integrator model of software development popular today. Where, in the case for software factory development, the solution integrators create the factories and use them to create products that they then sell to end-customers. In this model, we tend to assume that it will be the system integrators (partners) who would be building the specialized (vertical) software factories. They will likely create products for multiple customers (in each vertical market segment) from this factory using their own reusable assets (that they would have likely harvested from previous solutions they built for other customers).

But what happens when an end-customer has a requirement to reuse their own assets, ones they already possess in their enterprise, as part of the solution the factory builds for them? It's not unreasonable to assume that there may be reusable assets already deployed in a end-customer's enterprise, specific to that enterprise's IT policies, that will be good candidates for reuse in any factory-built-solution built for them.

Clearly, for a partner to reuse specific end-customer's assets in their factory to create products for other end-customers is an IP issue for each and every end-customer. It makes it an interesting business model between the partners and end-customers. This raises the critical question - who invests in the construction of the factory?, who owns and actually builds the factory?, and who uses the factory to create the products? Clearly, it might seem case-by-case - but you can catch more on this topic in a later post.

White Papers

Edward and myself also celebrated the close of several months work completing our short series on software factory packaging and team build implementations for software factory solutions. As an early announcement, we can say that we have completed 2 white papers - bound for MSDN - that should be published very shortly, that are based upon past shared practical experiences of packaging and team development , which we hope will unblock a number of people building software factory solutions today. So, you can expect to  see a couple of papers on MSDN entitled: "Packaging & Building Software Factories" - 'Part 1, Packaging with Visual Studio 2005' and 'Part 2, Automated Builds with Team Foundation Server'. (But please don't ask us when you can get your hands on these, as I can only direct you to watch the MSDN Architecture Center for their appearance in the near future - it is over to the publishers now.)

We also have another series on the go, which the above series interrupted for the last few months, entitled: "Building Software Factories - Part 1, 'what are we building and why?', Part 2, 'what is it going to take?' and 'Part 3, how are we going to do that?" which are expansions on our TechEd sessions and blog posts in our 'Building Software Factory' series. You can also expect to see these on MSDN in the near future. (again, all enquiries for when they will be available - see the MSDN Architecture Center). Many customers have asked for readiness and training materials for building factories today, so until we have such programs readily available, we hope these papers will carry you forward. We will of course keep you posted as soon as we know these papers are up on the site for sure.

Sayonara!

We said it a while back at the start of the year, odd calendar years always bring good change for me, and this one could not be better.

I've accepted the offer to move to the US to be the Microsoft principal lead on a very significant software factories engagement (still within Microsoft Services). I can't give details about whom or what, but I am relocating my family to the east coast US, in the Boston area. I have to say its been a real honour to be chosen to lead this engagement, and I am thankful I will be able to add significant value to the customer directly in helping them take this step forward with their software factories initiative.

As for what impact this will have on my duty to the factories building community - I hope none. I will stay connected via my blog, codeplex projects and writing. In fact, we are about to release a number of white papers to MSDN (5 in all!) regarding practical implementation of factories on the MS platform, so stay tuned. This  also explains why I've been quiet on the blogging front for some time. I still have the DEPT project to close, and help Edward with the DIXPT project and others (such as the SFTTEAMBUILD Project which we are about to release with one of the white papers). We also have a few TechEd sessions left (in Japan and Europe) to present. I am hoping it's not going to stop there either.

Not to mention all the great advances in the Visual Studio platform and the VS ecosystem that are coming your way in the next releases.

So, if you or your organisation are doubtful that a software factory approach is the right way to go for your organisation, hopefully you will gain some confidence in the knowledge that the top software engineering companies in the world are blazing the software factories path right now. The future is bright, and many of us are doing our level best to make that a better experience for everyone in this space. Don't get left behind!!

Whilst at TechEd US in Orlando, we set up a little fun with Martin Danner in a 'Virtual TechEd' interview.

The videos for these interviews have now been released, you can catch our one here called: 'Build Your own Software Factory'

Thanks to Martin for hosting the interview, have to say he made it pretty challenging...

If you are in Japan on 21st-24th August this year, drop by TechEd in Yokohama to see us (Edward and myself) present our session 'Build Your Own Software Factory'.

This will be a repeat of the same titled session we delivered in Orlando in July.

Recently, a good colleague of mine (you know who you are Tim), asked me what steps he should take to build an XML authoring solution based upon existing XSD schemas they already have in their company. The objective was to create XML file instances (of a well known schema) to describe some business thing, but how to do that with a better authoring experience than writing angle brackets - since most of the folks who need do this in his company don't really have XML skills or sufficient knowledge of the XSD schemas to accurately construct one of these XML instances in its entirely. XML is just the chosen format the technical staff chose to use to represent this data for other technical reasons, and why should the people who need to create these business things have to care about XML or XSD? But they sure know what these business things are and how to define them in higher level terms.

Clearly, this is not an uncommon scenario, and, in principal at least, it should not warrant a massive development effort  to create a simple XML authoring tool just dedicated just for this XSD schema. You might argue that they could just use XML notepad or other XML editor, but this is really not the kind of solution that non-developers business professionals would be very comfortable or productive with.

To be fair to Tim, he already knew what solution to go for of course, but wanted some reassurance of how quickly and what tasks need to be performed for his team to leverage some of the new tools to create this kind of solution for him. Providing him a nice dedicated 'smart' simplified graphical designer that he could put in front of his business oriented people to help guide them through the desired authoring process of these things; never having to touch (or care about) the underlying XML, how it is defined, or how it gets completed, with all its intricacies etc. He just wanted a simple GUI designer to define the main aspects of the business thing the XML is describing and spit out the fully compliant XML for other tools to process later.

Well, if you were confronted with this problem a few years back, you would have likely proposed creating a new dedicated web solution, convoluted XSLT type solution or some desktop application or tool (or perhaps even an InfoPath solution), or told Tim to go use XML notepad of some such generic XML authoring tool. But today, I am sure (I hope) most of you would now feel comfortable suggesting to go build a domain specific language with the DSL toolkit.

What makes building a DSL for this kind of 'brown-field' solution very interesting, is that you already effectively have a domain model defined in your XSD, which is a great starting point.

'Brown-fields' is a term used to describe scenarios where there are existing solutions already implemented and where you are trying to introduce a new technology or solution to help with the completion or enhancement of that solution. It's almost the opposite to 'Green-field' scenarios where you have freedom to build any solution with any means, and are unconstrained by existing tools, technology or solutions.

The XSD provides most of the information needed to describe the model and the types (domain classes, external types, inheritance etc) it needs. Once you have defined your domain model of course, what you show in a DSL designer does not have to reflect all domain classes and relationships from your XSD. After all, you may want to provide some abstraction of the thing defined in the XSD in your designer, and have the designer fill-in or imply parts of the XML for the user, based on either defaults, or other settings and constraints in the XSD. This ensures that the thing defined (in XML) is always valid and complete with respect to the XSD.

Once you have your domain model fully defined, and a designer defined to graphically represent your domain model, its simply a case of generating the XML from this DSL. You can do this in a text template, or apply an XSLT transform to the DSL file, both are common approaches. But there is a better technique for cases like this.

One little known fact about the DSL toolkit, is that you can extend it to control exactly how to persist the XML that is written out to describe the instance of your DSL.

In case you haven't noticed, the instances of your DSL files are persisted as XML in a logical XML format that reflects the domain model of your DSL. In fact, each DSL project creates for you an XSD that defines the format of this persisted XML as well. View your DSL instance files with a text editor, like notepad, and see for yourself this XML.

The DSL toolkit provides some simple built-in control to customize how the elements and attributes of the persisted XML in the domain model are serialized to your DSL file. This is limited to how to name the elements and attributes, and basic XML formatting. But the DSL tools also support another level of customization that enables you to change completely how these files are rendered in any XML format.

Through the use of custom serializers, you can render your XML in any format you wish, as long as that format is loss-less enough to be serialized and de-serialized without loss of data for your DSL. The DSL tools team have an example of this in chapter 6 their new book 'Domain-Specific Development with Visual Studio DSL Tools', and a bunch of guidelines to follow for custom serialization you should follow.

 

Knowing all this, it's now conceptually trivial to build a new DSL based upon an existing XSD, and provide a graphical designer to author new XML instances of this XSD. Then persist your DSL XML in a format that is defined by your XSD, and skip the additional transformation step - as the model file is the XML it represents. In this way, you are effectively creating a new dedicated graphical editor in Visual Studio specifically for editing your types of XML files, and these files are still valid XML instances that can be consumed by other tools and processes.

In practice though, it can be quite tedious to define all the domain classes and relationships from an existing XSD (using swivel-chair integration), especially if the XSD is large. It will also be a little technically challenging, since the DSL domain meta-model will not be able to support all constructs and relationship types defined in XSD - there will have to limited coverage of XSD that can be modelled, and graceful handling/workarounds of areas it can't.

It's a shame we don't have any tools to import XSD files as a starting point for a new DSL, or import parts of an existing XSD's into an existing domain model (imagine 'New DSL Solution from XSD' command). Which would then pre-populate a domain model reflecting the XSD, and generate the necessary custom serializers used to persist the DSL model to XML conforming to the XSD schema.

However, I am hoping at least someone eager in the DSL community will take it upon themselves to create an 'DSL Import XSD PowerToy' extension that would provide this for others to leverage - perhaps a new codeplex project? - it certainly would help a lot of people get started creating DSL's for existing solutions based upon XSD's, and provide a very quick and easy means to create graphical designers for XML authoring of any existing XSD schema.

Recently, I did an interview about factories for an online magazine (InfoQ) who were asking me to explain what factories were all about. (Here I am thinking everyone knew already!)

To help explain building them I wanted to use a practical analogy. I had hoped to appeal to those of us from a hands-on background using a better understood metaphor. (Everyone is sick of the automobile factory analogy!)

Whilst admittedly, most may have never have owned, fixed or built a motorbike, most boys (and some girls - I am desperately trying to be inclusive here) out there would be familiar with some of the basic terminology used and such - besides which I've kept it fairly non-technical to reach a broader audience.

 Incidentally, the story actually started off being an analogy about building Airfix models, like the ones we used to build as kids (well I guess, some of us anyhow). Imagine, you can just see the grey plastic wire frames and moulded parts, and smell the enamel paint and feel the glue sticking your fingers together. But the analogy ran a bit dry because, unlike software factories, you don't really need many custom tools to build airfix models (unless you count the paintbrush and tube of cement of course).

I quickly switched to a better story where you do need a few custom tools, and you get a lot of the parts in raw material form as well as ready made components and detailed instructions - it's just that the box it comes in is bigger than airfix perhaps. So, the analogy was born around building kit-motorbikes. Of course, it could have just as easily been kit-cars or kit-planes. But custom kits in this sense are pretty close to where we are with factories and software today.

Now personally, I've never ridden a 'cruiser' type motorbike I describe in the story below. I definitely had a certain friend in mind for building that type of bike. (Myself, I started out riding and fixing Vespas and then graduated to various sizes of Japanese plastic missiles). But for most, cruisers are much sexier than Vespas, but in fact, in retrospect, choppers would have probably been much sexier to use.

Well that friend of mine recently pointed out that he thought the analogy was a perfect vehicle for describing a software factory and explaining the jargon, so I thought I'd re-share just that part of the story here again for you (just in case you missed it).

You can find the complete interview here. What follows is just the relevant middle part of the Q&A piece.

<snip>

 

JES: I'll assume you build custom software solutions today for your customers. Let's see how we get from these standard parts to building a software factory. I'll also introduce the factory jargon as we go.

Let's say that a customer, wants a custom built motorcycle, and they ask you to build it for them. Something a little different from what you can buy off the shelf, not factory-made (excuse the pun, I mean not a standard model), but custom made - but not from scratch - a standard type of bike model like a 'cruiser', with a few personal modifications.

Now clearly, the customer is asking you to do this, because (a) they can't buy this bike off the shelf from a store, because the store only sell standard models, (b) they don't want to specify a bike from scratch, a specific known classification of bike will suit their needs for now (the 'cruiser' type), (c) they want some personal special modifications done to this bike, and finally, (d) clearly they would rather pay someone to deliver it than take the risk of doing it themselves.

Typically, as a bike builder, your simplified options are:

  • Build it from scratch - very risky, and expensive and low profit for you
  • Pay someone else to make one for you (outsource) - expensive and low profit for you
  • Buy a ready-made kit of one (a 'cruiser bike' kit), and build it, and customize it yourself - cheaper more profit.

Now, this bike you want to build would be a very specific, known type of motorcycle (a 'cruiser'). The special kit would include most of the pre-made parts (engine block, carburettors, cylinders, wheels etc), some raw materials (fabric, tubing, sheet metal, plastic etc) and specialised tools to construct the bike with the step by step instructions on what to do and what pieces you need at each step. You still need to build it all yourself, and wield the tools in the right sequence of steps, against the right materials and parts. But most of the really detailed hard parts like carburetion, power transmission, fuel injection etc, are already solved and come in ready-made components. You just have to hook them all together to work on a frame you can sit on.

InfoQ: How is this different from how we build software today?

JES: For a lot of successful solution providers, this is the experience of building software today. But, for others it's quite a different story when you have to start with only raw materials like plate steel and tubing with screws, spanners, welding torches and milling machines, with a rough sketch or notion of how these things should hang together to create the end result. (A certain TV series comes to mind for where they do that very well for custom bikes). Then actually going ahead and building a highly customized, quality, unique one-off bike for your customer and their particular needs. Not that it can't be done of course, many will try; a few will even succeed, and some become specialists at it. (As we witness in that TV series).

The cost of doing this custom one-off development though is enormous to the end customer, and few businesses can afford to buy into that market. Few customers today can afford to invest in that type of luxury just to get a nice looking functional bike that gets them from A to B in style. The story of software factories starts with a requirement to want to reach out to larger markets, where the solutions don't need to be so customized and the customers are more willing to make a 'reasonable' investment in a high quality product that is completely functional.

The reason the customer came to you in the first place, was (hopefully) you already possess the capability to build them such a custom solution - you know the domain. You can do it at a reasonable cost, and you've probably done it before, and could do it again - you own domain experience and solution domain knowledge. It is likely that you probably already did all the work of creating a custom motorbike solution, so you know what to do. Probably, you did that multiple times before and in that process, understood deeply what all the nuances of building a custom motorbike are. All the tips and tricks (practices, and patterns) and more importantly, how it should fit together properly to satisfy larger requirements like: road safety, performance, fuel efficiency, noise control, comfort etc. (domain specific quality attributes) - in essence you are a domain expert. In the process, as an outcome, you probably developed some of your own custom tools to help building the bike (Assets). You probably also harvested and refined certain parts and architecture you found in common with all your previous attempts at building these types of solutions. No doubt, in the process of building these types of solutions, you would have built several one-off b