Spindle Web Framework

Post on 14-Jan-2015

1,262 views 0 download

description

Description of the Spindle web framework, which has a strong separation between view and controller (unlike many web frameworks), and utilises concepts such as widgets and form objects. It also has a powerful full template language, instead of inventing a crippled and awkward second language. Written in Tcl with the XOTcl OO extension.

transcript

The Spindle Web Framework

Kristoffer Lawson, setok@scred.comTwitter: @Setok

Motivation

• Experience with Django

• Knowledge of Cocoa’s MVC

• Love of the Tcl language

Features

• Embedded web server

• MVC with full separation of each part of framework

• Simple, but powerful

• No dumb invented template language

• Based on Tcl + XOTcl

Tcl — Language of Kings

• Script language, http://www.tcl.tk/

• Popular GUI: Tk

• Ultra-dynamic

• Extendable

• Embeddable

Everything is a Command

set a 5puts “Hello, world”while {$a} { puts “Hi” incr a -1}

Everything is a String

set a “pu”set b “ts”$a$b “Hello, world”

Create new Constructs

proc do {body while expr} { uplevel while $expr $body}

Everything is Dynamic

rename while {}

Model-View-Controller

Model

Controller Viewactions

building rendered from

MVC in Cocoa (sometimes)

Model

Controller Viewactions

building based on

1: Connecting Controllers to URLs

FooController/foo connected

getHTMLFooView/foo

uses

connectedcall 'getHTML'

2: Connecting sub-URLs to methods

barFooController/foo/bar

getHTMLFooView/foo

call 'bar'

uses

connected

3: Passing forms

barenterName

FooController/foo

getHTMLFooView/foo

call 'enterName'

uses

With form 'enterName'

connected

nameFooNameForm

CreatesGets passed as arg

4: Widgets

barenterName

FooController/foo

getHTMLFooView/foo

connected'

uses

connected

AttributeAttribute

ListWidgetController

is datasource for

gets info from

getHTMLListWidgetView

uses

calls 'getHTML'

5: Templates

<html><body>Hello, [$controller name][widget UserList]</body></html>

Templates contd.

<ul>[foreach name [$controller names] {<li>Hello, $name</li>}]</ul>

Models?

• No forced model framework

• Use whichever one you like

• Been developing an experiment called Storm

Want to try?

• http://github.com/Setok/Spindle/

• http://github.com/Setok/Storm/

Contact

Kristoffer Lawson

setok@scred.com

Twitter: @Setok