Archive for the 'Seaside' Category

9 July 2007 Upgrading Seaside

Here’s some very valuable info posted by Philippe Marschall (core Seaside developer) in the mailing list…

This is a short list of things to do when migrating for an older to a newer version of Seaside in the wiki at:
http://www.squeaksource.com/Seaside.html

2.6 to 2.7 must:

  • every component that uses the old default WAHtmlBuilder must do so explicity by returning it in #rendererClass
  • evaluate WADispatcher resetAll
  • use WATagBrush >> #title: instead of WATagBrush >> #tooltip:
  • move to new image map api, check all senders of #imageMap, see WAImageMapTag for details

2.6 to 2.7 should:

  • move to new header api, modify implementors of #updateRoot:
  • remove the implemtors of #rendererClass that return WARenderCanvas
  • migrate to WARenderCanvas
  • migrate from WAScriptLibrary and WAStyleLibrary to WAFileLibrary
  • use WAAnchorTag >> #with: instead of WAAnchorTag >> #text:
  • check for deprecated message sends
  • replace users of WAChangePassword, WAEditDialog, WAEmailConfirmation, WAGridDialog, WALoginDialog, WANoteDialog

2.7 to 2.8 must:

  • migrate to WARenderCanvas
  • backtrack state by implementing #states (check all senders of #registerObjectForBacktracking: and #registerForBacktracking)
  • move to new header api, modify #updateRoot:. #linkToStyle becomes #stylesheet #url, #linkToScript becomes #javascript #url:, check all implementors of #updateRoot:
  • use WAAnchorTag >> #with: instead of WAAnchorTag >> #text:
  • replace users of WAChangePassword, WAEditDialog, WAEmailConfirmation, WAGridDialog, WALoginDialog, WANoteDialog
  • every component that implements #initialize must send this message also to super (use SLint)
  • if you use Squeak 3.7 load SeasideSqueak37 after Seaside
  • if you use Squeak do not load into an image that has an earlier version of Seaside already loaded

2.7 to 2.8 should:

  • check for deprecated message sends
  • migrate from WAScriptLibrary and WAStyleLibrary to WAFileLibrary
  • remove the implementors of #rendererClass that return WAHtmlCanvas

I’m sure this list is not complete and I forgot stuff. So if you spot something that is missing send a message to me or the list or fix it directly. This is not on the Seaside homepage so anyone can edit it.
It will probably be moved to the homepage at a future point.

Cheers, Philippe

What are the Barriers to Entry for Smalltalk and Seaside?

It’s been two or three years since I began using Smalltalk and Seaside and I’m so comfortable in the environment I think I’ve forgotten how difficult it was to get going. By the time I started this blog, I was already quite comfortable using both Smalltalk and Seaside that I think a bunch of the little things I could have written about have been overlooked.

I’ve been so busy with work lately that I haven’t felt much like writing but I think it’s about time I give the blog a little more love. So those of you looking to get into Smalltalk, or Seaside, where’s your pain? What things are tripping you up that you can’t find answers to? What things are getting in your way that keep you from getting into the flow and really doing something in Seaside?

I’m just looking for some ideas for some bite sized yet useful articles covering topics I haven’t already covered that’ll help ease someone’s pain just a bit and get me back into the writing mood.

Maintaining Loose Coupling in Seaside Components

There is an interesting question that often comes up often when writing components. How do my components communicate with each other in a way that doesn’t bind them together explicitly. How does a child component call a method on a parent component without explicitly knowing who the parent is.

Knowing who the parent is prevents the component from being re-used in other contexts with different parents. There is a general solution to this whole class of problems and it was solved quite elegantly by Vassili Bykov with his Announcements framework.

The basic idea is to setup an announcer somewhere global, in the session for example.

MySession>>announcer
    ^ announcer ifNil: [announcer := Announcer new]

Then subclass Announcement for any interesting thing that might happen like removing a child.

Announcement subclass: #RemoveChild
    instanceVariableNames: 'child'

RemoveChild class>>child: aChild
    ^self new
        child: aChild;
        yourself

RemoveChild>>child: anChild
    child := anChild

RemoveChild>>child
    ^child

Any component interested in this announcement registers its interest when it initializes.

Parent>>initialize
    super initialize.
    self session announcer on: RemoveChild do:[:it | self removeChild: it child]

Parent>>removeChild: aChild
    self children remove: aChild

And any component who wants to fire this event simply announces it by sending in an instance of that custom announcement object.

Child>>removeMe
    self session announcer announce: (RemoveChild child: self)

Works great, and depending on where you place the announcer, you could even have different sessions sending events to each other, or different applications.

Here’s a file out of a commented working demo that has a child remove itself from the parent via an announcement.

UPDATE: I use the port of Announcements from Lukas Renggli’s public repository. The one on SqueakSource is a different port.

Small Reddit, A Seaside Sample Application

I just uploaded a simple reddit clone sample Seaside application to SqueakSource. It’s meant be a very simple reference application to learn from, it’s only about 4 hours work total. There are comments throughout, and various techniques are used to demonstrate different ways of doing things. Some forms are generated directly via Seaside and some other by Magritte. Persistence is implement in image using dictionaries and collections.

Features include login, register, add entry, vote on entry, comment on entry, comment on comment. There are probably a few bugs. I’m not making any claims of best practice, only showing various ways I accomplish things to suite my needs.

Hopefully such an application will make Seaside more approachable for the newbie and help ease the lack of documentation available. I know when I first started learning, I was far more interested in actual samples than outdated documents. Enjoy!

UPDATE: Loading this code requires that you create a repository in Monticello. Just create a new HTTP repository with the following template using the +Repository button.

MCHttpRepository
    location: 'http://www.squeaksource.com/SmallReddit'
    user: ''
    password: ''

Once done, you can open the repository, select the package, and load it. It will create an application on localhost at /seaside/smallReddit, on whatever port you’re running Seaside on. You could also just download the mcz file directly and drag and drop it into your squeak image, at which point you’ll be prompted and asked what you’d like to do.

See my previous screencast about using Monticello for a quick visual on using Monticello.

« Previous PageNext Page »