[aida] "Dynamic" Domain Objects
Nicolas Petton
petton.nicolas at gmail.com
Fri May 23 01:22:00 CEST 2008
Le vendredi 23 mai 2008 à 01:09 +0200, Stefan Schmiedl a écrit :
> Hi Rob,
>
> On Thu, 22 May 2008 18:57:51 -0400
> "Rob Rothwell" <r.j.rothwell at gmail.com> wrote:
>
> > Ok...I'm not looking for an answer, just maybe a recommendation on how to
> > proceed.
> >
> > I created a very simple "dynamic object" (aren't all Smalltalk objects
> > dynamic?!) with an addField method that would create a new instance variable
> > and accessors so that I could dynamically add new input fields to a
> > WebApplication (since a WebFormElement uses an aspect:for: an object to bind
> > to--otherwise, I probably would just use a Dictionary).
>
> FWIW, I *would* use a dictionary.
You was faster than me! :)
Nico
> An "aspect" is nothing more than
> a reader and a writer with "compatible" names. If your ArbitraryObject
> has a dictionary 'properties' as instance variable, you can create
> "aspects" of your ArbitraryObject like, e.g.
>
> name
> ^properties at: #name ifAbsent: ['unnamed']
>
> name: aString
> properties at: #name put: aString
>
> If you don't care too much for speed, you could also avoid defining all
> of these methods by yourself (or explicitly in code) and instead prevent
> the MNU exception being raised by implementing (in VW)
> Object's method 'doesNotUnderstand: aMessage' which gives you access
> to the selector, which in turn would point to the property you're
> interested in.
>
> HTH,
> s.
> _______________________________________________
> Aida mailing list
> Aida at aidaweb.si
> http://lists.aidaweb.si/mailman/listinfo/aida
-------------- 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/20080523/54180254/attachment.sig
More information about the Aida
mailing list