XML.NET vs. VB.NET - an imaginary language
Hard on the developer, easy on the compiler! Introducing a really stupid and imaginary new .NET language: XML.NET! It's all based on XML, increasing the number of characters you have to type and decreasing flexibility, readability, and performance. Enjoy!
XML.NET code:
Code:
<project name="Demo Project" namespace="DemoProject" startup="DemoProject.Form1" />
<class name="Form1" partial="true" inherits="System.Windows.Forms.Form">
##DESIGN XML
<property name="Text" value="XML.NET Demo Project" />
<property name="MaximizeBox" value="true" />
<control type="System.Windows.Forms.Label" name="lblHello" modifiers="private">
<property name="Text" value="Hello, XML.NET world!" />
</control>
##END DESIGN
</class>
<class name="Form1" access="Public">
<method name="SayHello" return="null">
<param name="from" pass="byval" type="System.String" />
<run>
<define variable="v" type="System.String" value="<%= System.String.Empty %>" />
<assign value="<%=from%>" to="v" cast="none" /><!-- other available options for cast are "unbox" and "convert". -->
<if assertion="equality" op1="<%=v->toLower()%>" op2="this language">
<assign from="XML.NET" to="v" />
<else>
<!-- do nothing -->
</else>
</if>
<call method="System.Windows.Forms.MessageBox.Show" message="Hello from <%=v%>!" title="Hello, world" icon="<%=System.Windows.Forms.MessageBoxIcon.Information%>" />
</run>
</method>
<method name="lblHello_Click" return="null" handles="this.lblHello.Click">
<param name="sender" pass="byval" type="System.Object" />
<param name="e" pass="byval" type="System.EventArgs" />
<run>
<call method="this.SayHello" from="this language" />
<call method="this.Close" />
</run>
</method>
</class>
Equivalent VB.NET code:
vb.net Code:
Public Class Form1
Private WithEvents lblHello As New Label() With { .Text = "Hello, VB.NET world!" }
Public Sub New()
Me.Text = "VB.NET Demo Project"
Me.MaximizeBox = False
Me.Controls.Add(lblHello)
End Sub
Private Sub lblHello_Click(ByVal sender As Object, ByVal e As EventArgs) Handles lblHello.Click
SayHello("this language")
Me.Close()
End Sub
Private Sub SayHello(ByVal [from] As String)
Dim v As String = [from]
If v = "this language" Then
v = "VB.NET"
Else
'Do nothing.
End If
MessageBox.Show("Hello from " & v & "!","Hello, world",MessageBoxButtons.OK,MessageBoxIcon.Information)
End Sub
End Class
:D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D
21 lines (vb.net) VS 36 long lines (xml.net).
So, what's your vote? Which one is better?
Re: XML.NET vs. VB.NET - an imaginary language
Don't joke. There actually are languages just like that. XSL comes to mind. http://www.vbforums.com/
Re: XML.NET vs. VB.NET - an imaginary language
XML Schema, Schematron. Some templating languages.
Re: XML.NET vs. VB.NET - an imaginary language
Re: XML.NET vs. VB.NET - an imaginary language
Re: XML.NET vs. VB.NET - an imaginary language
XML.NET makes VB.NET look like C#.
Re: XML.NET vs. VB.NET - an imaginary language
Re: XML.NET vs. VB.NET - an imaginary language
........ Xaml anyone? and its actually pretty nice to use.
Re: XML.NET vs. VB.NET - an imaginary language
Isn't XAML more design-time things and visual effects?
Re: XML.NET vs. VB.NET - an imaginary language
Yep, designed for better separation between the designing and coding aspects of development. I personally believe it may be the best thing that microsoft has ever come out with for .Net.
That and the new parallelism.
Re: XML.NET vs. VB.NET - an imaginary language
Parallelism? I'm now going to Google that for .NET.
Re: XML.NET vs. VB.NET - an imaginary language
Re: XML.NET vs. VB.NET - an imaginary language
I can teach you the Parallelism in 5 seconds.
Replace for with Parallel.For
Replace foreach with Parallel.ForEach.
Done! That'll be $5.
Re: XML.NET vs. VB.NET - an imaginary language
Blindly apply to all existing code, then marvel as applications crash and populate the screen with errors you've never heard of.
Re: XML.NET vs. VB.NET - an imaginary language
Re: XML.NET vs. VB.NET - an imaginary language
Really?!! I thought parallel_for and others were only available for C++!