Q&A: Microsoft to Simplify and Speed the Development of Data-Rich Applications by Extending the .NET Framework to Provide Language Integrated Query for Databases

LOS ANGELES, Sept. 13, 2005 — One of the main issues currently facing developers industry-wide is the difficulty of creating data-rich applications, a difficulty that arises from the tremendous differences between query languages used to access data and programming languages commonly used to write applications. A quick browse through the computer programming section of any bookstore provides evidence of this issue. Books are divided into sections that address different types of programming, such as XML, database and object programming, revealing a world of distinct domains. Developers writing applications that access data from relational (SQL) or hierarchical (XML) data sources must be adept at traversing very different language syntaxes to get the job done.

To reduce complexity for developers and help boost their productivity, Microsoft today announced a solution for the .NET Framework called the Language Integrated Query (LINQ) Project, a set of language extensions to the C# and Visual Basic programming languages that extends the Microsoft .NET Framework by providing integrated querying for objects, databases and XML data. Using LINQ, developers will be able to write queries natively in C# or Visual Basic without having to use other languages, such as Structured Query Language (SQL) or XQuery, a query language for accessing XML data. The announcement was made here at the Microsoft Professional Developers 2005 Conference, where Microsoft is making available a Tech Preview containing pre-release versions of the various components of the LINQ Project.

PressPass spoke with Microsoft’s Anders Hejlsberg, technical fellow and chief architect of C#, and Paul Vick, technical lead for Visual Basic, to learn more about the LINQ Project.

PressPass: You have talked frequently about the impedance mismatch between the programming languages used to write applications and the places used to store data. Can you talk more about how this complicates the work of developers?



Anders Hejlsberg, Microsoft Technical Fellow and Chief Architect, C#

Hejlsberg: When developers write enterprise applications today using Visual Basic, Java, C# or any other object-based language, they almost invariably need to access data. For instance, a developer creating an e-commerce Web page will need to retrieve product information, such as price and current quantity, directly from a relational database. The programming language required to access that data might be SQL, XQuery or both, so the developer must switch from writing in, say, C#, to writing string-based SQL or XQuery commands. Not only does this scenario require familiarity with several programming languages, but it also requires a mastery of the application programming interfaces (APIs) that bridge the different domains, such as ADO.NET or Open DataBase Connectivity (ODBC).

Learning and using these different programming languages and APIs is a daunting task, because the semantic mismatch between relational data programming and object-oriented programming is huge. For example, the two worlds have different type systems, different built-in data types and different standard functions. In addition, only the relational world supports queries.

Vick: Developers must also contend with a lack of integration between these domains. For instance, when they write SQL or XML queries for an application written largely in another programming language, there is no compile-time type checking that lets them know if their query is written correctly. Instead, they find out about coding errors only after the query is sent to the database server and has been unsuccessful.

Hejlsberg: So until now, building data-enabled applications has typically been a time-consuming, error-prone and non-integrated programming experience – a problem that’s been difficult to solve across the industry.

PressPass: What is the Language Integrated Query Project and how does it address this problem?

Hejlsberg: The LINQ Project is designed to improve productivity by reducing the need for developers to learn and use multiple, distinct languages in building data-enabled applications. It does this by extending the .NET Framework to include language-integrated query operations. What this means is that developers can build data-enabled applications entirely in C# or Visual Basic, without having to switch to SQL or XQuery to write the query portions of the code.



Paul Vick, Technical Lead, Visual Basic Development

Vick: LINQ has several components, the first of which is a set of specifications that define how queries are expressed in API form. These specifications are key because they establish the rules for adding language support to any LINQ-enabled language and for adding query support to any LINQ-enabled objects. Then, based on these specifications, Project LINQ includes a set of language extensions to C# and Visual Basic and a set of libraries that provides integrated querying for objects, databases and XML data using native language syntax.

By default, LINQ’s core query operators can be applied to any .NET array or collection of objects, which effectively provides SQL-like and XQuery-like capabilities for any data that is in memory. LINQ also provides two new critical API’s: DLinq, for accessing relational, SQL-based data, and XLinq, for accessing hierarchical, XML-based data. The query capabilities of Project LINQ are compositional, meaning multiple queries can be easily combined together. Single queries can access data from multiple domains, and you can also specify both local and remote execution.

