When Written:
At any of these previews of new programming technologies I always make myself a small bet that Microsoft will announce yet another new way of connecting to data sources. I was not to be disappointed this time. Finding a new way of dealing with data sets seems to be a long standing Microsoft tradition. Not content with using SQL which is a long established data query language that most developers have mastered in varying degrees, we now have LINQ which apparently is a little more like Foxbase in its structure.
LINQ can be imagined as a universal language which translates a query to a native query language depending on the datasource, so if, for instance, you were accessing a SQL Database it would translate to MSSQL, if you were accessing an XML data source then it would translate the query to XQUERY. So we have LINQ to SQL which was previously known as DLinq and LINQ to XML which was XLinq and the idea is that there will be connections to Access, LDAP, web services and Sharepoint, in fact any data source. Now whilst there is work being done on a version of LINQ to be known as PLINQ which aims to spread a query across multiple processors and so speed up execution, the fact remains that a query using LINQ is going to be slower that using a native query language, so why use it? The official argument is that LINQ separates some of the concepts that programmers need to deal with from the backend implementation.
Let’s take a look at how in LINQ, you might implement a simple SQL query of;
SELECT CompanyName, ItemID, ItemName from Customers where CompanyName = ‘ Acme’
In LINQ this would translate to:
var q = from c in db.Customers
where c.CompanyName == "Acme"
select new { c.CompanyName, c.ItemID, c.ItemName };
Now I’m sorry but I really fail to see how this helps the programmer. Where is the benefit? I have asked this question to people on the team and have yet to be supplied with an answer. Why spend time on yet another, lower performing query language which has to interpret LINQ to the native query language. Why not just give us ways of using SQL to query these data sources? Why we need yet an other query language syntax to learn is behold me, but I am assured that it is a really cool way of querying XML data, so I guess we might end up using it, or will it be consigned to that pile of obscure technologies that we have learnt during the course of our careers, the names of which help fill out your CV in the fairly safe knowledge that you will never be called upon to code with them again. Perhaps I’m missing something but I have a feeling that it’s yet another example of some very clever people, doing very clever things but ending up not supplying what the real world of the developer community needs.
Article by: Mark Newton
Published in: Mark Newton