On Smalltalk

thoughts on Smalltalk and programming in general…
  • Home
  • About
  • Good Books
  • My Squeak Image
  • Popular Posts

A Bit On Seaside Configuration

By Ramon Leon - November 6, 2006 under Programming, Seaside, Smalltalk

For a full explanation of Seaside’s configuration abilities, see David Shaffer’s configuration tutorial, but for a quick simple explanation, here’s what I do.

Subclass WASystemConfiguration and add an attributes accessor to return an array of attributes, and define hard coded accessors for any defaults you’d like to set.

bookingHost
    ^'http://someRandomUrl'
fooWebServiceOn
    ^true
myClasses
    ^MyCustomClass allSubclasses
attributes
    ^{
        (WAStringAttribute key: #bookingHost group: #servers).
        (WABooleanAttribute key: #fooWebServiceOn group: #webServices).
        (WAListAttribute key: #fooFrameworkWebServiceUrl group: #webServices;
            options: self myClasses;
            yourself).
        (WANumberAttribute key: #barWebServiceUrl group: #webServices).
        (WAStringAttribute key: #googleMapKey group: #thirdPartyServices).
        (WAPasswordAttribute key: #serviceUserPassword group: #webServices)
    }

That’s pretty much it, it’s simpler than the tutorials make it out to be for what you’ll be using most of the time. From any component you can access those values with a simple

self preferenceAt: #bookingHost

I doubt for most work you’ll ever need to know anything more than this. You can, when necessary, subclass WAConfigurationAttribute and create your own field types, when necessary, but it’s rare to need to do so.

Tags: Seaside

Related posts
    at: "Simple File Based Application Configuration";
    at: "Seaside and Smalltalk Interest Spreading";
    at: "Turtles All the Way Down";

5 Comments so far

  1. Carl Gundel on November 7th, 2006

    Thanks for this. I didn’t even realize that I could do this sort of thing with Seaside.

  2. Lidell on November 10th, 2006

    Thanks for providing this, Ramon.

    I think it’s great that you provide these quick and illustrative examples for doing things in Seaside.

    Keep up the good work, man.

    PS: Not being very familiar with Squeak, I was at first puzzled by the #{} Squeak syntax for arrays in WASystemConfiguration>>attributes, but now that I see it, I think it’s a very good extension of Smalltalk. It solves several problems in the usual #() array initialization code.

  3. Ramon Leon on November 10th, 2006

    Thanks, I prefer terseness myself, I figure so must plenty of others.

  4. links for 2006-11-11 at He’s Just Had Coffee on November 11th, 2006

    [...] A Bit On Seaside Configuration | A Squeak, Smalltalk, Seaside, Object Oriented Programming and Web Development Blog (tags: seaside) [...]

  5. Smalltalk :: Seaside application generator : : November : : 2006 on November 12th, 2006

    [...] I have used the code I got from Ramon Leon for my seaside application generator. I have extracted a createWelcomeMessageOn method, in which I will put some simple what to do next instructions. Next I want to automatically create a simple folder structure on the file system to hold the style sheets and implement the rest of the convention over configuration paradigm into the script. I am still looking for the standard conventions in seaside though. Just like in rails I want to have unittest classes and a fixture setup automatically created with my models. [...]

Posting your comment.


  • Sponsors

  • Tags

    Databases General Linux Lisp Magritte Performance Profiling Programming Ruby Seaside Smalltalk Sql Squeak Updates
  • Categories

    • .Net (5)
    • Databases (9)
    • General (5)
    • Linux (2)
    • Lisp (3)
    • Magritte (2)
    • Programming (62)
    • Ruby (6)
    • Seaside (42)
    • Smalltalk (72)
    • Sql (2)
    • Stuff I Just Like (6)
    • Updates (7)
  • Blogs

    • (gem)Stone Soup
    • Avi Bryant
    • Boris Popov
    • defmacro
    • Giles Bowkett
    • Goran Krampe
    • James Robertson
    • Lukas Renggli
    • Martin Fowler
    • Paul Graham
    • Ralph Johnson
    • Randal Schwartz
    • Vassili Bykov
    • Weekly Squeak
  • Favorite Tools

    • Apache
    • Cygwin
    • FireFox
    • Scriptaculous
    • Seaside
    • Squeak
    • Squeak Dev Image
    • Ubuntu Linux
    • WordPress
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org

Copyright © 2008 On Smalltalk