Allen Holub: Say No To XML (As Programming Language); I Agree李鹏飞赫鲁伯:说没有,以XML (可作为编程语言) ;我同意
Allen Holub (Author of Compiler Design in C and famous OO Guru) said: “XML is perhaps the worst programming language ever conceived.李鹏飞赫鲁伯(作者:编译器的设计在C和著名的面向对象大师)说: “ XML是,也许最严重的编程语言以往任何时候都的构想。 I’m not talking about XML as a data-description language, which was its original design.我不是在谈论XML作为一种数据描述语言,这是其原设计。 I’m talking about perverting XML for programming applications.我谈到贪赃枉法XML的编程应用。 It’s inappropriate to use XML as a scripting language (eg, ANT), a test-description language (eg, TestNG), an object-relational mapping language (eg, Hibernate, JDO), a control-flow language (eg, JSF), and so forth.它的不恰当使用XML作为一个脚本语言(例如,蚂蚁) ,试验描述语言(例如, testng ) , 1对象关系映射的语言(例如,休眠, JDO的) ,控制流语言(例如, jsf ) ,等等。 These sorts of XML “programs” are unreadable, unmaintainable, an order of magnitude larger than necessary, and audaciously inefficient at runtime.”这些各种各样的XML的“程序”是无法读取, unmaintainable ,一个量级大于必要的,而且audaciously效率低,在运行时“ 。 Link链接
He surmised that the tendency to use xml for these tasks is simply because people either don’t want to create a compiler or are inacapable of creating one.他推测,这种趋势使用XML为这些任务原因很简单,人不是不想创造一个编译或正在inacapable创造1 。 I agree with him.我同意他的。 Most of the time people use XML because it is easy to parse XML, so who cares how long it takes for people to create these xml documents in the first place.大部分的时间,人们使用XML ,因为它是很容易解析XML的,所以谁在乎需要多久才能为人民创造这些XML文件摆在首位。 Look at Hibernate for an example.看看Hibernate的一个例子。 It is XML hell.这是XML的地狱。 EJB 2 was another example.二是EJB的另一个例子。 Jelly was probably the worst example and I don’t like JSTL that much either.果冻可能是最坏的榜样,我不喜欢jstl那么多。
Then he goes on to define the basic qualifications of a programmer, he said something which is close to my heart:然后他接着界定的基本条件,一个程序员,他说,一些接近我的心:
“This list includes a deep understanding of data structures and key algorithms, a little math (set theory, logic, a little statistics), mastery of analysis-and-design techniques, both process (eg, RUP or XP) and structure (eg, design patterns), and database structure and use (eg, SQL). “这份名单包括深入了解数据结构和关键算法的一个小数学(集理论,逻辑,有点统计数字) ,掌握分析和设计技术,无论是过程(例如, RUP的或XP )和结构(如,设计模式) ,以及数据库结构和使用(例如,中, SQL ) 。 You also need to know how the hardware works.”您还需要知道如何硬件工程“ 。
Designing compilers is hard.编译器的设计是很难。 Today it is rare to see people designing compilers for their software.今天,这是难得见到的人设计的编译器为他们的软件。 They use XML or simple property files.他们使用XML或简单的财产档案。 Also, as he mentioned, it is hard to get books on compiler design.此外,正如他所说,这是很难找到的书籍,编译器的设计。 The best Java software to design compiler is最好的Java软件设计编译器 JavaCC javacc , which was by an ex-Sun employee, who later went on to found MetaMata in the dotcom boom era. ,这是由一个前孙雇员,谁后,接着就发现metamata ,在dotcom繁荣的时代。
He misses one vital point.他错过了一个重要的一点。 Somewhere down the road it has unfortunately become a marketing bullet point to mention that your software uses XML for configuration.某处下跌的道路,它已不幸地成为一个营销子弹点,更何况您的软件使用XML配置。
Filed under提起下 Headline News头条新闻 , , Java Software Java软件 , , Open Source Software开放源码软件 , , Technology技术 | |
| |
RSS 2.0 2.0 | |
Trackback Trackback跟踪 this Article |此文章|
Email this Article电子邮件此文章
You may also like to read您也可以想读 |