Hejlsberg: LINQ can also increase developer productivity by enabling developers to use all the Visual Studio features they are familiar with, like IntelliSense statement completion, a feature that provides pop-up suggestions for code as it’s being typed, and compile-time type checking, which lets developers know about errors as they’re writing their queries, rather than finding out about them later when the code doesn’t work.

PressPass: How long has Project LINQ been in the making?

Hejlsberg: Project LINQ as it exists so far is the result of over half a decade of effort. At its core, LINQ leverages multiple new features of the .NET Framework 2.0 to unify object-oriented languages and database languages into one common programming model. This comprehensive and ambitious project has been a broad-based collaborative effort on the part of Microsoft, involving the language, data, and runtime teams. We have been working very hard on it for several years now, and we expect that work to continue.

PressPass: How innovative is the LINQ Project? Are there other fixes for this industry-wide problem?

Hejlsberg: We believe the LINQ Project provides very powerful capabilities that are unlike what other programming paradigms offer. With LINQ, queries, set operations, and transforms become first class concepts in .NET languages and APIs in the same way as classes and objects. Rich queries that could previously only be written in SQL or XQuery can now be expressed natively in C# or Visual Basic.

The comprehensiveness of the LINQ Project is also unique. Most other solutions have focused on a single domain, such as XML or SQL, or a particular language, whereas LINQ is designed from the ground up to be open and extensible, supporting all forms of objects and data, using a LINQ-enabled language. We’re breaking ground here, but there’s nothing intrinsic about LINQ that would preclude other .NET languages, such as C++ or Javascript, or third-party languages from adding this capability.

PressPass: How do you think developers will respond to the LINQ Project?

Vick: Every time that we have previewed the LINQ Project to customers, we have received a genuinely enthusiastic response. Because LINQ actually changes the programming model and makes working with all kinds of data much easier, it will enable positive shifts in the way developers work today. Operations that used to require a lot of code are going to become very easy and natural for them. For example, a developer who is working with a collection of customer objects and wants to query a list of names from that collection would need to write five or ten lines of code to accomplish that simple task with today’s technology. With LINQ, that list can be obtained by writing just one line of code, “Select Name From Customers.” In addition, the querying capabilities provided by the LINQ Project let developers combine operations, such as filtering fields from a collection, sorting them into new collections and ordering them, using just one line of code rather than the tens of lines this would typically require.

Not only will LINQ make life easier for developers by not requiring them to write as much code, but it will also let them do so much more because coding against data is suddenly so much easier. Once developers realize what they can easily accomplish using regular arrays of data, they will be amazed at all the possibilities. In essence, LINQ enables developers to build better applications more quickly.

PressPass: How can developers start using LINQ today? Is it designed to work with Visual Studio 2005?

Hejlsberg: Project LINQ is targeted at future versions of Visual Studio: however we’re making a Project LINQ Tech Preview available at the Microsoft Professional Developers 2005 Conference so that developers can immediately begin taking advantage of the capabilities that LINQ provides. The preview contains pre-release versions of the various components of the LINQ Project, including a C# compiler, with extensions to support LINQ, as well as a Web link for downloading a Visual Basic compiler that has built-in LINQ support. Both of these pre-release compilers work with Beta 2 of Visual Studio 2005 and will work with Visual Studio 2005 when it becomes available in November.

In addition to these compilers, the Tech Preview contains pre-release versions of the class libraries, the core query operators and the DLinq and XLinq API sets, as well as language documentation and demos. We’ll refresh the pre-release components of the Tech Preview when Visual Studio 2005 becomes available, and then provide regular updates as the project progresses. The key thing we want to do is provide customers early access to the bits so that we can take their feedback early on in the development cycle.

Using one language to unify all of the programming domains – objects, relational data and XML – makes the LINQ Project a truly powerful and innovative solution, one that provides yet another advantage to using the .NET Framework.

Related Posts