The Artima Developer Community
Sponsored Link

Agile Buzz Forum
The Art of Seaside

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
The Art of Seaside Posted: Sep 5, 2006 9:48 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: The Art of Seaside
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

It's after lunch, and Lukas Renggli is up to talk about Seaside. This is a simple 10 steps "getting started with Seaside" demo. So for this, there's no templating, no "clean" urls, and most state is shared. That's not the way Seaside has to be done, but it's a simple way to get started. I don't have the ESUG DVD handy, which is too bad - there's a pre-built Seaside image on that CD (along with the Squeak VM).

The demo is a simple "To Do" app - two classes - ToDoItem and ToDoList. The demo is going to take that to the web with Seaside.

Seaside apps are built out of components - Views and Controllers. Components keep their state in instance variables. Yes, this is an example of MVC at work.

Step 1: Create a ToDoListView class. Add the boilerplate to register the application, and you get a base application in your browser at the name you registered. To get some content, you override the method #renderContentOn: to get some application speciic content. Rendering is a read-only phase (meaning: don't change state in this method!).


"assumes a model has been defined"
renderContentOn: html
	html self model title.
 
 
"class method "
renderClass
	"answer the specific render class here" 

Note - this uses new APIs in Seaside. From here, you can start customizing the render method (and having the domain handle rendering for each component) as you wish - so you can get a list, etc. With a simple rendering, we get this:

The html object understands a bunch of things, so you can ask it to push out things like divs, css, etc via built in protocol. For instance:


html div
	class: 'title'
	with: self model title.

Built into Seaside are a bunch of convenience things in the browser that allow you to look at what's going on in the browser.

To get interactivity, you define callback methods. So:


html anchor 
	callback: [self inform: anItem due]
	with: anItem title.

That will create a link, with the title showing. When the link is clicked, the callback block will fire. So what about forms?


"there's no need to specify #text: for submit buttons if you want the default"
html form: [html textInput
				value: text
				callback: [:value | text := value].
				html submitButton text: 'Save'].

There are convenience methods for the various html form elements - checkboxes, etc. Now, component replacement: Call


"Assumes the creation of ToDoItemEditor, which will know how to render itself"
edit: anItem
	self call: (ToDoItemEditor new model: anItem)

"using an answer"
edit: anItem 
	result := self call: (ToDoItemEditor new model: anItem copy).
	result ifNil: [^self].
	self model items replaceAll: anItem with: result.

You can nest components as much as you want. What are the benefits of Seaside?

  • Talked about Web apps
  • No url fiddling
  • No state serialization
  • Implemented complex workflow
  • separated design and logic

Technorati Tags: , ,

Read: The Art of Seaside

Topic: Joel Gets Hammered Previous Topic   Next Topic Topic: Ruby, Rails, and Web Services for SAP

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use