Monday, August 19, 2013

Ganelon tutorial, intro

What is Ganelon?

Ganelon is a microframework of mine, built to ease the pain of using AJAX in Ring/Compojure based Clojure web applications. 
The microframework is not intended as an end-to-end framework, solving all the problems of building web applications in Clojure, but rather as a tool that solves one particular problem in an elegant and simple way. 
Other problems, such as routing, templating or integration with underlaying HTTP(S) server architecture have their own, well established solutions. For example there is Compojure or Mustache for routing, Hiccup or  Clabango for templating, etc. 
For a full list, you can go to http://www.clojure-toolbox.com/. Important thing to note is that by using Ganelon you are still free to apply any other Ring-compliant or client-side libraries - Ganelon simply enhances your application's capabilities, not forces you down some narrow path.

How does Ganelon work?

Ganelon is also different from modern, JavaScript/ClojureScript based web frameworks, as it gives a control over user interface behaviour directly to a code running server-side. JavaScript layer is very thin and provides a set of generic operations; the layer can of course be easily extended as we will see in the tutorial. More information is available in the documentation.
As to my knowledge, there are no other Clojure frameworks built this way, but similar principle is used for example in Vaadin or Wicket (Java) or in Weblocks (Common LISP). The main difference is that Ganelon is not keeping the information about widget state. 

Ganelon tutorial

In the Ganelon tutorial, I will show how to:
  • Setup a new Ganelon project, configure basic routes and layout templates (using Hiccup) (PART  1).
  • Build reusable, dynamic elements of UI (widgets) and use MongoDB (from mongohq) as a persistence layer (PART 2).
  • Add middleware for security handling and define custom operations (PART 3).
  • Finally, I will show how can the tutorial app display its source code (PART 4).
If you want to see the final result, you can view the tutorial app running live at http://ganelon-tutorial.tomeklipski.com or you can check out/star/fork the source codes at http://github.com/tlipski/ganelon-tutorial.


0 comments :

Post a Comment