[Magritte] Relation description with instances of a class

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Magritte] Relation description with instances of a class

cbeler
Hi

Is it possible to use existing descriptions to express a relation with
object existing or not ?

We could imagine choosing a responsible from an existing list of person
defined by a class Person. If the person doens't exist, we can
instanciate a new one.

I will try to create an appropriate description but I don't really know
where to subclass as it is a bit of a mix between a
SingleOptionDescription with instances of a class as option and a
ToOneRelation description with class Person. What do you think ?

I ve tried with a MASingleOption description defining the reference as  
Person description and options as my repository of users but that hangs
(due to the reference wich is a Caontainer Description I guess)... I
also tried with MADynamicDescription without result...

that makes me ask another question... Are all MADynamicObject used with
classes or subclasses as it is in my image ?


thanks

Cédrick



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki

_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: [Magritte] Relation description with instances of a class

Lukas Renggli-2
> I will try to create an appropriate description but I don't really  
> know
> where to subclass as it is a bit of a mix between a
> SingleOptionDescription with instances of a class as option and a
> ToOneRelation description with class Person. What do you think ?

Yes, those two already duplicate some code, traits would be of a big  
help here ;-)

Anyway, I would subclass the ToOneRelation and try to copy the things  
you need from the SingleOptionDescription (probably only #options)  
over into your new class. The same for the views.

> that makes me ask another question... Are all MADynamicObject used  
> with
> classes or subclasses as it is in my image ?

No, that should work with any block of code. However MADynamicObject  
does not work together with the Smalltalk Debugger, as the debugger  
tries to evaluate the block again when displaying the object in its  
inspector causing yet another error and debugger ...

So one thing you have to make sure beforehand is that the code in  
MADynamicObject works as expected by copying the contents of the  
block to a workspace and testing it there.

I tend to discourage the use of MADynamicObject because it usually  
causes more troubles than it solves. It is much a better approach to  
create your descriptions dynamically on the instance side, if you  
need to build them depending on the state of your model.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: [Magritte] Relation description with instances of a class

cbeler

>Yes, those two already duplicate some code, traits would be of a big  
>help here ;-)
>  
>
was wondering if they could could be grouped...  an option description
is a kind of relationDesc except the reference is not a container but a
single description...

>Anyway, I would subclass the ToOneRelation and try to copy the things  
>you need from the SingleOptionDescription (probably only #options)  
>over into your new class. The same for the views.
>
>  
>
I'll try that and let you know if I get something working

>So one thing you have to make sure beforehand is that the code in  
>MADynamicObject works as expected by copying the contents of the  
>block to a workspace and testing it there.
>  
>
ok I see :)

>I tend to discourage the use of MADynamicObject because it usually  
>causes more troubles than it solves. It is much a better approach to  
>create your descriptions dynamically on the instance side, if you  
>need to build them depending on the state of your model.
>
>  
>
Isn't MADynamicObject used because of the cached description ?

Thanks Lukas ;)

Cédrick

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki

_______________________________________________
Smallwiki mailing list
[hidden email]
http://impara.de/mailman/listinfo/smallwiki