On 2 April 2010 22:10, Francois Stephany <
[hidden email]> wrote:
> Hi all,
>
> I'm reading the chapter on magritte in the seaside book and found this in
> section 24.5 :
>
> "There are advantages to having your rules outside your domain objects,
> [...snip...] Still you have to pay attention since it may weaken your domain
> model."
What this means is that it might be better to put the validation
directly into your model.
MyModel>>isValid
^ some complicated condition
Generally there is a trade-off between putting the domain validation
into the model or into the meta-model (as with about anything that can
be part of the meta-model). If you put it into the model it is closer
to the data and behavior and might be easier for people not accustomed
to meta-models; if you put it into the meta-model it is more generic
and can potentially be reused and extended for different models.
Sort of as a workaround you can call the meta-model to do the
validation from the model. Something like:
MyModel>>isValid
^ self description isSatisfiedBy: self
Lukas
>
> Any pointer to a discussion about the pro/cons of this approach ?
> Nothing important, I'm just curious to know...
>
> Cheers,
> Francois
>
> _______________________________________________
> Magritte, Pier and Related Tools ...
>
https://www.iam.unibe.ch/mailman/listinfo/smallwiki>
--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki