Downloading and running the Liquidizer

Installing and running the Liquidizer is very easy. First you must make sure, that the prerequisits are installed: Git, Maven, Gnuplot, and Graphviz. On Ubuntu you can install them with the following command:

	sudo apt-get install git-core maven2 gnuplot graphviz

Then you can download the code from its git repository and run it with the provided maven script:

	git clone git://github.com/liquidizer/liquidizer.git
	cd liquidizer
	mvn jetty:run

After that a new Liquidizer instance will be accessible locally on http://localhost:8080.

Source code overview

The Liquidizer source code is concise, well documented, and easy to maintain. Still, it is written in Scala programming language and makes heavy use of complicated functional and object oriented programming styles.

Data model

All Liquidizer functions operate on classes that are defined by the data model in src/main/scala/org/liquidizer/model. The data structures are persisted in SQL tables through the Liftweb mapping framework. No bespoke SQL queries are used.

The entities of the data model are summarized below. Central classes are User and Votable. They define who casts a vote on what, as this is what the Liquidizer system is centered around:

model.png

Class diagram: Boxes are classes and/or database tables. Arrows are n-to-1 relations.

The rendering pipeline

The Liquidizer is a web application. All actions are triggered through HTTP page requests and are handled by the Liftweb rendering pipeline. This pipeline is defined by a number of rules in the Boot class (src/main/scala/bootstrap/liftweb/boot/Boot.scala).

Starting with an HTTPRequest, the pipeline consists of the following steps:

pipeline.png

Rendering pipeline: Boxes correspond to functionality provided by the Liftweb framework. Circles are specific Liquidizer functions.

Snippet binding

All web pages that are served by the Liquidizer are eventually derived from an HTML template in src/main/webapp or its subfolders. Those templates follow a well defined structure:

	<lift:surround with="BASE_TEMPLATE">
	<lift:bind-at name="PLACE_HOLDER">
	...
	<lift:CLASS_NAME[.METHOD_NAME]>
	...
	</lift:CLASS_NAME[.METHOD_NAME]>
	...
	</lift:bind-at>
	...
	</lift:surround>

The template is then processed with the specified parameters:

Most snippets in Liquidizer system are concerned with displaying information about one or more Votable objects. Those snippets make use of two central helper classes to render the content. One class is MultipageSnippet which handles filtering, sorting, and splitting results on multiple pages. The other class is the VotingHelper that provides some binding for XML tags with repeated usage in different contexts:

Links


Stefan Dirnstorfer
CC-BY