Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

.NET

An Interview with Amanda Silver on Language Integrated Query (LINQ)


DDJ: I've noticed the Visual Basic XML features are getting a lot of interest from people who do a lot of work with XML. Visual Basic and C# have taken a different approach here. C# seems to have a "Paste As" approach such that when you paste XML into the code editor it generates the correct XLINQ API code. Visual Basic, on the other hand, supports pasting the literal XML directly into your code. Talk a little bit about that design decision, if you wouldn't mind.

AS: What we've heard over and over is that VB should be all about productivity, and about having the least amount of conceptual burden. With the XML feature set, we didn't want to have an API get in between the XML that you're trying to express, and the code that you have to write. This isn't just a "demo feature" either. You should be able to take any XML 1.0 and copy and paste it in to a VB code file.

The other feedback that we heard during Whidbey development, especially with things like the My feature, is that people only want us to build higher level abstractions if they reflect best practices. As a result, the XML literal feature reflects exactly what you could write with the XLINQ API. There's no magic going on. In C#, you paste as XML, and the development environment translates what you paste into API calls. In VB, you paste the literal XML into your code, and it's the VB compiler that translates it to API calls.

DDJ: Gotcha. You're doing more work at the compiler level so that the developer need only understand XML and the querying syntax, and not the entire underlying XLINQ API.

AS: Right, but at the same time there are going to be situations where you do need to fall back to the API. For example, we have three member axes for XML as part of the Visual Basic language. We have the elements axis, the attributes axis, and the descendents axis, but we haven't introduced the ancestors axis as a Visual Basic language construct. We don't think it's going to be as common for people to need this, and we're pretty conservative about what we put into the language. But, because XML literals translate directly to the XLINQ API, you can always fall back and use that underlying API. It's really seamless to do this.

The other thing that we've done in this CTP relates back to some other feedback that we heard about the XML feature set. People didn't like having the syntax for traversing an XML axis, and accessing XElement members, merged. For example, in previous CTPs, the code that you would write to access an element would be the simple dot operator [Editors Note: For example, User.Name]. However this was confusing. User is an XElement type, and when users type the dot, they expect to see members of the XElement type, not the child nodes. We've changed the syntax so there's a strong distinction between when you're using the XML axes, and when you're accessing the members of the type. [Editors Note: The syntax would now be User.].

DDJ: One thing that you mentioned that that's been worked on a lot since the PDC is the editor experience. That makes sense because, frankly, XML can be so big and ugly to work with. In specific, you mention differentiation between working with XML nodes, and XElement members.

AS: And in the future, we hope to have full Intellisense for the underlying XML document that you're working with. This distinction between accessing the XElement axes vs. the members is going to come in handy in providing a better Intellisense experience.

DDJ: Where are you at with some of the other things in the XML ecosystem? For example, what about validating against a schema or transforming using a stylesheet?

AS: XLINQ isn't designed to be a pure replacement for XSLT, there will be times when XSLT is a better tool for the job for transformation. But, because we can produce XML and consume XML, you are going to be able to pretty easily do transformations with XLINQ. With regards to schema validation, the XLINQ API doesn't currently have schema validation. We're looking into how to do it. If we do it, it will be an attribute of the underlying XLINQ API, and not something specific to the integrated XML in Visual Basic. On the other hand we are planning to provide Intellisense for the XML that you're trying to produce, and also, eventually, Intellisense for the XML that you're trying to read from. This won't be strong schema validation, but it will be guidance similar to what exists in the XML editor today, that will help you construct XML that conforms to an existing schema.

DDJ: But the important thing that I assume is that XLINQ will compose with the classes in the System.XML namespace. You may not build schema support right into XLINQ, but you'll still be able to use the schema support that's already in System.XML on the XML that you generate with XLINQ.

AS: Absolutely.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.