Today me and some colleges were discussing random stuff as usual, somewhere in the middle someone said something about XML, I yawn (as always) and a discussion started about my XML hate relationship.
When I learnt XML (2 or 3 years ago) I loved it, it was easy to understand, very declarative and readable. But back in those days I knew nothing about the computer world, I only knew java and C, I didn’t knew what the hell was design patterns, code conventions, pretty code, etc.
When I learnt JSON I didn’t really understand its purpose so it was one more way to send data from one place to another.
Today I’ve a different view on how code and information should look like: namely, simple, concise, easy to read and the most important should be easy to write (low on chars). This last characteristic is probably the most important since its less memory used to save the data or less bandwidth used to exchange data, etc.
At first JSON seems perfect, it’s much more readable than XML and more compact. Then there is the underground MGraph by Microsoft with a really appealing syntax and is more compact than JSON, the problem is its inventor, Microsoft. The hardcore open-source community would never accept using something made by Microsoft so an overall usage would be automatically denied. Finally there is the YAML, my shame in all of this, since until today I never tried to found out what it was.
Let’s see it first, YAML version:
Name: Web Programming
- Student: Student A
- Student: Student B
The XML version;
<Course Name="Web Programming" Year="2011">
<Teacher> ATeacher </Teacher>
<Grade Value = "17"> Student A</Grade>
<Grade Value = "18"> Student B</Grade>
Is it really necessary more comments? No, I fell in love with this new way to show data. Maybe I’m going to make a blog series on this, seems a really nice thing.
YAML have all the characteristics that I enumerated before, people will say that XML will always be here, because things like HTML, config files and schema support. The question is, isn’t XML a bit outdated? Its syntax didn’t get better or evolve with the technology, it’s pretty much the same thing that SGML (invented in the 60s), are we too accommodated with XML? Since when did the computer world stop searching for the best next thing? Think on it.
YAML official site
MGraph the next xml