home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / introduction.xml < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  13.9 KB  |  498 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17. <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "document-v10.dtd">
  18.  
  19. <document>
  20.  
  21.   <header>
  22.     <title>Introducing Cocoon</title>
  23.     <authors>
  24.       <person name="Stefano Mazzocchi" email="stefano@apache.org"/>
  25.     </authors>
  26.   </header>
  27.  
  28.   <body>
  29.  
  30.     <s1 title="The XML Hype">
  31.  
  32. <p>
  33. Everybody talks about XML. XML here, XML there. All application servers
  34. support XML, everybody wants to do B2B using XML, web services using
  35. XML, even databases using XML.
  36. </p>
  37.  
  38. <p>
  39. Should you care about it? Given the amount of hype, you can't afford to
  40. go around ignoring XML, for that would be like ignoring the World Wide
  41. Web 10 years ago: a clear mistake. But why is this so for XML? What is
  42. this "magic" that XML seems to have in solving your problems? Isn't this
  43. another hype to change once again the IT infrastructure that you spent
  44. so much time implementing and fixing in the last few years? Isn't
  45. another way to spill money out of your pockets?
  46. </p>
  47.  
  48. <p>
  49. If you ever asked yourself one of the above questions, this paper is for
  50. you. You won't find singing-and-dancing marketing hype, you won't find
  51. boring and useless feature lists, you won't find the usual acronym
  52. bombing or those good looking vaporware schemas that connect your
  53. databases to your coffee machines via CORBA or stuff like that.
  54. </p>
  55.  
  56. <p>
  57. This document will explain you what the Cocoon project is about and what we are
  58. doing to solve the problems that we encountered in our web engineering
  59. experiences, but from an executive perspective, yes, because we all had
  60. the problems of managing a web site, dealing with our colleagues, rushing
  61. to the graphical guru to have the little GIF with the new title, or
  62. calling the web administrator at night because the database is returning
  63. errors without reasons.
  64. </p>
  65.  
  66. <p>
  67. It was frustrating to see the best and most clever information
  68. technology ever invented--the Web--ruined by the lack of engineering
  69. practices, tortured by those "let's-reinvent-the-wheel-once-again"
  70. craftsmen who were great at doing their jobs as individuals but
  71. could not scale within teams, imposing a growth saturation to their projects.
  72. </p>
  73.  
  74. <p>
  75. There had to be a better way of doing things.
  76. </p>
  77.  
  78.     </s1>
  79.  
  80.  
  81.     <s1 title="Personal Experiences">
  82.  
  83. <p>
  84. In 1998, Stefano Mazzocchi volunteered to create the documentation infrastructure for
  85. the java.apache.org project, which is composed of a bunch of different
  86. codebases, maintained by a bunch of different people, with different
  87. skills, different geographical locations and different degree of will
  88. and time to dedicate to the documentation effort.
  89. </p>
  90.  
  91. <p>
  92. But pretty soon he realized that no matter how great and well designed the
  93. system was, HTML was a problem: it was *not* designed for those kinds of
  94. things. By looking at the main page (<link href="http://java.apache.org/">http://java.apache.org/</link>) from the
  95. browser, you can clearly identify the areas of the screen: sidebar,
  96. topbar, news, status. But if you viewed the underlying HTML, boom: a nightmare of
  97. table tags and nesting and small little tricks to make the HTML appear
  98. the same on every browser.
  99. </p>
  100.  
  101. <p>
  102. So he looked around for alternative technologies, but *all* of them were
  103. trying to add more complexity at the GUI level (Microsoft Frontpage,
  104. Macromedia Dreamweaver, Adobe GoLive, etc...) hoping to "hide" the
  105. design problems of HTML under a thick layer of WYSIWYG looks.
  106. </p>
  107.  
  108. <p>
  109. What you see is what you get.
  110. </p>
  111.  
  112. <p>
  113. But what you see is all you've got.
  114. </p>
  115.  
  116. <p>
  117. How can you tell your web server to extract the information contained within the
  118. sidebar? How can you tell it to find the news articles within a complex HTML page?
  119. </p>
  120.  
  121. <p>
  122. It's certainly easy for a human reader: just look at the page and you should have
  123. no problem distinguishing between a sidebar, a banner, a news and a stock
  124. quote. Why is it so hard for a machine?
  125. </p>
  126.  
  127.     </s1>
  128.  
  129.     <s1 title="The HTML Model">
  130.  
  131. <p>
  132. HTML is a language that tells your browser how to "draw" things on its
  133. window. An image here, a letter there, a color down here. Nothing more.
  134. The browser doesn't have the "higher level" notion of "sidebar": it
  135. lacks the ability to perform "semantic analysis" of the HTML content.
  136. </p>
  137.  
  138. <p>
  139. Semantic analysis? Yeah, it's the kind of thing the human brain is
  140. simply great at doing, while computer programs simply fail at big time.
  141. </p>
  142.  
  143. <p>
  144. So, with HTML, we went a step up and created a highly visual and
  145. appealing web of HTML content, but we went two steps back by removing
  146. all the higher level semantic information from the content itself.
  147. </p>
  148.  
  149. <p>
  150. Ok, let's make an example...  most of you have seen an HTML
  151. page... if not, here is an example:
  152. </p>
  153.  
  154. <source><![CDATA[
  155.  <html>
  156.   <body>
  157.    <p>Hi, I'm an HTML page</p>
  158.    <p align="center">Written by Stefano</p>
  159.   </body>
  160.  </html>
  161. ]]></source>
  162.  
  163. <p>
  164. which says to the browser:
  165. </p>
  166.  
  167. <ul>
  168.  <li>I'm a HTML page</li>
  169.  <li>I have a body</li>
  170.  <li>I have a paragraph</li>
  171.  <li>I contain the sentence "Hi, I'm an HTML page."</li>
  172.  <li>I contain the sentence "Written by Stefano"</li>
  173. </ul>
  174.  
  175. <p>
  176. Suppose you are a Chinese guy that doesn't understand our alphabet, try
  177. to answer the following question:
  178. </p>
  179.  
  180. <p>
  181. Who wrote the page?
  182. </p>
  183.  
  184. <p>
  185. You can't perform semantic analysis, you are as blind as a web browser.
  186. The only thing you can do is draw it on the screen since this is what
  187. you were programmed to do. In other words, your semantic capacity is
  188. fixed to the drawing capabilities and a few other things (like linking),
  189. thus limited.
  190. </p>
  191.  
  192.     </s1>
  193.  
  194.     <s1 title="Semantic Markup">
  195.  
  196. <p>
  197. Suppose you receive this page:
  198. </p>
  199.  
  200. <source><![CDATA[
  201.  <page>
  202.   <author>sflkjoiuer</author>
  203.   <content>
  204.    <para>sofikdjflksj</para>
  205.   </content>
  206.  </page>
  207. ]]></source>
  208.  
  209. <p>
  210. Can you now tell me who wrote the page? Easy, you say, "sflkjoiuer" did. Good, but later
  211. you receive:
  212. </p>
  213.  
  214. <source><![CDATA[
  215.  <dlkj>
  216.   <ruijfl>sofikdjflksj</ruijfl>
  217.   <wijlkjf>
  218.     <oamkfkj>sflkjoiuer</oamkfkj>
  219.   </wijlkjf>
  220.  </dlkj>
  221. ]]></source>
  222.  
  223. <p>
  224. Now, who wrote the page? You could guess by comparing the structure,
  225. but how do you know the two structures reflect the same semantic
  226. information?
  227. </p>
  228.  
  229. <p>
  230. The above two pages are both XML documents.
  231. </p>
  232.  
  233. <p>
  234. Are they going to help you? Are they doing to simplify your work? Are
  235. they going to simplify your problems?
  236. </p>
  237.  
  238. <p>
  239. At this point, clearly not, rather the opposite.
  240. </p>
  241.  
  242. <p>
  243. So, you could be wondering, why did we spend so much effort to 
  244. write an XML publishing framework? This document was written exactly
  245. to clear your doubts on this, so let's keep going.
  246. </p>
  247.  
  248.  
  249.     </s1>
  250.  
  251.     <s1 title="The XML Language">
  252.  
  253. <p>
  254. XML is most of the times referred to as the "eXtensible Markup Language"
  255. specification. A fairly small yet complex specification that indicates
  256. how to write languages. It's a syntax. To tell you the truth, nothing fancy at all. So
  257. </p>
  258.  
  259. <source><![CDATA[
  260.  <hello></hello>
  261. ]]></source>
  262.  
  263. <p>
  264. is correct, while
  265. </p>
  266.  
  267. <source><![CDATA[
  268.  <hello></hi>
  269. ]]></source>
  270.  
  271. <p>
  272. is not, but
  273. </p>
  274.  
  275. <source><![CDATA[
  276.  <hello><hi/></hello>
  277. ]]></source>
  278.  
  279. <p>
  280. is correct. That's more than this, but I'll skip the technical details here.
  281. </p>
  282.  
  283. <p>
  284. XML is the ASCII for the new millenium, it's a step forward from ASCII
  285. or UNICODE (the international extension to ASCII that includes all
  286. characters from all modern languages). It defines a "lingua franca" for
  287. textual languages.
  288. </p>
  289.  
  290. <p>
  291. Ok, great, so now instead of having one uniform language with visual
  292. semantics (HTML) we have a babel of languages each with its own
  293. semantics. How this can possibly help you?
  294. </p>
  295.  
  296.     </s1>
  297.  
  298.     <s1 title="XML Transformations">
  299.  
  300. <p>
  301. This was the point where Stefano was more or less two years ago for
  302. java.apache.org: I could use XML and define my own semantics with
  303. <![CDATA[<sidebar>]]>, <![CDATA[<news>]]>, <![CDATA[<status>]]> 
  304. and all that and I'm sure people would have
  305. found those XML documents much easier to write (since the XML syntax is
  306. very similar to the HTML one and very user friendly)... but I would have
  307. moved from "all browsers" to "no browser".
  308. </p>
  309.  
  310. <p>
  311. And having documentation that nobody can browse is totally useless.
  312. </p>
  313.  
  314. <p>
  315. The turning point was the creation of the XSL specification which
  316. included a way to "transform" an XML page into something else. (It's
  317. more complex than this, but, again, I'll skip the technical details).
  318. </p>
  319.  
  320. <p>
  321. So now you have:
  322. </p>
  323.  
  324. <source><![CDATA[
  325.  XML page ---(transformation)--> HTML page
  326.                     ^
  327.                     |
  328.           transformation rules
  329. ]]></source>
  330.  
  331. <p>
  332. that allows you to write your pages in XML, create your "graphics" as
  333. transformation rules and generate HTML pages on the fly directly from your
  334. web server.
  335. </p>
  336.  
  337. <p>
  338. Apache Cocoon 1.0 did exactly this.
  339. </p>
  340.  
  341.     </s1>
  342.  
  343.     <s1 title="The Model Evolves">
  344.  
  345. <p>
  346. If XML is a lingua franca, it means that XML software can work on almost
  347. anything without caring about what it is. So, if a cell phone requests
  348. the page, Cocoon just has to change transformation rules and send the
  349. WAP page to the phone. Or, if you want a nice PDF to printout your
  350. monthly report, you change the transformation rules and Cocoon creates
  351. the PDF for you, or the VRML, or the VoiceML, or your own proprietary
  352. B2B markup.
  353. </p>
  354.  
  355. <p>
  356. Anything without changing the basic architecture that is simply based on
  357. the simple "angle bracket" XML syntax.
  358. </p>
  359.  
  360.     </s1>
  361.  
  362.     <s1 title="Separation of Concerns (SoC)">
  363.  
  364. <p>
  365. Cocoon was not the first product to perform server side XML
  366. transformations, nor will be the last one (in a few years, these
  367. solutions will be the rule rather than the exception). So, what is the
  368. "plus" that the Cocoon project adds?
  369. </p>
  370.  
  371. <p>
  372. We believe the single most important Cocoon innovation is SoC-based design.
  373. </p>
  374.  
  375. <p>
  376. SoC is something that you've always been aware of: not everybody is
  377. equal, not everybody performs the same job with the same ability.
  378. </p>
  379.  
  380. <p>
  381. It can be observed that separating people with common skills in
  382. different working groups increases productivity and reduces management
  383. costs, but only if the groups do not overlap and have clear "contracts"
  384. that define their operability and their concerns.
  385. </p>
  386.  
  387. <p>
  388. For a web publishing system, the Cocoon project uses what we call the
  389. <em>pyramid of contracts</em> which outlines four major concern areas and five
  390. contracts between them. Here is the picture:
  391. </p>
  392.  
  393. <figure src="images/pyramid-model.gif"
  394.         alt="The Cocoon Pyramid Model of Contracts"
  395.         width="313" height="159"/>
  396.  
  397. <p>
  398. Cocoon is <em>engineered</em> to provide you a way to isolate these four
  399. concern areas using just those 5 contracts, removing the contract
  400. between style and logic that has been bugging web site development since
  401. the beginning of the Web.
  402. </p>
  403.  
  404. <p>
  405. Why? because programmers and graphic people have very different skills
  406. and work habits... so, instead of creating GUIs to hide the things that
  407. can be harmful (like graphic to programmers or logic to designers),
  408. Cocoon allows you to separate the things into different files, allowing
  409. you to "seal" your working groups into separate virtual rooms connected
  410. with the other rooms only by those "pipes" (the contracts), that you
  411. give them from the management area.
  412. </p>
  413.  
  414. <p>
  415. Let's have an example:
  416. </p>
  417.  
  418. <source><![CDATA[
  419.  <page>
  420.   <content>
  421.    <para>Today is <dynamic:today/></para>
  422.   </content>
  423.  </page>
  424. ]]></source>
  425.  
  426.       <p>
  427.     is written by the content writers and you give them the
  428.     "contract" that states that the tag
  429.     <![CDATA[<dynamic:today/>]]> prints out the time of the day
  430.     when included in the page. Content writers don't care (nor
  431.     should) about what language has been used for that, nor they
  432.     can mess up with the programming logic that generates the
  433.     content since it's stored in another part of the system they
  434.     don't have access to.
  435.       </p>
  436.  
  437. <p>
  438. So <![CDATA[<dynamic:today/>]]> is the "logic - content" contract.
  439. </p>
  440.  
  441. <p>
  442. At the same time, the structure of the page is given as a contract to
  443. the graphic designers who have to come up with the transformation rules
  444. that transform this structure in a language that the browser can
  445. understand (HTML, for example).
  446. </p>
  447.  
  448. <p>
  449. So, the page structure is the "content - style" contract.
  450. </p>
  451.  
  452. <p>
  453. As long as these contracts don't change, the three areas can work in a
  454. completely parallel way without overwhelming the human resources used to
  455. manage them: costs decrease because time to market is reduced and
  456. maintenance costs is decreased because errors do not propagate out of
  457. the concern areas.
  458. </p>
  459.  
  460. <p>
  461. For example, you can tell your designers to come up with a "Xmas look"
  462. for your web site, without even telling the other people: just switch to
  463. the Xmas transformation rules on Xmas morning and you're done.... just
  464. imagine how painful it would be to do this on your web site today.
  465. </p>
  466.  
  467. <p>
  468. With the Cocoon architecture all this is a couple of line changes away.
  469. </p>
  470.  
  471.     </s1>
  472.  
  473.     <s1 title="Here we go">
  474.  
  475. <p>
  476. If you've reached this far in my text, you should be able to grasp the
  477. value of the Cocoon Project as well as distinguish most of the marketing
  478. hype that surrounds XML and friends.
  479. </p>
  480.  
  481. <p>
  482. Just like you shouldn't care if somebody offers you software that is
  483. "ASCII compliant" or "ASCII based", you shouldn't care about "XML
  484. compliant" or "XML based": it doesn't mean anything.
  485. </p>
  486.  
  487. <p>
  488. Cocoon uses XML as a core piece of its framework, but improves the model
  489. to give you the tools you need and is designed to be flexible enough to
  490. follow your current needs as well as paradigm shifts that may happen in the
  491. future.
  492. </p>
  493.  
  494.     </s1>
  495.  
  496.   </body>
  497. </document>
  498.