On OO design, we try to encapsulate the things that we think may change. Whether it is creating an adapter or implementing a strategy pattern or even using an Inversion of Control framework like Spring.Net, the real goal is to isolate the “stuff that will change” from the “stuff that won’t.”
I try to do this at the architectural level as well. In a real sense, that is what SOA is all about. We use messages and contracts as a way of seperating two things… assumably these are things that are likely to change at different times and for different reasons. SOA is really just OO applied to distributed systems.
However, it isn’t always easy. Right now, I’m considering a number of options for a single application that is, in fact, the ‘point of a spear’. The app has to live somewhere, literally on a server or two or two-dozen. But where this app goes, dozens’ of other apps need to follow because they will have the same customers and will consume the same services.
On the other hand, this bit of the infrastructure is not built yet. I’d like to say that it was, but the app is beating the infrastructure out the door. That’s just the way it is. The business is driving the dates. More than that, we still have some fundamental disagreements about some very basic things that are being worked out, so I can’t assume even simple things, like the number of domains the app will operate in, or the security infrastructure it will leverage, or even what data centers it may live in.
This is the uncertaintly that we need to encapsulate. It is pretty pervasive stuff. The potential for screwing with the application is substantial (and appalling).
So we are doing what we always do… we are defining an interface. On one side is the stuff that won’t change… the application itself. On the other side is the infrastructure that will. Across the interface flow the services that the app expects from its infrastructure.
Now, I can put in an adapter that isolates the app from changes in the infrastructure. Hopefully, I’ll get the interface right (or fairly close to right).
As for the rest… we will just have to wait and see.