September 27th, 2006 at 6:25 am 2006年9月27日在上午06时25分
Some geeks fantasize about being with hot and sexy girls, only to come home and meet the wife (if they have any) who is far from hot and sexy.一些同好幻想正在与热和性感女孩中,只有来家和满足的妻子(如果他们有任何)谁是远离热和性感。 That, my friend, is reality. ,我的朋友,是现实。
Allen Holub lives in a fantasy world.李鹏飞赫鲁伯生活在一个幻想世界。 In reality, there’s always deadlines to meet, profit to achieve.在现实中,总会有机会的最后期限,以满足,利润达到的目标。
September 27th, 2006 at 7:14 am 2006年9月27日在上午07时14分
Wouldn’t it be more profitable in the long run to make your application easier to use, unless you also offer paid professional support services?不会是更有利可图的,在长远而言,使您的应用程序更容易使用,除非你也提供支付的专业支援服务?
Creating compilers is hard for us but creating xml files aren’t easy for end-users.创造编译我们是很难,但创造的XML文件是不容易为最终用户。
In my experience most of them are comfortable with Excel documents, complex xml is beyond them (obviously with exceptions).在我的经验,他们大多是舒适与Excel文件的,复杂的XML是超越他们(明显的例外) 。
The downside of compilers is that they are not only harder to create but also harder for others to consume, unless you provide them with a parser too.坏处编译的是,他们不仅加倍努力,创造,但也更难为他人消费,除非你为他们提供一个解析器。 We do however need a better solution than xml, especially for simple formats.我们这样做,但需要一个更好的解决办法比XML的,尤其是一些简单的格式。
September 27th, 2006 at 10:07 am 2006年9月27日在上午10时07分
I got tired of doing “XML push-ups.” So I’m trying to focus my new development efforts on Ruby on Rails.我厌倦了做“的XML俯卧撑。 ”因此,我试图把重点放在我的新发展,努力对红宝石对导轨上。 XML? XML的呢? There is none.是没有的。 Just YAML for configuration of database.刚才yaml配置数据库。 Very nice!非常好的!
September 27th, 2006 at 10:29 pm 2006年9月27日在下午10时29分
Yeah, maybe… Except a bad example (ok, problem with Ant, yeah, but it’s not like make is so easy to use, please, tabs, and spaces o my), and plugging his book with all the subtlety of a sledgehammer wasn’t too cool是啊,也许…除一个坏榜样(确定,问题与蚂蚁,是啊,但它不像是那么容易使用,请,制表符,空格和我的) ,以及堵他的著作的所有微妙1大锤不太冷静
September 29th, 2006 at 12:32 am 2006年9月29日在上午12时32分
I had read his book - “Compiler Design in C” and I think it is of very high quality.我曾看过他的著作-“编译器的设计在C ”和我想这是非常高的质量。 So even if he is plugging his book, I think it is a good plug.因此,即使他是堵他的著作,我认为这是一个好的插件。
Also everyone has their natural tendencies.此外,每个人都有其自然的倾向。 A compiler designer sees everything as a compiler design problem, a OO designer sees the world as object oriented and so on.编译器设计师看到的一切作为一个编译器的设计问题,面向对象的设计师认为,世界的面向对象等。 Beyond all that I still see lots of merit in his arguments against ubiquitous use of XML as programming language.超越所有我仍然看到了很多好处,在他的论据,反对无处不在使用XML作为编程语言。
March 5th, 2007 at 8:39 am 2007年3月5日在上午8时39分
I think, the author exaggerates a little.我认为,作者夸大了一点。
It is good that there is a simple format of configuration files.它是好的,是有一个简单的格式的配置文件。 XML is maybe verbose, but it is easy to learn. XML是可能详细,但它是简单易学。 And if everyone created a new format for each application, we would have to learn much more and it would take much more time.如果每个人都创造了一种新的格式,每宗申请的,我们将要学习更多的,它会采取更多的时间。 Do you remember sendmail configuration files?你还记得Sendmail的配置文件?
March 7th, 2007 at 11:00 am 2007年3月7日上午11:00
Yes, I do remember sendmail as well as the make files是的,我不记得了sendmail ,以及为使档案
I think xml for plain configuration is ok but not as a programming language.我认为XML的平原配置是确定而不是作为一种编程语言。 Ant is a case where xml is used as a programming language.蚂蚁是一种情况下, XML是用来作为一种编程语言。
January 4th, 2008 at 4:25 am 2008年1月4日在上午04时25分
I have often seen people creating programming languages using XML.我常常看到有人创造的编程语言使用XML 。 I think that XML was not meant for that and does not suit that purpose.我认为, XML的并不意味着为和不适合这一目的。 Prove of that is XUL, Flex MXML or even XForms, that end up using Actionscript or Javascript to do the business logic.证明这是这里,弯曲mxml或什至XForms的,即最终使用的ActionScript或JavaScript这样做的业务逻辑。 They use the XML part to layout the components and Actionscript or Javascript to do the serious work.他们使用XML的一部分,布局的组成部分和ActionScript或JavaScript这样做严肃的工作。 These make sense, because when we are creating the forms, we are marking (or laying) our UI components.这些道理,因为当我们正在创造的形式,我们的标记(或敷设)我们的UI组件。
When I started playing with XML, I thought it was going to be a solution for writing quick languages.当我开始玩的XML ,我还以为这是要解决写作快速的语言。 But, I came to the conclusion that XML is what it is: a markup language.但是,我得出的结论是, XML是什么,它是:一种标记语言。 And it can be used for document design and for data design as well.它可用于文件的设计和数据的设计,以及。 As for complex programming languages, I stick to writing compilers for them.至于复杂的编程语言,我坚持写作编译为他们。 The language becomes so much cleaner than XML.语言成为了这么多清洁比的XML 。
Now, as for compiler writing being a hard, I just answer \\\”when people don\\\’t know how to use something, they always say it is difficult\\\”现在,对于编译器作为一个写作的努力,我只是回答\ \ \ “当人们不要\ \ \ '吨知道如何使用的东西,他们总是说这是困难的\ \ \ ”
It is not like in the old days whereby you would need loads of programmers to write a compiler.这是不喜欢在旧天,让您将需要大量的程序员来写编译器。 Today, a single programmer can put together a compiler, using current compiler frameworks, in a month.今天,一个单一的程式设计师可以放在一起编译器,利用现有的编译器框架,在一个月内。
Nowadays, you don\\\’t have to write parsers by hand.现在,您不\ \ \ '吨有写解析器手。 You can put together a parser for a configuration file in a day or two.你可以把一个解析器的配置文件在一或两天。
Compiler writing was, in the old days, very laborious.编译器写作,在旧天,非常辛苦。 Not anymore, because you have many frameworks that do half of the work for you.没有了,因为你有很多的框架,做一半的为您工作。 For instance, with JavaCC you can generate the lexer, the parser, the Abstract Syntax Tree using JJTree.举例来说,与javacc您可以产生lexer ,分析器,抽象语法树的使用jjtree 。 And then, you just have write the semantic analyser, intermediate code generator, code optimizer and the code generator.然后,你刚才写的语义分析,中间代码生成,代码优化和代码生成器。 But, that is very simple to do.但是,这是很简单的事。 It is similar to traversing XML nodes.这是类似遍历XML节点。 I usually see it that way.我通常会看到这样说。
Finally, I would like to mention that there is a compiler framework called SableCC, which is very easy to use.最后,我想提的是有一个编译器框架,所谓的sablecc ,这是非常容易使用。 There is also an alternative based on SableCC, which allows us to write backend generators for other languages.也有另一种的基础上sablecc ,让我们写后端发电机,为其他语文。 I have written two backend generators: one for Python and one Actionscript.我已经写了两后端发电机:一为Python和1的ActionScript 。 The Python one is in the public domain.的Python ,一个是在公共领域。 The Actionscript one is still being used internally in my company.动作之一,现仍被用于内部在我的公司。 But will, eventually, be released to the public domain.但会,最终公布的网域。 We used the Actionscript backend to write a SPARQL parser for Adobe Flex, and to write a compiler for a programming language based on Daplex.我们使用的ActionScript后端写一sparql分析器为Adobe flex的,并写编译器为一种编程语言的基础上daplex 。 Well, we call it a framework, because it does more than generating database code.那么,我们称之为一个框架,因为它以上的发电数据库代码。 It generates web applications that target PHP, Java, C# with either Ajax or Adobe Flex front ends.它生成的Web应用程序的目标, PHP中,爪哇, C #中无论是阿贾克斯或Adobe flex的前端。
Anyway, that is my two cents.无论如何,这是我的2美分。
All the best,所有最好的,
Fidel.菲德尔。