Comparative Display Technologies

567 views
495 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
567
On SlideShare
0
From Embeds
0
Number of Embeds
18
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Comparative Display Technologies

  1. 1. Comparative Display Technologies in Sakai Aaron Zeckoski [email_address]
  2. 2. What do we want out of a display technology? <ul><li>Easy to use for the developer </li></ul><ul><li>Good separation of Code and UI </li></ul><ul><ul><li>i.e. easy to use for the UI designer </li></ul></ul><ul><li>Good integration with Sakai </li></ul><ul><ul><li>Portal, widgets, tools, etc… </li></ul></ul>
  3. 3. What technologies work <ul><li>Virtually any Java related display technology can work in Sakai </li></ul><ul><li>There are some caveats </li></ul><ul><ul><li>Sakai uses a special Servlet to handle redirects and processing of HTTP request variables </li></ul></ul><ul><ul><li>Portal and widget interaction have to be developed for each technology </li></ul></ul><ul><li>Bottom line : You are better off sticking with the ones that currently work </li></ul>
  4. 4. What games are there in town? http://jakarta.apache.org/velocity/ http://java.sun.com/products/servlet/ http://java.sun.com/products/jsp/ JSF http://java.sun.com/javaee/javaserverfaces/ http://www2.caret.cam.ac.uk/rsfwiki/ But there are a few things to consider…
  5. 5. Java Servlets Intro <ul><li>modules of Java code that run in a server app to answer client requests </li></ul><ul><li>HTML is hardcoded in the Java class </li></ul><ul><ul><li>It can be pulled from external files though </li></ul></ul><ul><li>Most more advanced technologies are built on Servlets </li></ul><ul><li>Sakai uses Servlet API 2.4 </li></ul>URL: http:// en.wikipedia.org/wiki/Java_Servlet
  6. 6. Code Snippet <ul><li>package org.java.helloworld; </li></ul><ul><li>import java.io.*; </li></ul><ul><li>import javax.servlet.*; </li></ul><ul><li>import javax.servlet.http.*; </li></ul><ul><li>public class HelloWorld extends HttpServlet { </li></ul><ul><li>public void doGet(HttpServletRequest request, </li></ul><ul><li>HttpServletResponse response) </li></ul><ul><li>throws ServletException, IOException { </li></ul><ul><li>PrintWriter out = response.getWriter(); </li></ul><ul><li>out.println(&quot;Hello World&quot;); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>URL: http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/Servlet-Tutorial-First-Servlets.html
  7. 7. Java Servlets + <ul><li>Tried and tested technology (1997) </li></ul><ul><li>Runs on the server instead of on the client like an applet </li></ul><ul><li>Pure Java code </li></ul><ul><li>Session tracking via HttpServlet </li></ul><ul><li>Works fine in Sakai </li></ul><ul><ul><li>Café Servlet Hello World sample code </li></ul></ul>
  8. 8. Java Servlets - <ul><li>Invented in 1997 for goodness sake! </li></ul><ul><li>HTML is placed in the Java class </li></ul><ul><li>Impossible for UI designers to work with </li></ul><ul><li>Poor separation of UI and Code </li></ul><ul><li>Development this way is painful and slow compared to more modern methods </li></ul>
  9. 9. Java Servlets Final <ul><li>Why would you want to write pure Servlets any more considering the many better options out there? </li></ul><ul><li>You are going to use Servlets anyway but at least use something along with it </li></ul><ul><li>Bottom line : Don’t use this unless you just want to put an existing Servlet app into Sakai </li></ul>
  10. 10. Velocity Templates Intro <ul><li>Java based template engine </li></ul><ul><li>Uses “references” to place dynamic content in html pages with # or $ vars </li></ul><ul><ul><li>Somewhat similar to PHP or JSP </li></ul></ul><ul><li>Meant to allow UI designers to work alongside programmers </li></ul><ul><li>Apache project </li></ul>URL: http:// jakarta.apache.org /velocity/
  11. 11. Code Snippet <ul><li><HTML> </li></ul><ul><li><HEAD><title>Velocity Sample</title></HEAD> </li></ul><ul><li><BODY> </li></ul><ul><li><h1>Hello $user.name</h1> </li></ul><ul><li><table> </li></ul><ul><li>#foreach( $item in $items ) </li></ul><ul><li>#if ( $itemCheck($item) ) </li></ul><ul><li><tr> </li></ul><ul><li><td> $item.value </td> </li></ul><ul><li></tr> </li></ul><ul><li>#end </li></ul><ul><li>#end </li></ul><ul><li></table> </li></ul><ul><li></BODY> </li></ul><ul><li></HTML> </li></ul>
  12. 12. Velocity Templates + <ul><li>Uses “references” to place dynamic content in html template pages </li></ul><ul><ul><li>Somewhat similar to PHP or JSP </li></ul></ul><ul><li>Most used display technology in Sakai </li></ul><ul><ul><li>Integration with Sakai is good </li></ul></ul><ul><li>Ok separation of UI and Code </li></ul><ul><li>Decent docs and community </li></ul>
  13. 13. Velocity Templates - <ul><li>The current Velocity implementation in Sakai is a custom and out of date version </li></ul><ul><li>Integration with Sakai is OK but not really being worked on much anymore </li></ul><ul><li>New development in Velocity is discouraged by the community </li></ul><ul><li>Mostly carried over from CHEF </li></ul>
  14. 14. Velocity Templates Final <ul><li>Go for technologies that provide better separation between Code and UI </li></ul><ul><li>Bottom line : You are better off not using this, only use this if you have existing apps and cannot rewrite them </li></ul>
  15. 15. Java Server Pages Intro <ul><li>Dynamic Java web content scripting language </li></ul><ul><ul><li>Very similar to PHP </li></ul></ul><ul><li>JSP pages are compiled into Servlets when accessed </li></ul><ul><li>Pages are a mixture of HTML, taglib tags, and Code </li></ul>URL: http:// java.sun.com/products/jsp /
  16. 16. Code Snippet <ul><li><HTML> </li></ul><ul><li><HEAD><title>JSP Sample</title></HEAD> </li></ul><ul><li><BODY> </li></ul><ul><li><h1>Hello <%= user.getName() %></h1> </li></ul><ul><li>Today is <%= new Date() %><br/> </li></ul><ul><li><ul> </li></ul><ul><li><% for (int i=0; i<items.size(); i++) { %> </li></ul><ul><li><li><%= ((Item)items.get(i)).getValue() %></li> </li></ul><ul><li><% } %> </li></ul><ul><li></ul> </li></ul><ul><li></BODY> </li></ul><ul><li></HTML> </li></ul>
  17. 17. Java Server Pages + <ul><li>Easy to develop in and work with </li></ul><ul><li>Can be changed without restarting </li></ul><ul><li>Works fairly well in Sakai </li></ul><ul><ul><li>JSP support is available via a cool Servlet by Andrew Thornton (Cambridge) </li></ul></ul><ul><ul><li>Used in Rwiki (sorta), XML version </li></ul></ul><ul><li>Well tested technology with large community </li></ul><ul><li>Excellent docs and many books </li></ul>
  18. 18. Java Server Pages - <ul><li>Mixes code and HTML together </li></ul><ul><ul><li>Poor separation of code and UI design </li></ul></ul><ul><li>Compiled when accessed </li></ul><ul><ul><li>This can cause a noticeable delay when accessing a page for the first time </li></ul></ul><ul><li>Integration with Sakai is poor </li></ul><ul><li>Has many of the same weaknesses that other scripting languages have </li></ul>
  19. 19. Java Server Pages Final <ul><li>JSP support in Sakai is not great yet </li></ul><ul><li>It is difficult for UI designers </li></ul><ul><li>Bottom line : Use this if you have existing JSP code, but go for options that provider better separation between UI and Code for new projects </li></ul>
  20. 20. Java Server Faces Intro <ul><li>A Java based set of APIs for managing state, handling events, and defining navigation </li></ul><ul><li>Mostly builds on JSP </li></ul><ul><ul><li>Though it can be used without JSPs </li></ul></ul><ul><li>Includes a custom set of tag libraries </li></ul><ul><li>Includes error handling, input validation, and internationalization support </li></ul>JSF URL: http:// java.sun.com/javaee/javaserverfaces /
  21. 21. Code Snippet <ul><li><%@ taglib uri=&quot;http://java.sun.com/jsf/html&quot; prefix=&quot;h&quot; %> </li></ul><ul><li><%@ taglib uri=&quot;http://java.sun.com/jsf/core&quot; prefix=&quot;f&quot; %> </li></ul><ul><li><html> </li></ul><ul><li><head><title>JSF sample</title></head> </li></ul><ul><li><body> </li></ul><ul><li><f:view> </li></ul><ul><li><h1><h:outputText value=“Hello #{user.name}&quot;/></h1> </li></ul><ul><li><h:dataTable id=“items&quot; </li></ul><ul><li>value=&quot;#{itemsBean.items}&quot; var=“item&quot;> </li></ul><ul><li><h:column> </li></ul><ul><li><h:outputText value=&quot;#{item.value}&quot; /> </li></ul><ul><li></h:column> </li></ul><ul><li></h:dataTable> </li></ul><ul><li></f:view> </li></ul><ul><li></body> </li></ul><ul><li></html> </li></ul>JSF
  22. 22. Java Server Faces + <ul><li>The second most used display technology in Sakai (after Velocity) </li></ul><ul><ul><li>Used for the portal and a small number of apps (Gradebook, Assignments, etc…) </li></ul></ul><ul><li>Integrates well with Sakai </li></ul><ul><ul><li>better than any of the other current solutions (for now) </li></ul></ul><ul><li>MyFaces and Oracle ADF Faces </li></ul><ul><li>Pretty good docs and books </li></ul>JSF
  23. 23. Java Server Faces - <ul><li>Pretty heavyweight and has problems in the current version </li></ul><ul><ul><li>These might be fixed in the upcoming version </li></ul></ul><ul><li>Poor separation of UI design and code </li></ul><ul><li>High learning curve </li></ul><ul><li>Difficult to use and not very flexible </li></ul><ul><li>Poor AJAX/Javascript integration </li></ul><ul><li>Does not work with browser navigation </li></ul>JSF
  24. 24. Java Server Faces Final <ul><li>Most new apps in Sakai are written in this but it is recognized as having many weaknesses </li></ul><ul><li>High learning curve and difficulty of use means slow development </li></ul><ul><li>Bottom line : Don’t use this unless you really have to, even if you have existing code </li></ul>JSF
  25. 25. Reasonable Server Faces <ul><li>Spring based web programming framework </li></ul><ul><li>Uses pure XHTML templates, clean separation of UI and Code </li></ul><ul><li>Lightweight and pure bean programming </li></ul><ul><li>Works well with AJAX and Javascript </li></ul>URL: http:// jakarta.apache.org /velocity/
  26. 26. Code Snippet <ul><li><html> </li></ul><ul><li><head><title>RSF sample</title></head> </li></ul><ul><li><body> </li></ul><ul><li><h1>Hello <span rsf:id=“user-name”>User Name</span></h1> </li></ul><ul><li>Today is <span rsf:id=“current-date”>1/1/2006</span><br/> </li></ul><ul><li><table> </li></ul><ul><li> <tr rsf:id=“items:”> </li></ul><ul><li> <td rsf:id=“item-value”>item value here</td> </li></ul><ul><li> </tr> </li></ul><ul><li></table> </li></ul><ul><li></body> </li></ul><ul><li></html> </li></ul>
  27. 27. Reasonable Server Faces + <ul><li>Uses pure XHTML templates </li></ul><ul><ul><li>Provides clean separation of UI and Code </li></ul></ul><ul><li>Respects the HTTP request cycle </li></ul><ul><ul><li>Back button works! </li></ul></ul><ul><li>Works well with AJAX and Javascript </li></ul><ul><li>Sakai integration and features are improving rapidly </li></ul><ul><li>Good docs and code samples available on the RSF Wiki </li></ul>
  28. 28. Reasonable Server Faces - <ul><li>Greater separation of UI and code can require more files and lines of code </li></ul><ul><ul><li>This is true of other solutions as well </li></ul></ul><ul><li>Not used in Sakai core yet but is fully functional in it and integrates somewhat </li></ul><ul><ul><li>Some code in Sakai Contrib (rsf gallery) </li></ul></ul><ul><li>Small user community </li></ul><ul><li>Still in development (also a positive) </li></ul>
  29. 29. Reasonable Server Faces Final <ul><li>The only really good separation of UI design and Code available </li></ul><ul><li>Community support is growing and Sakai integration improving </li></ul><ul><li>Bottom line : Use of this is recommended for new Sakai apps </li></ul>
  30. 30. Summary <ul><li>No plain Servlets </li></ul><ul><li>Velocity discouraged </li></ul><ul><li>JSP ok for small stuff </li></ul><ul><li>JSF is just bad </li></ul><ul><li>RSF recommended </li></ul>JSF

×