ucw Tutorial

My native language isn't English and even my German writing is not all that great. So, if you find typos or what I like to call germglish, please correct this wiki. I will restructure both the wiki and the solution over time, but a helping hand would be much appreciated.

Getting the sources

After a round of trying it seems I was able to set up a repository for the sources. I'm not fully sure if everything's fine. However you can give it a try:

darcs get http://www.q-software-solutions.de/repos/ucw-tutorial

That should do the job.

Disclaimer

Feel free to disagree with what I've written here. Feel free to also take whatever you find useful and use it for yourself. However, I claim no warranty or reliability in the instructions posted here. Please do not sue me for any troubles that might arise from following these instructions. I will try my best to not wreak havoc on your data. Sometimes bad things do happen though.

Grabbing the latest version of UCW

The latest version of UCW and its required dependencies are held within various DARCS repositories located on the common-lisp.net server. The first step is to pull ucw_dev (the project is still in its infancy and has an unstable API/structure).

The command for pulling ucw_dev is:

  darcs get http://common-lisp.net/project/ucw/repos/ucw_dev

Now, open the README file in the root of ucw_dev and take a look at the required dependencies. At the time of writing they are (project / repository),

  darcs get http://common-lisp.net/project/bese/repos/arnesi_dev/
  darcs get http://common-lisp.net/project/bese/repos/yaclml/
  darcs get http://common-lisp.net/project/ucw/repos/parenscript/
  
  # PJB: The ucw_dev/README I got doesn't mention rfc2109...
  darcs get http://common-lisp.net/project/rfc2109/rfc2109
  
  # darcs get http://common-lisp.net/project/iterate/darcs/iterate
  # current UCW needs this specific version:
  wget http://common-lisp.net/project/iterate/releases/iterate_1.4.tar.gz
  tar zxf iterate_1.4.tar.gz
  
  # UCW uses its own version of rfc2388:
  darcs get http://common-lisp.net/project/ucw/repos/rfc2388
  
  cvs -d :pserver:anonymous:anonymous@common-lisp.net:/project/slime/cvsroot login
  # password = anonymous
  cvs -d :pserver:anonymous:anonymous@common-lisp.net:/project/slime/cvsroot co slime
  
  wget http://weitz.de/files/cl-ppcre.tar.gz
  tar zxf cl-ppcre.tar.gz
  
  wget \
    --cookies=off \
    --header "Cookie: CCLAN-SITE=http://www-jcsu.jesus.cam.ac.uk/ftp/pub/cclan/" \
    http://www.telent.net/cclan/trivial-sockets.tar.gz
  tar zxf trivial-sockets.tar.gz
  
  wget http://files.b9.com/puri/puri-1.4.tar.gz
  tar zxf puri-1.4.tar.gz

There are more but they're related specifically to the backend (the part of UCW that serves out the HTML pages). Take a look at the README to get up-to-date information as well as more detailed instructions. You can also update your darcs repositories by entering the directory holding the project and issuing a $ darcs pull command.

I generally put my Common Lisp projects in my ~/.sbcl/sources directory. After that I create symbolic links from ~/.sbcl/sources/projectname/project.asd to ~/.sbcl/system/project.asd. This allows ASDF (the de facto common-lisp package manager) to find the location of the projects.

-----
Question: Which of the packages can be left alone for, say, a half a year at a time? What kind of version control is UCW using? Are there any tarballs that are marked `pretty stable' (i.e. `good enough for government work' if you can catch the joke ;-)? The first time I set up UCW I moved aside my old asdf:*central-registry* directory and made a new one so that I could be sure to get the right versions of things and couldn't easily make a mistake. (I also wanted to make sure I didn't use any dependencies I didn't know about.) I even created one setup to remain stable and one to follow the latest code. This system I created tended to be unwieldy.
Tom Elam
4 June, 2006
-----

UCW Basics

Here's my attempt to introduce you to UCW. The major things to understand are:

Components

I try to explain it as short and understandable as I can: 'Components are objects that are supposed to be displayed to the user'

This whole UCW-stuff is about getting objects interacting. It pretends to not be stateless, the objects carry the state information from one page to another.

So the first thing you have to do is declare a component.

Actions

If the Components are the Bones then actions are the flesh. You cannot live without either ;-). Actions are supposed to change the data behind the view. In MVC terms you can see them as the model; actions steer the components. They do some manipulations and redirect you to the next Component (aka Views).

Tutorial Chapters

ucwTutorialExample

ucwTutorialDataModel

gettingUCWIntoPlay

ucwTutorialGettingFromOnePlaceToAnother

ucwTutorialGettingABitFurther This is not a good name You'll find the first round of documentation about validators here

ucwTutorialWritingYourOwnValidator

ucwTutorialAddingAValidatorToTheExample

ucwTutorialIntroducingTal

ucwTutorialTalification

Other links which might come in handy

A Short web application tutorial

UCW Tutorial from Ties Stuij He has another idea on how a UCW-Tutorial looks. You might prefer his approach, so give it a try.

Thanks

Oh I'm surprised, someone has picked it up and it now looks as if someone capable of writing has written this page. Thanks Friedrich

Future of this Tutorial

It seems no-one dared to add something to this tutorial. However it is in no way complete the examples are simple and do not show much about ucw really. However I've spend enough time on getting into ucw and won't use it any longer.

The reasons for that are the following:

* debugging is a pain in the a...

* getting anywhere takes way too much time

If you think different about it feel free to take over this tutorial. I for my part have settled down to either use webactions or kpax and do prefer the Rails approach much more. My record for getting paged done with Lisp are extremely poor, I spend months on simple pages, rewriting them with Rails has not even took a week. The Ruby way is much easier to understand and apply. So feel free to bash my preferring Ruby over Lisp.

Well nothing has really changed in ucw land it seems. I guess Web 2.0 has taken of (for better or worse who knows). But nobody has added any substance here. But it seems also that quite a few are trying to get into ucw, so I'm considering giving you a helping hand (as far as I can do that). It would be nice however if anyone would be interested in getting this stuff extended here.

I wish you a happy lisping time Friedrich


Pages in this topic: gettingUCWIntoPlay   ucwProgrammingTips   ucwTutorialAddingAValidatorToTheExample   ucwTutorialDataModel   ucwTutorialExample  


Also linked from: excurseProgrammingRants   UCW   ucwTutorialGettingABitFurther   ucwTutorialIntroducingTal   ucwTutorialTalification   ucwTutorialWritingYourOwnValidator   Web Application Development Comparison   webactionsTutorialStart   webDevelopmentExample  

CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively