Xml Limitations
I just read a short article on ConciseXml. Some of the points made are very valid.
· Developers are incentivised to use short, abbreviated names because of the verbosity and bulk of Xml, sometimes reducing readability.
· Attributes and elements have no clear standards for appropriate use, resulting in ambiguity in structure and content.
In the following example, Color is both an object with child objects and a simple field of an object.
<food>
<item>
<id>yx324</id>
<food>chicken</color>
<cost>10</cost>
</item>
</food>
I don’t think this is necessarily a limitation of the Xml Standard! This is a shortcoming on the part of the author.
If the same data were represented as:
<foods>
<food id=”yx324” value=”chicken” cost=”10” />
</foods>
The data makes more sense to the reader and is less ambiguous. This piece of data now stands on its own as something. It’s apparent that foods is a collection of food items and each has an id value, a descriptive or title value and a cost.
at this point, I suggest you move on... the rest of this post is meandering observation but leads to this interesting concept
ConciseXml less verbose
Xml's purpose is to be self-describing. Some of the conventions described in the article violate that objective.
ConciseXML: <person "Mike" "Plusch"/>
in the above example, What is "Mike" and "Plusch" in the person node? Plusch could be a nickanme or a profession or an action.
XML 1.0: <person first="Mike" last="Plusch"/>
This syntax is obvious even out of context.
Xml as a programming language?
ConciseXml is a programming language. Now it begins to become clear. A new syntax to do the things we do everyday that merges data, presentation, logic… Is this a good idea? Do we really need another programming language? What is the objective in making xml more than mark up?
I think it is both inappropriate and misleading to even call this Xml. I don’t know yet whether it is an exciting technology or simply another new language that is designed to replace the syntax that people are used to. I love curly braces. I love parenthesis to separate and partition a multi-step equation. I was ecstatic to leave VB behind and pick up c#. Microsoft recognized that some of the common constructs for common programming concepts work really well. They created C# and did a fabulous job making it make perfect sense. Xml is the most intuitive way to represent data. Sometimes it isn’t so efficient but there are a million ways to deal with performance.
I don’t know Lisp but this looks a lot like Lisp to me. I do like some of the concepts that I read about. I like that a method is an object. It would be nice to be able to pass a method in C#.
Consider:
Class: “Animal”
Contains method: “Eat”
Which accepts parameters: “Animal” and “Digest” (Digest is an action)
In researching what C# can do, I found that a delegate can indeed be passed as a parameter! Passing a method is dicey… Leave the method where it is and pass the pointer.
// delegate declaration
delegate void MyDelegate(int i);
class Program
{
public static void Main()
TakesADelegate(new MyDelegate(DelegateFunction));
}
public static void TakesADelegate(MyDelegate SomeFunction)
SomeFunction(21);
public static void DelegateFunction(int i)
System.Console.WriteLine("Called by delegate with number: {0}.", i);
A delegate in C# allows you to pass methods of one class to objects of other classes that can call those methods.
See more on that here
In my brief introduction to ConciseXml, I learned of a few grievances developers have with modern languages and standards and was able to learn about an available mechanism in C# (passing a delegate to a method of a class as a parameter) and some basic good practices with Xml – choice of attribute or element usage.
This makes me want to indeed write a program in Lisp. I have repeatedly heard it improves a person’s overall perspective on programming.
If I have some time, I may well do that.
Remember Me
Theme design by Jelle Druyts
Pick a theme: BlogXP calmBlue Candid Blue dasBlog Discreet Blog Blue Elegante essence Just Html Mono Movable Radio Blue Movable Radio Heat orangeCream Portal Project84 Slate Sound Waves Tricoleur