BOSTON -- Data storage has come a long way in the last two decades, with today's cell phones and MP3 players possessing more memory than entire systems did in the 1980s. Nowadays, though, data access in the .NET world is right back where it started, Rockford Lhotka rationalized during the keynote address at the first day of VSLive in Boston last week.
Developers began using language integration with preprocessors in the 80s. Many years of SQL followed. Now Microsoft is introducing LINQ, the Language Integrated Query, in C# 3.0 and VB 9.0.
We've come full circle to where we were 25 years ago, but [back then] it was an abysmal, miserable, terrible experience," said Lhotka, the principal technical evangelist for Magenic. Debuggers would compile a developer's language integrated query as pages and pages of code. "You were left guessing what you had typed in the query and going back and retyping it," Lhotka said.
While those old queries were integrated with preprocessors, LINQ is, as its name implies, integrated directly with the language itself. As SearchVB.com contributor Mike Gunderloy wrote in Let's think about LINQ, the query allows traversal, projection and filtering operations in any .NET language. Furthermore, Gunderloy noted, LINQ can be applied to any data source that supports IEnumerable
Lhotka said: "You'll be able to walk through in the debugger with your code and walk through it line by line. They've given us true language integration."
LINQ represents the good news regarding data access. The bad news for developers, Lhotka said, is Microsoft's tendency toward frequent updates to ADO.NET, its API for accessing databases. These updates, which by Lhotka's calculations occur every 1.7 years, could present a situation similar to the Y2K crisis, with enterprises essentially rewriting code to make it do what it already does.
"It's a perennial problem," he said. "Ultimately, if you want to shield yourself the most from Microsoft's changes in technology, you need to abstract yourself from ADO.NET. Hide and control where Microsoft's code is used."
Reducing one's dependency on the dataset requires an extra layer of software. This also becomes important when working with data sources, such as audio and video, which are not really objects. Here Microsoft is embracing object-relational mapping, or ORM, as the ideal go-between for data sources and entity objects.
The combination of ORM and LINQ means developers can sort and filter objects in memory, Lhotka said. "This is the future we're presented with," he added. "Whether this is a better future or a worse future that dealing with datasets, time will tell."
ORM is a concept the .NET world has borrowed from Java. The main ORM tool in the Java space is Hibernate, and its equivalent in .NET is called NHibernate, which maps .NET objects to and from a relational database.