Cascade
Howard M. Lewis Ship
Director of Open Source Technology, Formos
howard.lewis.ship@formos.com
                     ...
What is Cascade?




                   © 2009 Formos Software Development
Cascade Web Framework
• Pure Clojure

• Functional

• Share Nothing

• Action Oriented (not component based)

• Tapestry-s...
Views and Fragments
 app/views/index.cml

 <html xmlns:c="cascade">
   <body>
     The current time is:
     <c:format-dat...
Expansions
app/views/index.cml

<html xmlns:c="cascade">
  <c:loop c:source="(range 5 0 -1)" c:value=":i">
    $(env :i) ....
Fragments can be Templates

                                            A bit awkward ...

  app/views/index.cml
         ...
Actions




          © 2009 Formos Software Development
Actions
• Coming Soon! :-)

• Functional:

  •env in (:request, :response, etc.)

  •result:

     •keyword ➠ render this ...
Actions
• Functions to generate callback URLs

  • To an action

  • To a view

• Pass query parameters

• Extra data in p...
URLs
• Actions

  • /action/name

• Views

  • /name

• Configurable?




                   © 2009 Formos Software Develop...
What's Missing?




                  © 2009 Formos Software Development
Servlet Integration
• Run Cascade as servlet

• Embedded mode: Start Jetty up with Cascade configured




                 ...
Document Generation
• DOCTYPEs not supported yet

• <![CDATA[]]> not supported yet

• Control: HTML(SGML) vs. XML output

...
Template Features
• Server-side Comments

• Root <c:fragment> element (for templates that render
  multiple elements)

• B...
Unimplemented Ideas
• Parallelization

  • Render fragments in parallel across threads

  • Multiple simultaneous database...
(use 'tapestry)
• Libraries of fragments & views
• JAR-packaged resources
• 1st class exception reporting
• JavaScript agg...
Wrap Up




          © 2009 Formos Software Development
http://github.com/hlship/cascade/tree/master




                                               © 2009 Formos Software Dev...
http://wiki.github.com/hlship/cascade/




                              © 2009 Formos Software Development
Photo Credits
   © 2008 Danny Barron
   http://www.flickr.com/photos/dbarronoss/2454432792/



   © 2006 Chris Walton
   ht...
Upcoming SlideShare
Loading in …5
×

Cascade

1,787 views

Published on

An introduction to Cascade, a web framework written in Clojure. Cascade is very early alpha (very incomplete). As presented to the Portland Functional Programming Study Group July 13 2009.

Published in: Technology, Education
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,787
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
27
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Cascade

  1. 1. Cascade Howard M. Lewis Ship Director of Open Source Technology, Formos howard.lewis.ship@formos.com © 2009 Formos Software Development
  2. 2. What is Cascade? © 2009 Formos Software Development
  3. 3. Cascade Web Framework • Pure Clojure • Functional • Share Nothing • Action Oriented (not component based) • Tapestry-style Templates • Status: alpha, incomplete © 2009 Formos Software Development
  4. 4. Views and Fragments app/views/index.cml <html xmlns:c="cascade"> <body> The current time is: <c:format-date c:date="(env :current-time)"/> </body> </html> app/fragments.clj (ns app.fragments (:import (java.util Date) (java.text DateFormat))) (defn format-date [env params] (let [#^Date date (params :date) #^DateFormat fmt (DateFormat/getDateTimeInstance DateFormat/MEDIUM DateFormat/MEDIUM)] (.format fmt date))) © 2009 Formos Software Development
  5. 5. Expansions app/views/index.cml <html xmlns:c="cascade"> <c:loop c:source="(range 5 0 -1)" c:value=":i"> $(env :i) ... </c:loop> </html> Output <html xmlns:c="cascade"> 5 ... 4 ... 3 ... 2 ... 1 ... </html> • In text • In attribute values © 2009 Formos Software Development
  6. 6. Fragments can be Templates A bit awkward ... app/views/index.cml 1 <c:layout xmlns:c="cascade" c:title='"Current Date"'> The current time is: 4 <c:format-date c:date="(env :current-time)"/> </c:layout> 6 fragments/layout.cml 2 <html xmlns:c="cascade"> <head> <title>$(params :title)</title> </head> <body> <h1>$(params :title)</h1> 3 <c:render-body/> </html> 5 © 2009 Formos Software Development
  7. 7. Actions © 2009 Formos Software Development
  8. 8. Actions • Coming Soon! :-) • Functional: •env in (:request, :response, etc.) •result: •keyword ➠ render this view •URL ➠ send redirect for URL •false ➠ didn't handle request after all •true ➠ sent response directly © 2009 Formos Software Development
  9. 9. Actions • Functions to generate callback URLs • To an action • To a view • Pass query parameters • Extra data in path • Built-in fragments to generate URLs © 2009 Formos Software Development
  10. 10. URLs • Actions • /action/name • Views • /name • Configurable? © 2009 Formos Software Development
  11. 11. What's Missing? © 2009 Formos Software Development
  12. 12. Servlet Integration • Run Cascade as servlet • Embedded mode: Start Jetty up with Cascade configured © 2009 Formos Software Development
  13. 13. Document Generation • DOCTYPEs not supported yet • <![CDATA[]]> not supported yet • Control: HTML(SGML) vs. XML output • Filtering characters to entities (i.e., < ➠ &lt;) • Output namespace support © 2009 Formos Software Development
  14. 14. Template Features • Server-side Comments • Root <c:fragment> element (for templates that render multiple elements) • Better way to pass literal strings as parameters • Tapestry-style blocks: • Encapsulate a section of template as a closure • Pass as parameter to a fragment © 2009 Formos Software Development
  15. 15. Unimplemented Ideas • Parallelization • Render fragments in parallel across threads • Multiple simultaneous database queries • Pipelines • Declarative command chains around views and actions • Meta-data • Declare pipelines, required parameters, etc. © 2009 Formos Software Development
  16. 16. (use 'tapestry) • Libraries of fragments & views • JAR-packaged resources • 1st class exception reporting • JavaScript aggregation / minimization • Version asset URLs • Automatic GZIP compression • Localization • Live "class" reloading © 2009 Formos Software Development
  17. 17. Wrap Up © 2009 Formos Software Development
  18. 18. http://github.com/hlship/cascade/tree/master © 2009 Formos Software Development
  19. 19. http://wiki.github.com/hlship/cascade/ © 2009 Formos Software Development
  20. 20. Photo Credits © 2008 Danny Barron http://www.flickr.com/photos/dbarronoss/2454432792/ © 2006 Chris Walton http://www.flickr.com/photos/philocrites/245011706/ © 2009 Formos Software Development

×