Cascade
Upcoming SlideShare
Loading in...5
×
 

Cascade

on

  • 2,513 views

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.

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.

Statistics

Views

Total Views
2,513
Views on SlideShare
2,509
Embed Views
4

Actions

Likes
2
Downloads
25
Comments
0

2 Embeds 4

http://www.slideshare.net 3
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Cascade Cascade Presentation Transcript

    • Cascade Howard M. Lewis Ship Director of Open Source Technology, Formos howard.lewis.ship@formos.com © 2009 Formos Software Development
    • What is Cascade? © 2009 Formos Software Development
    • Cascade Web Framework • Pure Clojure • Functional • Share Nothing • Action Oriented (not component based) • Tapestry-style Templates • Status: alpha, incomplete © 2009 Formos Software Development
    • 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
    • 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
    • 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
    • Actions © 2009 Formos Software Development
    • 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
    • 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
    • URLs • Actions • /action/name • Views • /name • Configurable? © 2009 Formos Software Development
    • What's Missing? © 2009 Formos Software Development
    • Servlet Integration • Run Cascade as servlet • Embedded mode: Start Jetty up with Cascade configured © 2009 Formos Software Development
    • 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
    • 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
    • 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
    • (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
    • Wrap Up © 2009 Formos Software Development
    • http://github.com/hlship/cascade/tree/master © 2009 Formos Software Development
    • 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 http://www.flickr.com/photos/philocrites/245011706/ © 2009 Formos Software Development