End of the Impedance Mismatch?

by agrace 10. July 2007 16:37

On a practical level, yes. And with a rack of new technologies in the offing from Microsoft, we are sure to have a far more enjoyable programming experience in the near future than we have had up to now.

For almost three decades, object-oriented programmers have had to deal with the impedance mismatch issue. In essence, the programs we use to access our databases are object-oriented while the databases themselves are relational. There is not a direct mapping between them. And while much of it is fairly obscured through the use of the ADO.NET API, it would be fair to say that the two models are as similar as chalk and cheese.

In middle to large-sized projects, we typically use entity objects as object-oriented views of our relational data. The biggest problem has always been establishing the mapping between the two. This often entailed the use of third party tools such as NHibernate. An alternative approach was object-relational databases which I never did like.

Enter the Magic Triumvirate of LINQ, Orcas and the Entity Framework! This set of technologies promises to eliminate the impedance mismatch between the various data models and programming languages. With LINQ, we now have rich queries built right into the language and can access the data source whether it's XML, relational or objects. Orcas, the latest version of Visual Studio is currently available for download as a CTP release. The best bet may be to install the virtual PC version. I'm planning on doing this myself this weekend as I really want to get the feel of the new LINQ syntax. The only sour note in all of this is that the final version of Entity Framework won't be available until after the Orcas release. In the meantime, you can download the new CTP version of the Entity Framework.

Here's a simple LINQ query taken from 101 LINQ Samples:

public void Linq()
{
  List products = GetProductList();
  var productNames = from p in products
    select p.ProductName;
  Console.WriteLine("Product Names:");
  foreach (var productName in productNames)
  {
    Console.WriteLine(productName);
  }
}


Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading