jon         01/03/04 15:16:12

  Modified:    xdocs/ymtd ymtd-conclusion.xml ymtd-implementation.xml
                        ymtd-javabeans.xml ymtd-sampleapp.xml
                        ymtd-saying-hello.xml ymtd-taglibs.xml ymtd.xml
  Added:       xdocs/ymtd ymtd-changes.xml ymtd-hosting.xml
  Log:
  many changes and additions based on feedback. see the changes
  document for details
  
  Revision  Changes    Path
  1.2       +9 -0      jakarta-velocity/xdocs/ymtd/ymtd-conclusion.xml
  
  Index: ymtd-conclusion.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-conclusion.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ymtd-conclusion.xml       2001/03/03 08:23:51     1.1
  +++ ymtd-conclusion.xml       2001/03/04 23:16:07     1.2
  @@ -21,6 +21,15 @@
   </p>
   
   <p>
  +Some people may disagree strongly with this essay because it challenges
  +conventional thinking as well as the way that they may be doing things
  +today. It is very difficult to show people who believe strongly in
  +something that there might be another solution out there that solves
  +problems in a different way. Therefore, please send us your feedback as
  +it really is important. Instructions for doing so are on the first page.
  +</p>
  +
  +<p>
   You make the decision.
   </p>
   
  
  
  
  1.2       +1 -1      jakarta-velocity/xdocs/ymtd/ymtd-implementation.xml
  
  Index: ymtd-implementation.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-implementation.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ymtd-implementation.xml   2001/03/03 08:23:51     1.1
  +++ ymtd-implementation.xml   2001/03/04 23:16:08     1.2
  @@ -92,7 +92,7 @@
   
   <p>
   <strong>[ <a href="ymtd-embedded.html">Embedded Usage</a> &lt;- Previous | 
  -    Next -&gt; <a href="./ymtd-conclusion.html">Conclusion</a> ]
  +    Next -&gt; <a href="./ymtd-hosting.html">Hosting</a> ]
   </strong></p>
   
   </section>
  
  
  
  1.2       +15 -0     jakarta-velocity/xdocs/ymtd/ymtd-javabeans.xml
  
  Index: ymtd-javabeans.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-javabeans.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ymtd-javabeans.xml        2001/03/03 08:23:51     1.1
  +++ ymtd-javabeans.xml        2001/03/04 23:16:08     1.2
  @@ -84,6 +84,21 @@
   typing a thing of the past. Really.
   </p>
   
  +<p>
  +There are several commercial solutions available today which provide a
  +nice drag and drop view for doing development with JSP and Struts.
  +However many of these tools are still first generational tools. They
  +typicially only address parts of the problem and require digging down
  +into the nitty gritty stuff when things become difficult or even
  +impossible to do with the GUI (anyone remember a product called Tango?).
  +Often these tools also produce code that is not optimized for heavily
  +hit sites and getting an existing application to scale sometimes
  +requires a complete rewrite. Again, this is not our decision, it is
  +yours. Another item to note here is that these are costly (>$1000/seat)
  +development tools. In this .bomb economy, who really has the money to
  +spend on these tools?
  +</p>
  +
   <source><![CDATA[
   The Java code:
   
  
  
  
  1.3       +38 -6     jakarta-velocity/xdocs/ymtd/ymtd-sampleapp.xml
  
  Index: ymtd-sampleapp.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-sampleapp.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ymtd-sampleapp.xml        2001/03/03 09:07:33     1.2
  +++ ymtd-sampleapp.xml        2001/03/04 23:16:08     1.3
  @@ -10,6 +10,44 @@
   
   <section name="Sample Application">
   
  +<p>
  +It is the belief of the Velocity developers that you should not have to
  +specially code your applications to work around issues that are related
  +directly to Java.
  +</p>
  +
  +<p>
  +In other words, one of the strong arguments of the JSP/Struts community
  +is to say something to the effect of: "this is a poor example of using
  +JSP." While this may be true, the fact of the matter is that nearly
  +every example available really is a poor example of using JSP. This goes
  +back to the statement that says that embedding Java code in your page is
  +a bad thing. Yes, we all know that now. 
  +</p>
  +
  +<p>
  +If one reads the articles available on <a
  +href="http://www.javaworld.com/">JavaWorld</a> that are about JSP,
  +nearly every single article has one thing or another in it that
  +demonstrates poor usage of the tool. Why is it that so many (obviously)
  +talented people cannot come up with correct examples of using the tool?
  +</p>
  +
  +<p>
  +The truth is that it is very hard to use the tool correctly. Struts is
  +doing an excellent job of making it easier and attempting to show the
  +right way, however it is simply hiding the uglyness of the original
  +design of JSP.
  +</p>
  +
  +<p>
  +Object Oriented design dictates that you extend a class to add
  +functionality to the base class. The publicly available methods in the
  +base class are still available to the classes that extend it. Putting
  +Struts on top of JSP doesn't fix the warts in JSP. It simply hides them
  +until your developers find them.
  +</p>
  +
   <source><![CDATA[
   <%-- toolview.jsp --%>
   
  @@ -72,12 +110,6 @@
   between the if and else clauses, causing the obscure compile error:
   'else' without 'if'.
   ]]></source>
  -
  -<p>
  -It is the belief of the Velocity developers that you should not have to
  -specially code your applications to work around issues that are related
  -directly to Java.
  -</p>
   
   <hr noshade="true" size="1"/>
   
  
  
  
  1.2       +9 -11     jakarta-velocity/xdocs/ymtd/ymtd-saying-hello.xml
  
  Index: ymtd-saying-hello.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-saying-hello.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ymtd-saying-hello.xml     2001/03/03 08:23:51     1.1
  +++ ymtd-saying-hello.xml     2001/03/04 23:16:08     1.2
  @@ -105,10 +105,10 @@
   <head><title>Hello</title></head>
   <body>
   <h1>
  -<% if (request.getParameter("name") == null) {  %>
  -   Hello World
  -<% } else { %>
  -  Hello, <% out.println (request.getParameter("name")); } %>
  +<% if (request.getParameter("name") == null) %>
  +          Hello World
  +<% else %>
  +          Hello, <% request.getParameter("name") %>
   </h1>
   </body></html>]]></source>
   
  @@ -124,13 +124,11 @@
   <hr noshade="true" size="1"/>
   
   <p>
  -The point that needs to be made is that in order to make JSP "pure",
  -one really needs to jump through hoops. In other words, it is much
  -easier to type the out.println() then to embed the necessary <code>&lt;%
  -%&gt;</code> tags everywhere. It is also important to remember to add
  -that extra "<code>; }</code>" at the end of the last out.println()
  -because JSP will not be able to compile the page (we will get into the
  -problems with debugging JSP pages in a later chapter).
  +The point that needs to be made is that in order to make JSP "pure", one
  +really needs to jump through hoops. One still needs to embed the
  +necessary <code>&lt;% %&gt;</code> tags everywhere though. There is also 
  +a bit of a disconnect as to when the ";" needs to be added and when it 
  +does not.
   </p>
   
   <p>
  
  
  
  1.2       +56 -0     jakarta-velocity/xdocs/ymtd/ymtd-taglibs.xml
  
  Index: ymtd-taglibs.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd-taglibs.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ymtd-taglibs.xml  2001/03/03 08:23:51     1.1
  +++ ymtd-taglibs.xml  2001/03/04 23:16:09     1.2
  @@ -190,6 +190,62 @@
   as the Velocity version?
   </p>
   
  +<p>
  +Velocity comes in with a simpler soluton that is designed around the
  +idea of a few core template tags. A scripting language is something like
  +PHP which may require months of usage to completely master. A template
  +language is something that can be mastered in just a few hours. This is
  +what differentiates Velocity from being a scripting language vs. a
  +template language.
  +</p>
  +
  +<p>
  +For example, Velocity has the following core template tags (otherwise 
  +known as "directives"):
  +</p>
  +
  +<source>
  +#if
  +#else
  +#elseif
  +#foreach
  +#set
  +</source>
  +
  +<p>
  +It is possible to add more #directives to Velocity either by adding them
  +directly to the parser or adding them through an API. It is also
  +possible to use a neat feature of Velocity called Velocimacro's which
  +are documented <a href="../user-guide.html#velocimacro">here</a>.
  +</p>
  +
  +<p>
  +Some people suggest that the benefit to JSP and Struts is that it simply
  +extends HTML, which is something that designers already understand. This
  +is a powerful argument. However, the reality is that HTML is not a
  +template language. In other words, there is no logic in HTML. For
  +example, it is not possible to embed conditional statements (like in the
  +very first example above) into HTML.
  +</p>
  +
  +<p>
  +What this means is that Taglibs allow developers to infinitely extend
  +HTML to become much much more than it previously was. Almost like
  +inventing another scripting language. This is reminiscent the early
  +browser wars where each company was implementing their own browser tags.
  +Netscape went so far as to invent the &lt;blink&gt; tag. What did we
  +learn from that? Is that really a good thing? Sure, standardizing
  +taglibs is a great idea. Will it ever become widely adopted? We sure
  +hope so.
  +</p>
  +
  +<p>
  +One last point to make about using a HTML syntax is that this really
  +pigeon holes JSP and Struts into simply being a tool for creating only
  +dynamic HTML code. Velocity on the other hand is designed to take as
  +input any type of text (Java, SQL, HTML, etc) and output anything as a
  +result of running it through its processing engine.
  +</p>
   
   <p>
   You make the decision.
  
  
  
  1.2       +16 -3     jakarta-velocity/xdocs/ymtd/ymtd.xml
  
  Index: ymtd.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/xdocs/ymtd/ymtd.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ymtd.xml  2001/03/03 08:23:51     1.1
  +++ ymtd.xml  2001/03/04 23:16:09     1.2
  @@ -45,6 +45,14 @@
   </p>
   
   <p>
  +Please note that there are a bazillion different things that could be
  +compared here. To be clear, we are not really trying to compare the
  +feature set of each of these technologies as they both can get the job
  +done. Instead, we are trying to compare what it is like to do the job
  +with each of the tools.
  +</p>
  +
  +<p>
   The design concepts mentioned above that we will be exploring have been
   documented in detail in various locations, for more information, please
   refer to some of these reference URL's:
  @@ -84,9 +92,9 @@
   </p>
   
   <p>
  -Jason's book includes chapters covering JSP, Velocity, and other MVC
  -technologies.  We definitely encourage you to read the book to learn JSP
  -and Velocity and see how they compare.  What we do here (that Jason
  +Jason's book includes chapters covering Struts/JSP, Velocity, and other
  +MVC technologies.  We definitely encourage you to read the book to learn
  +JSP and Velocity and see how they compare.  What we do here (that Jason
   couldn't do in the book) is put JSP/Struts and Velocity/Turbine on the
   same page together for a direct side-by-side comparison.
   </p>
  @@ -94,6 +102,11 @@
   </section>
   
   <section name="Revisions / Corrections / Additions">
  +
  +<p>
  +This <a href="./ymtd-changes.html">page</a> tracks the list of changes
  +in this essay.
  +</p>
   
   <p>
   It is very important to accurately compare these technologies.
  
  
  
  1.1                  jakarta-velocity/xdocs/ymtd/ymtd-changes.xml
  
  Index: ymtd-changes.xml
  ===================================================================
  <?xml version="1.0"?>
  <document>
  
    <properties>
      <author email="[EMAIL PROTECTED]">Jon S. Stevens</author>
      <title>You make the decision - Changes</title>
    </properties>
  
  <body>
  
  <section name="Changes">
  
  <p>
  We are getting great feedback on this document. As promised, on the
  homepage, this is a live document that will undergo changes over time to
  correct mistakes and add improvements and clarifications. Below are a
  list of changes to date (latest changes first in listing):
  </p>
  
  <p>
  <ul>
  <li>Added the <a href="./ymtd-hosting.html">Hosting</a> page to address
  the idea that JSP makes a great hosting platform.</li>
  <li>Added a paragraph on the <a 
  href="./ymtd-conclusion.html">Conclusion</a> page.</li>
  <li>Added a few paragraphs to the bottom of the <a 
  href="./ymtd-taglibs.html">Taglibs</a> page.</li>
  <li>Added a few paragraphs to the top of the <a 
  href="./ymtd-sampleapp.html">Sample App</a> page.</li>
  <li>Updated the example "right way" on the <a
  href="./ymtd-saying-hello.html">Saying Hello</a> page as well as the
  comments about it. Thanks to <a
  href="mailto:[EMAIL PROTECTED]">Niall Pemberton</a> for the
  correction.</li>
  <li>Added more clarification on the <a href="./ymtd.html">Home</a> page
  about what we are comparing. The reason is that we got feedback from <a
  href="mailto:[EMAIL PROTECTED]">Niall Pemberton</a>
  suggesting that because we didn't compare Internationalization that this
  article was not of use for him.</li>
  <li>Added a link to this page to the <a href="./ymtd.html">Home</a>
  page.</li>
  <li>Copy/paste error on the <a href="./ymtd-sampleapp.html">Sample
  Application</a> page. (JSS)</li>
  </ul>
  
  </p>
  
  <p>
  <strong>[ Next -&gt; <a href="./ymtd.html">Home</a> ]</strong>
  </p>
  
  </section>
  
  </body>
  </document>
  
  
  
  1.1                  jakarta-velocity/xdocs/ymtd/ymtd-hosting.xml
  
  Index: ymtd-hosting.xml
  ===================================================================
  <?xml version="1.0"?>
  <document>
  
    <properties>
      <author email="[EMAIL PROTECTED]">Jon S. Stevens</author>
      <title>You make the decision - Hosting</title>
    </properties>
  
  <body>
  
  <section name="Hosting">
  
  <p>
  JSP is great for hosted environments (ie: shared development
  environments, ISP's and large companies) where many different kinds of
  people putting pages on the server may not know much more than
  HTML. Part of the reason it is so nice is that with the HTML'ish syntax
  JSP is so easy to learn!
  </p>
  
  <p>
  However, if one really looks at that statement in more detail it becomes
  apparent that this might not be such a good thing. Consider the
  following snippet of Java code:
  </p>
  
  <source><![CDATA[
      Hashtable strings = new Hashtable();
      int i=0;
      while (true)
      {
          strings.put ("dead"+i, new StringBuffer(999999));
      }
  ]]></source>
  
  <p>
  What this does is that it creates a Hashtable and then goes into a tight
  loop. At the same time, it creates a new StringBuffer object that has a
  default size of 999999. Therefore, creating what amounts to a memory
  leak in the Java Virtual Machine (which all of the hosted applications
  share).
  </p>
  
  <p>
  As soon as all of the memory is gone, every single hosted application
  will start to receive the dreaded "OutOfMemoryError". The reason why
  this is so bad has already been explained <a
  href="./ymtd-error-handling.html">earlier</a>. Essentially JSP pages
  themselves cannot catch OOME errors and the entire server will suddenly
  become useless, all because of what amounts to a few lines of badly
  written Java code.
  </p>
  
  <p>
  Remember, it is a bad idea to put Java code into a JSP page. Tell that
  to the 14 year old kid who is being hosted on your ISP's server who
  really does not care that others might be affected by these actions.
  </p>
  
  <p>
  Velocity does not have this issue because there is no while loop in the
  Velocity Template Language. The only looping construct in Velocity is a
  #foreach and that loops over an array that has a finite amount of
  elements. It is also possible to disable the #foreach directive and
  limit the amount of recursive nesting that is possible.
  </p>
  
  <p>
  There is nothing in JSP or Struts that prevents people from embedding
  Java code in the page.
  </p>
  
  <p>
  You make the decision.
  </p>
  
  <p>
  <strong>[ <a href="ymtd-implementation.html">Implementation</a> &lt;- Previous | 
      Next -&gt; <a href="./ymtd-conclusion.html">Conclusion</a> ]
  </strong></p>
  </section>
  
  </body>
  </document>
  
  
  

Reply via email to