| Integrated Query Next on VB, C# Roadmaps |
| Nov. 7, 2005 |
The next versions of C# and Visual Basic (VB), Microsoft's most popular programming languages among corporate developers, will include new syntax for querying data such as XML and relational databases. The new capability, known as Language Integrated Query (LINQ), was announced at the Sept. 2005 Professional Developers Conference (PDC) and is due as part of the 2007 release of Visual Studio (code-named Orcas). Although it has very little immediate impact on developers, LINQ could eventually make it easier to create applications that access data and give VB developers another reason to move from the aging VB6 platform to .NET. Adding Queries to VB and C# Applications that access data, particularly data stored in relational database management systems (DBMSs), often contain important logic that isn't expressed in the programming language but is instead represented as plain text (usually in quotation marks). For example, when a program queries a database to retrieve a list of customers living in a particular zip code, their account balances, and a detailed list of purchases, ordered from highest sales to lowest, it isn't using any of the traditional features of programming languages, such as IF and WHILE statements. Instead it assembles a database query as plain text (e.g., "SELECT * FROM Customers WHERE ZipCode = '20212'") and sends that statement to the DBMS. With LINQ, developers could express this kind of query logic directly in the programming language. Building query capability into a programming language can help developers catch errors earlier in the development process. When a query is expressed as plain text, the compiler, which converts a programmer's source code from text into binary code that can be executed, is unable to validate that the syntax is correct or that the code that manipulates the resulting data is compatible. Expressing those queries in the programming language makes them accessible to tools that identify many common programmer errors when the program is initially compiled, rather than while the application is being tested. Some database-oriented programming languages have had this kind of capability for years, but often with restrictions that make them less suited as general-purpose languages. For example, dBASE and its derivatives have always included the ability to build queries but were tied to a specific database engine. Multiple Data Sources Supported LINQ queries can target any data source whose APIs conform to a particular design pattern, not just relational databases or a particular database engine. This enables developers to use a single query to combine data from diverse sources, such as simple lists in the computer's memory, database systems, and XML. This could simplify programming of applications that need to combine multiple data sources, such as combining information on a customer retrieved from a SQL database with locally calculated and stored information on that customer. Using a design pattern, rather than hard-coding VB and C# to support a specific database engine, also makes LINQ more accessible to third parties, including both programming language vendors and class library vendors, and makes it much more likely that LINQ will see industrywide adoption. Borland, for example, has already announced plans to support LINQ in its Delphi product line. As part of a LINQ technical preview, Microsoft is providing samples of LINQ-enabled libraries, including the following:
Eventually, these libraries are expected to become the next versions of ADO.NET and System.XML and to be distributed as part of the .NET Framework 3.0. (For a roadmap illustrating these releases, see the illustration "Visual Studio Roadmap".) However, the libraries will almost certainly see substantial changes between now and 2007, so developers should treat the preview as just that—a preview of future technology, not a commitment to any particular API. C++ Support: Missing in Action? LINQ was discussed at length in VB and C# sessions at the PDC. However, support from Microsoft's other major programming language, C++, was conspicuously absent. C++ wasn't mentioned in any of the keynote demonstrations nor in any of the white papers released thus far, and it received only passing mention in a session given by Herb Sutter, an architect on the Visual C++ team. There have been some indications since the PDC that Visual C++ will support LINQ, but nothing definitive has been posted to MSDN. Instead, the Visual C++ team seems to be focusing on features likely to be of interest to its core audience of professional ISVs, such as making it easier to write programs that can take advantage of dual-core CPUs. Resources The LINQ Project home page contains a technical preview release, specifications, sample code, and a video with Microsoft architect Anders Hejlsberg and can be found at msdn.microsoft.com/netframework/future/linq. |