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.菲德爾。