Formula vs Magritte

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

Formula vs Magritte

garduino
I would like to know the main differences/features between Formula and Magritte.

Cheers.

--
=================================================
Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
Arduino Software & Web Hosting   http://www.arduinosoftware.com
PasswordsPro  http://www.passwordspro.com
=================================================

To unsubscribe from this group, send email to iliad+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Reply | Threaded
Open this post in threaded view
|

Re: Formula vs Magritte

Nicolas Petton
Le vendredi 19 mars 2010 à 19:08 -0200, Germán Arduino a écrit :
> I would like to know the main differences/features between Formula and Magritte.

Hi German,

Sorry for the late answer. Formula and Magritte are very different.
First of all, Formula isn't about meta descriptions at all, but just
about building validated forms with ease.

If you need to describe your model for something else than building UI,
I would consider using Magritte, because I think it's very powerful, and
it has some interesting extensions.

Else I would use Formula, because its design is much simpler than
Magritte, and it's a lot easier to customize.

If you need examples of Formula, you can read this blog post:
http://smalltalk.gnu.org/blog/nico/formula-building-nice-validated-forms-iliad-ease

Cheers!

Nico

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Formula vs Magritte

garduino
Thanks by the response Nico.

That means that if, for example, I wants to validate the same field in
two different forms, with Formula I will need to codify the validation
twice?

And another question, Formula does nothing related with relationships
between objects, right?

Cheers.
Gernán.


2010/3/22 Nicolas Petton <[hidden email]>:

> Le vendredi 19 mars 2010 à 19:08 -0200, Germán Arduino a écrit :
>> I would like to know the main differences/features between Formula and Magritte.
>
> Hi German,
>
> Sorry for the late answer. Formula and Magritte are very different.
> First of all, Formula isn't about meta descriptions at all, but just
> about building validated forms with ease.
>
> If you need to describe your model for something else than building UI,
> I would consider using Magritte, because I think it's very powerful, and
> it has some interesting extensions.
>
> Else I would use Formula, because its design is much simpler than
> Magritte, and it's a lot easier to customize.
>
> If you need examples of Formula, you can read this blog post:
> http://smalltalk.gnu.org/blog/nico/formula-building-nice-validated-forms-iliad-ease
>
> Cheers!
>
> Nico
>

To unsubscribe from this group, send email to iliad+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Reply | Threaded
Open this post in threaded view
|

Re: Formula vs Magritte

Nicolas Petton
Le lundi 22 mars 2010 à 17:02 -0300, Germán Arduino a écrit :
> Thanks by the response Nico.
>
> That means that if, for example, I wants to validate the same field in
> two different forms, with Formula I will need to codify the validation
> twice?

Not necessarily. For example, you can have a formula to create and edit
users, and select fields you want for a specific context :

userFormula [
        | formula |
        formula := ILFormula on: self user.
        (formula inputOn: #username)
                label: 'Username'.
        (formula inputOn: #fullName)
                label: 'Full name'.
        (formula inputOn: #password)
                label: 'Password'.
        ...
        ^formula
]

loginFormula [
        ^self userFormula select: [:each |
                #(#username #password) includes: each key]
]


Another way to do it for complex forms where you have lots of fields
would be to use custom attributes in fields:

userFormula [
        | formula |
        formula := ILFormula on: self user.
        (formula inputOn: #username)
                attributeAt: #login put: true.
                label: 'Username'.
        (formula inputOn: #fullName)
                label: 'Full name'.
        (formula inputOn: #password)
                attributeAt: #login put: true.
                label: 'Password'.
        ...
        ^formula
]

loginFormula [
        ^self userFormula select: [:each |
                (each attributeAt: #login) = true]
]


>
> And another question, Formula does nothing related with relationships
> between objects, right?

No, it doesn't, but I never found the default implementation in Magritte
very useful anyway. Still, Formula allows you to deal with collections,
so you can easily set relationships. The example above deals the
relationship between users and user groups:

userFormula [
        | formula |
        formula := ILFormula on: self user.
        "Set the group this user belongs to"
        (formula selectOn: #group)
                options: self allGroups "A collection of group objects"
                labels: [:group | group name].
        ...
        ^formula
]

For one to many or many to many relationships, (for example, a group has
many users), you can do it this way:

groupFormula [
        | formula |
        formula := ILFormula on: self group.
        (formula selectOn: #users)
                "Allow several users to be in this group"
                multiple: true;
                options: self allUsers;
                labels: [:user | user fullName].
        ...
        ^formula
]


HTH,

Nico

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Formula vs Magritte

garduino
Thanks for the examples NIco, I will try and (hopefully) will ask
something again :)

Cheers.


2010/3/22 Nicolas Petton <[hidden email]>:

> Le lundi 22 mars 2010 à 17:02 -0300, Germán Arduino a écrit :
>> Thanks by the response Nico.
>>
>> That means that if, for example, I wants to validate the same field in
>> two different forms, with Formula I will need to codify the validation
>> twice?
>
> Not necessarily. For example, you can have a formula to create and edit
> users, and select fields you want for a specific context :
>
> userFormula [
>        | formula |
>        formula := ILFormula on: self user.
>        (formula inputOn: #username)
>                label: 'Username'.
>        (formula inputOn: #fullName)
>                label: 'Full name'.
>        (formula inputOn: #password)
>                label: 'Password'.
>        ...
>        ^formula
> ]
>
> loginFormula [
>        ^self userFormula select: [:each |
>                #(#username #password) includes: each key]
> ]
>
>
> Another way to do it for complex forms where you have lots of fields
> would be to use custom attributes in fields:
>
> userFormula [
>        | formula |
>        formula := ILFormula on: self user.
>        (formula inputOn: #username)
>                attributeAt: #login put: true.
>                label: 'Username'.
>        (formula inputOn: #fullName)
>                label: 'Full name'.
>        (formula inputOn: #password)
>                attributeAt: #login put: true.
>                label: 'Password'.
>        ...
>        ^formula
> ]
>
> loginFormula [
>        ^self userFormula select: [:each |
>                (each attributeAt: #login) = true]
> ]
>
>
>>
>> And another question, Formula does nothing related with relationships
>> between objects, right?
>
> No, it doesn't, but I never found the default implementation in Magritte
> very useful anyway. Still, Formula allows you to deal with collections,
> so you can easily set relationships. The example above deals the
> relationship between users and user groups:
>
> userFormula [
>        | formula |
>        formula := ILFormula on: self user.
>        "Set the group this user belongs to"
>        (formula selectOn: #group)
>                options: self allGroups "A collection of group objects"
>                labels: [:group | group name].
>        ...
>        ^formula
> ]
>
> For one to many or many to many relationships, (for example, a group has
> many users), you can do it this way:
>
> groupFormula [
>        | formula |
>        formula := ILFormula on: self group.
>        (formula selectOn: #users)
>                "Allow several users to be in this group"
>                multiple: true;
>                options: self allUsers;
>                labels: [:user | user fullName].
>        ...
>        ^formula
> ]
>
>
> HTH,
>
> Nico
>



--
=================================================
Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
Arduino Software & Web Hosting   http://www.arduinosoftware.com
PasswordsPro  http://www.passwordspro.com
=================================================

To unsubscribe from this group, send email to iliad+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.