One of the projects I worked on at Aspect Communications was the set of administration web services for the Enterprise Contact Server. The settings the web services managed controlled how the components were to be used together to accomplish a particular customer's business. There was a web service for each major area of function and there was a web application, written by another team, that put a GUI in front of the entire set. The web services were ASP.NET services written in C# and the web application was a WebSphere Java web container application. Test-driven development was used throughout.

The first version of the web services was written in a relative hurry for a variety of reasons beyond our control. As a result, there was a lot of duplicate code spread throughout the services. For the second version, we decided to be smarter. From writing the first version, we knew that there were two parts to these web services - business rules validation and database interaction. We decided to drive the validation with metadata stored in the database. We decided to drive the storage by building a single piece of logic that could store any of our data using C# attributes attached to the definitions of the data structures in the interface. (We later learned that what we had built was called an Object-Relational mapping (ORM) layer. There was certainly no other ORM available for .NET when we started, in the .NET Framework 1.1 days.)

This rework went very well, although it did take a few weeks longer than expected to complete it. We were able to cull a lot of code from the web services using this technique and several copy/paste bugs along with them. When we got requests for business rule changes, we could often honor them with a change to the validation metadata without having to provide new code. Because they were easy to enforce, we were able to enforce a more complete set of business rules than we had in the first round. The services became more uniform and robust. Once this structure was in place, we received very few reports of problems.