OdeToCode IC Logo

Boundaries Are Explicit Because Iteration Kills

Thursday, March 16, 2006

Growing up with C++, I’ve always expected software to have a strong domain model. If I had grown up with ADO Recordsets or ADO.NET DataSets, perhaps I’d have a different perspective on software, but my initial reaction to the Recordset was bewilderment at an object chocked full of data and no behaviors. I can see both sides of the coin now, and I think both approaches have their advantages in different scenarios. I still prefer the domain model. I do wonder how these models will evolve over the next few years as technologies like DLINQ arrive and continue the push towards abstracting away the database as a minor detail.

Here is some code that works wonderfully well.

BizObject b = new BizObject(/*...*/);

for(int i = 0; i < b.Count; i++)
{
   SomeOtherObject s = b.GetSomeChildObject();
  
  
for(int j = 0; j < s.Count; j++)
   {
      s.UpdateSomeValue();
   }
}

Well, the code works wonderfully well as long as SomeOtherObject is in the same process. As soon as SomeOtherObject becomes a proxy to a remote object, end-users feel the pain of an O(N2) operation carried out by traversing protocol stacks, security boundaries, and network routers. Thus, the SOA tenet arose that boundaries are explicit, and location transparency is a pipedream.

If boundaries are explicit, perhaps database boundaries should be explicit as well. Even though database servers are typically on our side of the firewall, if SomeObject.UpdateValue() is a database roundtrip, the application performance is in a world of hurt.

I’m wondering how to avoid this problem before an application gets into load testing. Static code analysis? Perhaps require the method to be invoked with a different operator? (SomeObject->UpdateValue())? I think -> is a nice indication that the call could possible travel out of process….

Perhaps I'm thinking crazy, or perhaps some dark part of me misses C++ syntax.