Thu, 15 Nov 2007 10:19:39 GMT
Don Smith (although I think Jack Greenfield stood in for him)
Product Planner
Microsoft Corporation
The book "Software Factories," by Jack Greenfield, Keith Short says Software Factories are:
"…a software product line that configures extensible tools, processes and content… using a software factory template based on a software factory schema… automate the development and maintenance of variants of an archetypical product… assembling and configuring framework-based components"
The Software Factory team at Microsoft, makes a more concrete definition:
- A tool to assemble a specific type of solution according to its domain
- Runs within Visual Studio
- Uses models, designers, editors, wizards, etc.
- Outputs mostly generated solution (product)
- Also contains: executables, guidance, reusable components
Return on Investment
I’ve built a number of software factories over the last decade. From V-Raptor on VB6 and Classic ASP – with my long standing colleague Jon Silver at Step One Technologies back in 1998, through ActivForms for .NET at Cassium Technologies (now NetStore) in 2002, all the way to the Capgemini Development and Architecture Framework (CDAF) with my good colleague Drew Jones in 2005/6.
When you build your own, you need to seriously consider at what point it’s more productive to write your application by hand, and from what point it becomes more cost effective to write an engine to write your code for you.
If you’re building one from scratch to help deliver software from rules-based and data-driven scenarios, the Microsoft guys estimate that you need to expect development to take 2-3 times longer than building a single product. If you’re expecting a return on investment (ROI), don’t expect economies of scale until you’ve sold more than about 5 instances of your product.
Personal Lessons
It seems there is now a groundswell of people doing things this way nowadays. I was never a thought leader back when I started writing these things, and other people who did things this way were few and far between. But the ideas I had were in the right direction.
My rule of thumb was "if you were building more than 20 data entry screens, write something to build the CRUD for you."
Working with Drew at Capgemini was a great experience. The CDAF took the Software Factory idea and added architecture and software engineering discipline to the mix. Check out my article on MSDN "Real Frameworks in a Service Oriented World". At Cap, I saw around 20 or so projects using CDAF before I left. This is why I’m surprised by the story of the software factory that never got used.
The New World
The new Microsoft product set in Visual Studio 2008 gives you everything you need baked in to make your own software factories. In fact, most of this functionality is available already in the guise of the Web Services, Desktop Client, Web Client and Mobile Software Factories available on Codeplex.com. The new generation makes everything a lot more graphical and intuitive.
With the new tooling, it brings these timescales to build your factories right down. By using the supplied Software Factories and changing them, you can massively reduce the barrier to entry.
But when would you do this?
Mainly, when you’re a Systems Integrator
It’s really worth thinking about writing your own software factories when you have:
- Build multiple product instances
- Re-use assets from existing products
- Convey guidance and architecture about their use
- Increase productivity and product quality
- Achieve consistency and predictability
- Require less experienced people to build a product
- BUT! Never to DUMB DOWN development
Here are some pre-requisites for building a software factory:
- A well-understood, explored domain
- Tried and tested solution-based assets
- i.e. RIs, frameworks, class libraries, code templates, architectures & patterns, etc.
- Required, dedicated skill-sets:
- Business Domain Experts
- Technical Domain Experts
- Factory Platform Experts
And here’s some of the kind of things your factory would do for you:
- Harvest and generalise solution assets, for reusability
- Automate design/development tasks
- Generate solution artefacts
- Model a pattern, process or architecture
When to use discretion
When you write a software factory, you need to write documentation, build tools to help you use it. One of the speakers in this presentation spoke of having written a fantastic software factory at his previous company, well engineered, slick and lots of moving parts. However, he went on to fess-up that his organisation hadn’t managed to use their factory even once.
This is something of a mystery to me. I’ve always found that the frameworks and the factories I’ve been involved with evolve out of existing projects. When your lead techies get the point of having built a DAL the same way on their 3 last projects or so, they usually come to the conclusion that "if only they’d had a tool, they could have saved a whole load of time."
And I guess that’s what the Practices and Patterns guys are saying at Microsoft. Don’t build a factory from scratch. Don’t attempt to build a factory for something you don’t have Subject Matter Experts for.
Building your own templates
It’s actually quite easy – even in VS.NET 2005. If you want to include some standard classes or projects into your Guidance Automation Extensions (GAX) recipes, you can write your classes as usual in VS.NET and export them simply using the File -> Export Template functionality. To add them to a GAX recipe, you need to hack some Xml around, which is not a perfect interface to do it, but it’s still usable.
When should you use what toolset?
To build an Automated Action, you’ll use the GAX/GAT Recipe with a wizard.
To build Code or Artefact Templates, you’ll use a text templating engine.
To build Project or Solution Templates, you’ll use Visual Studio templates with GAX/GAT Recipes.
To build a Domain Specific Language, you’ll use the DSL Toolkit.
To build Logical Application and System Design, you’ll need Visual Studio Team Edition for Architects, and the SDM Toolkit
GAX/GAT available from patterns & practices, and all other tools used are available in the Visual Studio SDK.
How do I Kick Off?
In practice, start by building – by hand – your Reference Implementation; this is a working instance of the kind of applications you want to build. From this you can create a Solution Template with a GAT Recipe; the template needs to include all parts of your Reference Implementation. After this you can install your first factory version, then you can start incrementally improving the factory, updating the Reference Implementation and building new applications with each new iteration of the factory.
Domain Specific Languages
The Domain Specific Language toolkit is part of the Visual Studio SDK. It gives us a visual design surface. Interestingly, the DSL UI uses a Domain Specific Language itself to build new DSLs.
This is uncanny. Every software factory I’ve ever built has eaten its own tail at one point. With forms renderers, it’s usually the design UI that runs out of budget first, so the industry tends to point these engines at their own metadata.
The syntax for the DSL code generator looks suspiciously like ASP.NET. Which is no surprise, except that good old CodeSmith (remember that?) also was suspiciously similar to ASP.NET too…
Tools to Help
There are some cool tools that will help you out today – some from the community and some from Microsoft. Over the next few versions of VS, many of these features will be baked in to the IDE from the start. Here’s a shortlist of picks that you can start using right now:
Software Factories Toolkit - Clarius have an authoring toolkit for building DSLs and software factories. Check it out at http://softwarefactoriestoolkit.net.
VSSDK Assist - A visual toolset of utilities for extending Visual Studio. Available at CodePlex http://www.codeplex.com/vssdkassist
DSL Editor PowerToy (DEPT)- specifically for Domain Specific Languages, provides the ability to expose multiple views of a domain each with their own windows. Available at CodePlex http://www.codeplex.com/dept
GAX Extension Library - various utility classes to supplement those already included with the Guidance Automation Extensions (GAX) to Visual Studio 2005. Available at CodePlex http://www.codeplex.com/GEL
VS v.Next – Visual Studio codename Rosario will have all the GAX/GAT baked in. It will also come with Code Generation Framework, and DSL Validation Framework.
