InfoQ

News

Does C# Need VB9's XML Literals?

Posted by Jonathan Allen on Mar 01, 2007

Community
.NET
Topics
Tags
Visual Basic.NET ,
LINQ ,
C# ,
XML

Microsoft’s two flagship languages, C# and VB, are set to diverge even more in the next release. One of the major features C# is not getting is XML Literals, and not everyone is happy about that.

Despite the fact that XML Literals were originally designed for C-Omega, the C# team decided to not support them because they didn’t want to “tie the C# language with another specific language/structure”.

The VB team, on the other hand, is betting heavily on deep XML support. Paul Vick summarized the C# teams concerns back in September of 2005:

1. It is extremely risky to put some portion of your language design in the hands of another language design team. In other words, if VB integrates XML as it stands today into our language, what happens in the future as the XML standard continues to evolve? What we do today may be sufficient and there may not be any demand for adding any further features the XML standard may add. But maybe not. And those features will not necessarily have been designed with an eye towards whether they’ll work well in VB. Heaven knows we’re going to have enough issues shoehorning XML into the language, what happens if we hit some really sticky issue in the future? What if XML heads in a direction we’re not willing or able to go in?

2. It is extremely risky to tie yourself explicitly to a technology that may or may not be here 15 years from now. Right now, XML is king. But what happens if some other technology comes along and knocks it off its perch? What if things radically shift in some other direction and XML suddenly becomes a side track instead of the main line?

Paul, the Technical Lead for Visual Basic, also gives some of the reasons why VB choose to support XML Literals despite these objections.

Like so many things in life, it’s all about tradeoffs. The C# team looks at the problem and says, “It’s more important to us that we design a language that is as minimal as possible and whose pieces are guaranteed (as much as anything ever is) to retain relevance for the forseeable future. Therefore, we’re willing to sacrifice some usability and some programmer speed to ensure this goal is reached.” Perfectly valid. The VB team, on the other hand, looks at the problem and says, “It’s more important to use that we design a language that allows people to solve the problems that are confronting them today in as simple and straightforward manner as possible. Therefore, we’re willing to take the chance that some feature that is fantastically useful right now may lose relevance in the future and perhaps even become almost entirely useless (c.f. Gosub, On … Goto, Open/Close, etc.).” Also perfectly valid.

Currently, the top search result for “VB 9  XML literals” is developer Steve Eichert post, XLinq has me wanting to code in VB.NET?!?! :

Ever since I started programming in .NET land I’ve been a C# bigot.  The syntax jives with my brain.  When I come across code samples presented in both VB.NET and C# I gloss over the VB.NET code in all it’s verbosity and jump directly to the real code (C#)  .

I’ve semi-recently gotten to XLinq and it has me envying VB.NET programmers!  The Xml literal support within VB.NET is pretty sweet.

Microsoft’s XML Team has posted some of the more recent changes to VB’s XML Literals. These include changing the Attributes axis from an Attribute object to a String, a slight change to the syntax for importing XML namespaces, auto-completion of tags, and treating all XML names as symbols in a manner similar to CLR variables.

InfoQ Asks: Does C# Need VB9's XML Literals?

Does C# Need VB9's XML Literals? by Tomas Petricek Posted Mar 7, 2007 10:21 PM
  1. Back to top

    Does C# Need VB9's XML Literals?

    Mar 7, 2007 10:21 PM by Tomas Petricek

    I think it is goo that there is finally some difference between C# and VB (in the Orcas). C# is focusing more on being a language based on smaller set of general principles, great for writing bussines logic etc. while VB will be ideal for writing user interfaces (and similar) with advanced support for everything you need to put the application together as quickly and easily as possible.

    BTW: I think that XML literals in C-omega were more general than these in VB, beacuse they were used for initializing not only XML data, but also object structure. This concept is used in C# 3, but is realised using "object initializer" syntax.

    Tomas

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.