WSSF: Software Factories and You (or "Help, I've Fallen...")

"If it really were 1985 and you were writing Windows, you wouldn't even be doing it in C ... Windows itself was written in 8086 Assembly Language" -- Charles Petzold

First - what's a Software Factory?

In software engineering and enterprise software architecture, a software factory is defined as a software organization structured such that software projects are built in discrete "work centers". These generally represent, or specialize in, certain software disciplines such as architecture, design, construction, integration, test, maintenance, packaging, release, etc. Much like a true manufacturing facility, software factories require clearly defined product creation and management processes. By utilizing the same fundamentals as industrial manufacturing, a true Software Factory can achieve a superior level of application assembly even when assembling new or horizontal solutions. This can provide benefits in terms of economies of scale, geographic distribution, load leveling, and rigorous product and process control. Software factories have gained recent popularity as a cost-efficient way to reduce the time it takes to develop, create and/or construct software solutions.

Although the term "software factory" is used by Microsoft in association with the .NET Framework, "Software Factories" are much broader in use and application. For .NET developers, Microsoft's Guidance packages that represent Software Factories provide Wizard - like steps and stages that help the developer design and produce the Service, Implementation, Data, Business Logic and other layers including the generation of CRUD stored procedures against a database schema. In sum, you have a lot of code generation and logical construction of the framework, but you still need to flesh it out for a complete application.

Are Software Factories for Code Generation, or something else?

As a co-worker remarked to me quite prophetically the other day, the main purpose of these SF's is not to generate code for you (although they certainly do plenty of that) -- their main purpose is to enforce best practices coding and architecture standards. So, there is a "buy in" concept here where developers (and IT Departments) need to make a decision that they will embrace the best Patterns and Practices have to offer and "run with it". When all the developers in a group are in concert as far as the best practices architecture and coding standards they use on a project, there can be enormous gains in scale and quality on new projects. If two different groups are making brake pads, and they do it the same way, you know that when you need a brake pad, it will fit. It's that simple.

What does a Software Factory do for me?

The Web Service Software Factory (WSSF) (or "Service Factory" for short) provides guidance that addresses many of the challenges associated with building ASP.NET (ASMX) and Windows Communication Foundation (WCF) Web services and the components of a distributed application. These include:

  • Designing ASMX and WCF messages and service interfaces.
  • Applying exception shielding and exception handling.
  • Designing business entities in the domain model.
  • Translating messages to and from business entities.
  • Designing, building, and invoking the data access layer.
  • Validating the conformance of service implementation, configuration, and security using code analysis.
  • Planning for the migration to WCF.
  • Applying security to WCF services.
  • Applying message validation.

How much flexibility do I have?

What happens with WSSF is not "set in stone" - depending on the size and complexity of your project, you can eliminate some stuff, or combine it down into fewer component projects. But the bottom line is that 95% of projects use a data store (database) and you need to have it be "schema complete" before you start. Or to put it as a co-worker explains, "The Database is God, and the Meaning of Life can be found in the constraints of Referential Integrity".

Personally, I used to think Life was a fountain, but I have walked through the Valley of DLL Hell long enough to fear no DLL, so I would not disagree at this point.

Future versions of the WSSF (an early drop of v3.0 is already out) will have a "memory" of what you did so that if you change your Database, it's easy to regenerate the code. But right now, no dice on that score.

When you start a WSSF Solution the Guidance Package creates the following project structure:

Service Interface:
[YourName].DataContracts
[YourName].FaultContracts
[YourName].ServiceContracts
[YourName].ServiceImplementation
Business Logic:
[YourName].BusinessEntities
[YourName].BusinessLogic
Resource Access:
[YourName].DataAccess


In addition you get a Client project, and a Host project, along with optional TFS Tests. Then, you assign project "responsibilities" (which projects do what part) and you can begin to generate the various implementations and skeleton code for your DataAccess, DataContracts, BusinessEntities, ServiceContracts and so on. Everything is context-menu driven. For example, you could right - click on your BusinessEntities project, choose "Service Factory (Data Access) - and then either "Create Business Entities From Database" or "Create Data Repository Classes".

The best way to get started with WSSF is to download the latest bits and install them, and to go through one of the Hands On Labs that are provided, (for WCF Services, that would be the Coho Winery bit). Hint: This stuff is NOT a no-brainer: it takes serious study. But, it's the Way of the Wizard, and it's not going away, either. So, get with the program, programmer!

Extra Bonus - Fiddler 2.0!

Fiddler has been indispensable to me in debugging, capturing and even manipulating HTTP traffic. Now comes Fiddler 2.0! Snag a copy. You'll thank me later!

And One More: ".NET Command prompt here"

Copy all the lines below, and save them from notepad or other text editor with a ".reg" extension, then you can double-click on the .reg file to get the right-click context menu item to get a .NET-enabled DOS prompt on any folder in Windows Explorer:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\.net cmd]@=".NET Command Prompt Here"

[HKEY_CLASSES_ROOT\Directory\shell\.net cmd\command]@=hex(2):63,00,6d,00,64,00,20,00,2f,00,6b,00,20,00,22,00,43,00,3a,00,5c,00,50,\ 00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,00,46,00,69,00,6c,00,65,00,73,00,\ 5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,56,00,69,\ 00,73,00,75,00,61,00,6c,00,20,00,53,00,74,00,75,00,64,00,69,00,6f,00,20,00,\ 38,00,5c,00,43,00,6f,00,6d,00,6d,00,6f,00,6e,00,37,00,5c,00,54,00,6f,00,6f,\ 00,6c,00,73,00,5c,00,76,00,73,00,76,00,61,00,72,00,73,00,33,00,32,00,2e,00,\ 62,00,61,00,74,00,22,00,00,00

Comments

Popular posts from this blog

Some observations on Script Callbacks, "AJAX", "ATLAS" "AHAB" and where it's all going.

IE7 - Vista: "Internet Explorer has stopped Working"

FIREFOX / IE Word-Wrap, Word-Break, TABLES FIX

System.Web.Caching.Cache, HttpRuntime.Cache, and IIS Recycles

FIX: Requested Registry Access is not allowed (Visual Studio 2008)