[aida] Re usable Components in Seaside & Aida

nico petton.nicolas at gmail.com
Fri Jan 30 11:09:50 CET 2009


Le vendredi 30 janvier 2009 à 00:42 -0800, Frank Young a écrit :
> After learning a little about Seaside, I just tried out Aida/Web recently.  I
> found it simpler and easier to pick up than Seaside. In fact, Aida reminds
> me of Ruby on Rails in some ways, with its emphasis on naming and
> convention.  Methods are named viewXXXX and actionXXXX; models are named
> YYYY while their corresponding WebApplications are named YYYYApp.  Of
> course, Smalltalk provides a much faster and more productive development
> environment than any Ruby IDE.
> 
> The most striking difference between Seaside and Aida that people have
> pointed out, of course, is control flow.  Seaside permits WAcomponents to be
> called, just like a subroutine, which facilitates reusability of that
> component.  Moreover, a WAComponent can also be rendered within a page as
> well, further enhancing its reusability.
> 
> As an example, consider a WAComponent that acts as a login page, prompting a
> user for username and password:
> 
> LoginComponent>>renderContentOn: html
> 	html form: [
> 		html text: 'Login: '.
>          html textInputOn: #username of: self; break.
>          html text: 'Password: '.
>          html passwordInputOn: #password of: self;break.
>          html submitButtonWithAction: [
> 			self authenticate] text: 'Login']]
> 
> In Seaside, one can call this LoginComponent
> 
> 		self call: LoginComponent new
> 
> to have a login page pop up, or one can render an embedded LoginComponent
> within the current page:
> 
> 		html render: loginComponent
> 
> similar to how a Java applet can function either as an applet or as a Java
> application (if called from an AWT Frame).
> 
> I think this is one of the strong points of Seaside in permitting
> WAComponents to be used in different contexts, so that programmers can
> easily develop a library of reusable components.
> 
> From what I have seen of Aida, it uses a state machine-like process to
> transition and navigate among different web pages rather than Seaside's
> subroutine-like flow control.  I wonder, though, how Aida supports reusable
> components given this distinction.

We have several examples of resuable components in Aida. See WebGrid
class for example. I also a counter example for Aida:
http://nico.bioskop.fr/blog/a-multi-counter-with-aida/web.html

and the demo: http://nico.bioskop.fr/multicounter.html

As you can see, components in Aida heavily use Ajax, but as it is deeply
integrated in Aida, you shouldn't even notice it, except for some method
names!

to try a multicounter by yourself, load the class and methods from my
post, then in any application, add a view like this:

viewCounters
	| e |
	e := WebElement new.
	self counters do: [:each |
	e add: each].
	self pageFrameWith: e title: 'multi-counters'

counters
	^counters ifNil: [
		counters := {CounterComponent new.
			{CounterComponent.
			{CounterComponent}]

cheers!

nico
-- 
Nicolas Petton
http://nico.aidaweb.si
            ___
          ooooooo
         OOOOOOOOO
        |Smalltalk|
         OOOOOOOOO
          ooooooo
           \   /
            [|]
--------------------------------
Ma clé PGP est disponible ici :
http://nico.aidaweb.si/pgp-key.html
-------------- section suivante --------------
Une pi�ce jointe non texte a �t� nettoy�e...
Nom: non disponible
Type: application/pgp-signature
Taille: 197 octets
Desc: Ceci est une partie de message
 =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=
Url: http://lists.aidaweb.si/pipermail/aida/attachments/20090130/e785059f/attachment.sig 


More information about the Aida mailing list