你讨厌 XML 吗?(2010)
Do you hate XML? (2010)

原始链接: https://sigfrid-lundberg.se/entries/2010/07/hate_xml/

在过去的十五年里,作者对 XML 的态度已从最初的热衷推崇转变为更务实、更成熟的视角。回顾 21 世纪初的“XML 热潮”及其随后的抵触情绪(常被表达为“仇恨”),作者将技术关系比作人际关系:从最初的迷恋,转变为对工具优缺点及其内在复杂性更深层、更细致的理解。 针对开发者对于掌握 XML 专业生态系统难度较大的抱怨,作者指出,这些挑战并非 XML 所独有。任何数据建模任务,无论是使用 SQL 还是其他格式,都要求开发者成为领域专家。归根结底,作者认为用来描述技术的感性语言——“爱”或“恨”——往往是表演性或隐喻性的,其作用更像是个人对音乐的品味,而非真正的喜爱或敌意。尽管作者承认冗长语法带来的困扰,但他坚持认为,XML 依然是实现互操作性的重要工具,即便数据最终存储在关系型数据库中,它仍是标准的传输格式。

这条 Hacker News 讨论帖探讨了围绕 XML 的持久争议。参与者普遍认为,虽然 XML 常因其冗长和外观“丑陋”而受诟病,但很多不满源于 2000 年代对其过度工程化的应用,例如繁琐的 SOAP 协议。 批评者认为,XML 不适合简单的数据表示,因为它本质上是一种标记语言,而非数据序列化格式,这使得开发者在处理时不得不面对比 JSON 或 YAML 更复杂的抽象语法树(AST)。 相反,支持者则强调,JSON 和 YAML 缺乏使 XML 强大的高级“元”特性,特别是命名空间、健壮的模式定义以及 XSLT 和 XPath 等强大的转换工具。多位贡献者指出,尽管 JSON 因易用性已成为行业标准,但它缺乏 XML 那样的结构严谨性。归根结底,舆论倾向于认为,XML 的衰落与其说是格式本身的技术失败,不如说是行业转向了更简单、尽管功能较少替代方案的结果,这导致现代开发者不得不以效率较低的方式去重新实现 XML 所缺失的功能。
相关文章

原文

I've spent much of the last fifteen years working on problems related to interoperability, portability and longevity of data, and in particular metadata in a library context. During these years I've been working a lot with XML.

Early on I evangelized about XML with the fervour of a taleban. I suppose that I contributed to the four or five years of XML hype that started at the turn of the century and culminated 2004 - 2005 (cf. Figure 1, and Edd Dumbill's How Do I Hate Thee?). Since then I've become more moderate, but still embrace XML as the preferred tool for the modeling of data.

Hate XML web pages

Figure 1. The number of web pages appearing per year containing the phrase hate XML. There is a steep increase in occurrence a few year after the Applied XML Developer's Conference 2004. After that it seems to level off.

The data points represents hits pooled for two year periods graphed against the first of January the second year in each period.

Because of the way Google works, the date searches mostly hits blog entries and other syndicated material, where publication date and other metadata are known. The earliest occurrence is from 2001.

Once you have grasped a technology you cannot keep up strong emotions, at least not positive ones. You see both the shortcomings and the advantages. Possibly you can become more negative as time goes by. Or that is my personal experience. I think that our relations to our technologies is a bit like human relations. There is an early period when you fall in love. Then if you're lucky there is a long period of friendship and love of another deeper kind that may last much longer.

Already year 2000 a friend of mine described his relation to XML as angle bracket fatigue, which I suppose is to be understood as I hate typing XML, since its syntax is just terrible.

Search interest for "hate xml" in Google 2004-2010

Figure 2. Search interest in Google for the term hate XML. There are hardly any connection between the change in occurrence of the hate XML-emotions and search interest. People seem search for the term a few years after they wrote about it.

Developers hate XML

Year 2004, sellsbrothers.com convened an Applied XML Developer's Conference. I cannot recollect that I heard of that conference at the time, but there was one contribution which got quite some attention around in the blogosphere. It was by Chris Anderson (AKA SimpleGeek) who gave the presentation Developers Hate XML. I haven't found the slides on the net. However, Jeff Barr summarizes as follows

Chris’s big beef with XML is that XML must be processed in isolation, using special purpose tools and languages such as XSLT. In order to use these special things, developers must become domain experts [my emphasis] in a rich and complex space that is essentially unrelated to the application itself.

I think Chris (and Jeff) points out something important here. Many developers are interested in programming and computing, but not necessarily application areas. To parse and make something meaningful out of, say, bibliographical records or encoded text requires that you are actually interested in those areas. The same is true for fluid mechanics and natural language processing. Interest in partial differential equations and linguistics, respectively, will help.

I cannot see any difference here between XML and SQL in this respect. Any tools for object-relational modeling is subject to the same problems. The developers that do the modeling has to become domain experts. This is fairly obvious for XML and less so for SQL. While few people form large scale standardization efforts for XML schemas, they hardly do so for RDBMS Schemas.

What XML technologies provide that RDBMSs don't is an interoperable transfer syntax. Which I suppose is the reason why most XML in the world is stored in, well, RDBMSs.

On hatred

I cannot recall that I've ever written somewhere that I hate someone or even something. I feel that hatred is emotional and irrational. It may be a difference between languages and cultures, though; it can also be a question of semantic inflation.

When we Scandinavians say that we hate something, we mean it. I'm not sure that that's the case in the Anglo-American sphere, and I'm not even certain that's the case for young Scandinavians. However, when you're a middle-aged academic and intellectual, you may not think it's appropriate to hate. Or, at least, you may not think that it's appropriate to describe your dislikes and annoyances as hatred.

I have tried, a lot, to find out what people think about technologies such as XML, SQL, noSQL etc. Here both love and hatred are used as code words. People hate (or love) XML the same way they love (or hate) bebop, pop or hip hop music. Not the way they love their children, wife or mother.

联系我们 contact @ memedata.com