Microsoft is currently developing a technology known as Language Integrated Query (LINQ). Simply described, LINQ provides a SQL-like syntax as part of the Visual Basic .NET and C# languages. This query syntax can be used over any combination of objects, XML, and relational data, addressing what is often referred to as the ROX triangle. Dr. Dobb's first talked with people working on LINQ back at the 2005 Professional Developers Conference, and in this interview, Scott Swigart follows up with Amanda Silver, Program Manager for Visual Basic, about the progress that Microsoft is making in this space.
DDJ: Amanda, thanks for taking the time to chat. I think the last time we spoke in-depth about LINQ was back at the PDC. What are some of the big changes since then?
AS: Since the PDC, we've really been listening and trying to respond to customer feedback, and we've made some changes to the language to reflect what we've heard. We changed it so that "From" comes before "Select" when you write LINQ statements, which lets us make the Intellisense experience better. We heard that people like the SQL syntax, but that the highest priority was Intellisense, and that's why we made that change. [Editors note: See Listing One for a simple LINQ query.]
Listing One
Dim q = _ From c In Customers _ Where c.City = "London" _ Select c
The other thing we've heard is that while parity with SQL is important, the Intellisense experience and discoverability of the syntax should take the highest priority.
DDJ: It seems like there would be tension on that specific issue. If you try to make it very similar to SQL, then you'll get dinged on every spot where there's a difference. This is Language Integrated Query, which I take to mean querying capabilities built into programming languages like Visual Basic and C#. I don't see that you're trying to replicate SQL-92, but that you're using a SQL-like syntax to reduce the learning curve. This also has to work over a lot more than just relational data, so I understand that copying and pasting SQL directly from the database isn't realistic. But, I can understand people who will glance at the syntax and intuitively expect that to work.
AS: Right. The other thing that we've been working on for a while is dramatically improving the editing experience for XML. This latest CTP has outlining capabilities that let you collapse XML nodes [Editors note: The Visual Basic implementation of XLINQ lets you embed literal XML in your code.], we've added support for XML namespaces so that you don't have to have the full namespace everywhere. We've also changed it so that it's easier to access the value of the element.