Manuel Lemos | 2 May 20:35 2006
Picon

Re: Thoughts on Metal

Hello,

Sorry for the delay.

on 04/26/2006 02:45 PM dashiad01 said the following:
> Hello,
> I just found the metal project, and i am really happy about it, as it 
> shares most of my points of view about development.
> As i'm working now as web programmer, my idea has been to run away 
> from the usual mess of data-code-presentation that is usual in this 
> field.I developed specific solutions for each one of these, and now 
> was looking to integrate them in a single tool, unifying them, and 
> addressing quite a few objetives more, most of them i guess i share 
> with the Metal point of view (metaspecification of presentation 
> widgets, component-focused system , etc).
> I didnt used XML in my previous works, as i found XSL unnecesarily 
> complex (and, as i was also developing in php, why using another 
> language?).

Right, I do not use XSL either.

> But just a few days ago, i decided to give XML a try,and as i reached 
> the conclusion i needed a metalanguage for my presentation widgets 
> event handling, i began to look for the solution.
> And this is how i found metal.
> Ok, all this ramble is to introduce myself a bit.
> 
> Now, on metal itself (just gave a quick look at it.No idea of what 
> metastorage is, but i think i guess it..).

(Continue reading)

comfortablementeadormecido | 7 May 00:31 2006
Picon

About Cardinality

Hi.

I've been playing with metastorage for a while, looking for it's pros
and cons before deciding to apply it for good in my company framework.
For now, the Pros are beating the cons. =)

There's a single question which I haven't yet been able to answer by
reading the documentation. Is there any way to validate the
cardinality in conllections?

An example:
I've designed a simple addressbook application in which a single user
can have up to 4 addresses asigned. There are several validation rules
that include a valid zipcode, address length, etc. But, is there any
way to validate the ammount of addresses a user has at any given
point? Of course, I mean a way to do it using only metastorage tools
(I have already done this using a custom validation function).
If there isn't, I think it would be a big performance upgrade to
include them, since cardinality is an important design element.
If there's a way to accomplish this already, I would very much like to
know about it.

Thanks in advance

Matías

------------------------ Yahoo! Groups Sponsor --------------------~--> 
Everything you need is one click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/AHchtC/4FxNAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 
(Continue reading)

Manuel Lemos | 7 May 01:16 2006
Picon

Re: About Cardinality

Hello,

on 05/06/2006 07:31 PM comfortablementeadormecido said the following:
> There's a single question which I haven't yet been able to answer by
> reading the documentation. Is there any way to validate the
> cardinality in conllections?
> 
> An example:
> I've designed a simple addressbook application in which a single user
> can have up to 4 addresses asigned. There are several validation rules
> that include a valid zipcode, address length, etc. But, is there any
> way to validate the ammount of addresses a user has at any given
> point? Of course, I mean a way to do it using only metastorage tools
> (I have already done this using a custom validation function).
> If there isn't, I think it would be a big performance upgrade to
> include them, since cardinality is an important design element.
> If there's a way to accomplish this already, I would very much like to
> know about it.

Well, so far I have no need for that nor anybody requested that feature
before you, but I understand why you need and it makes sense to support
it somehow.

The question is, how do you think it should be implemented to work
conveniently?

Currently you can only add an object to a collection if both collection
and member objects are persisted. So I think any form of collection
validation should happen after storing the objects and before adding to
the collection.
(Continue reading)

comfortablementeadormecido | 7 May 22:41 2006
Picon

Re: About Cardinality

What I think is that adding a new function type (such as
validatemember) which relly is a subtype of the validate function
would be redundant. Given those posibilities I would go forward
creating a new type of validation only. 
But then, I don't think that would be good either, since the
validation function Is usually called before the persist function in
order to validate the data entered to the object, therefore, you
wouldn't be able to add to a colection an already persisted object
which hasn't already been validated and therefore, hasn't been yet
persisted. (I would be really surprised if you actually understood
that mess of thoughts sadly put into words).

I considered some other posibilities and came to the conclusion that
cardinality is not an optional validation that should be considered
outside of a collection regular attributes. On the other hand, the
actual existance of a limitation to the ammount of members IS optional
(if there is no limit, cardinality still exists in the form of 0..* )
And, when i looked into the addtocollection function I realized it
returned a boolean value of 1 (true). So t make things short, I would
definitely go for a validation inside the add to collection function,
making it return 0 in case the member couldn't be added. And I
wouldn't create a new type of either validation or function. What I
would do is add a new parameter to the collection tag, called
<maximum> in which to indicate the maximum number of elements. It
would be an optional tag that would indicate "no limit" if not used.

  <collection>
   <name>addresses</name>
   <class>address</class>
   <reference>owner</reference>
(Continue reading)

Manuel Lemos | 8 May 02:05 2006
Picon

Re: Re: About Cardinality

Hello,

on 05/07/2006 05:41 PM comfortablementeadormecido said the following:
> What I think is that adding a new function type (such as
> validatemember) which relly is a subtype of the validate function
> would be redundant. Given those posibilities I would go forward
> creating a new type of validation only. 

It is not really the same thing. validate type functions validate an
object of a class. validatemember validate the relationship between one
object and another to be added as a member of a collection of objects of
the first.

> I considered some other posibilities and came to the conclusion that
> cardinality is not an optional validation that should be considered
> outside of a collection regular attributes. On the other hand, the
> actual existance of a limitation to the ammount of members IS optional
> (if there is no limit, cardinality still exists in the form of 0..* )
> And, when i looked into the addtocollection function I realized it
> returned a boolean value of 1 (true). So t make things short, I would
> definitely go for a validation inside the add to collection function,
> making it return 0 in case the member couldn't be added. And I

The return value of addtocollection functions means whether it
successfully added the object to a collection or there was a serious
runtime error, like database access fault. These errors are fatal and so
are not meant to  be handled by the application. I mean, when they
happen, the current script should exit immediately.

A validation error is not fatal. It is condition that can be used to
(Continue reading)

George Herson | 10 May 04:00 2006
Picon

shared MetaL algorithm repository

Hi,

Has anyone started an online library of algorithms
coded in MetaL?  If no, why not?

thanks,
George

------------------------ Yahoo! Groups Sponsor --------------------~--> 
Protect your PC from spy ware with award winning anti spy technology. It's free.
http://us.click.yahoo.com/97bhrC/LGxNAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
comfortablementeadormecido | 10 May 14:59 2006
Picon

Re: About Cardinality

Hmmm I see your point and you are absolutely right. I just had not dig
enough into the metastorage compiled code to see some of those points.

so a validatemember function seems to be the solution, but it made me
wonder about the moment it should be called, much as you mentioned in
your first message. For instance, at first glance it seems obvious
that the validate member function should be called within the
addtocollection function since we are not validatig if the element
contains valid data, we are validating if it can be added to a
specific collection. So we will also need the collection it is
supposed to be added, and that is given by the addtocollection function.
So far, alltoghether, it makes sense.

But then, in the example I provided there are no addresses floating in
the sistem unatached to a user. If an address can't be added to the
user's collection, then it shouldn't exist at all. But in order to
even call the addtocollection function, which will call the
validatemember function the object to be added must already be
persisted. so, suppose the validation turns out it cannot be added,
then you will have to delete the object from the DB and you would have
writen into a deleted from the DB without actually getting any changes
made. 
Besides, as you said, the validatemember function will return the
error code that you cannot retrieve from the addtocollection function.

so, we need to capture the error and prevent the need to write and
delete from the DB senselessly.
So the validatemember function should be called outside the
addtocollection function but it should be a function of the class
containing the collection. Then the call could be something like.
(Continue reading)

Manuel Lemos | 11 May 20:33 2006
Picon

Re: shared MetaL algorithm repository

Hello,

on 05/09/2006 11:00 PM George Herson said the following:
> Has anyone started an online library of algorithms
> coded in MetaL?  If no, why not?

Well, MetaL itself comes with a library of classes for different
purposes. It is not exactly a library of algorithms nor it is very
extensive.

Anyway, several of those classes written in MetaL have been in use by
many thoushands of users in the form of PHP Classes. So, they have no
idea that the classes were written in MetaL. It is not relevant either
because they use the classes because they are useful regardless of the
language they were written.

These classes are available inside the library directory of the MetaL
distribution.

http://www.meta-language.net/cvs/metal/library/

Some classes need to be fixed to work with some backwards incompatible
changes that were done some time ago, but there was no time to fix
everything. Just execute php -q build.php to build those classes.

Anyway, I am planning to start a new site based on the PHPClasses.org
repository that will be used to distribute initially components written
with the help of Metastorage. Later it can be used to distribute
components written in any "language" based on MetaL.

(Continue reading)

Manuel Lemos | 11 May 20:42 2006
Picon

Re: Re: About Cardinality

Hello,

on 05/10/2006 09:59 AM comfortablementeadormecido said the following:
> But then, in the example I provided there are no addresses floating in
> the sistem unatached to a user. If an address can't be added to the
> user's collection, then it shouldn't exist at all. But in order to
> even call the addtocollection function, which will call the
> validatemember function the object to be added must already be
> persisted. so, suppose the validation turns out it cannot be added,
> then you will have to delete the object from the DB and you would have
> writen into a deleted from the DB without actually getting any changes
> made. 

Just rollback the changes and you are done. It is a just a simple
function call to a finishtransaction function that you need to add to
the the factory class.

> Besides, as you said, the validatemember function will return the
> error code that you cannot retrieve from the addtocollection function.
> 
> so, we need to capture the error and prevent the need to write and
> delete from the DB senselessly.
> So the validatemember function should be called outside the
> addtocollection function but it should be a function of the class
> containing the collection. Then the call could be something like.
> 
> if($addressbook->CanAddAnAddress()) {
>   $address = new Address();
>   $address->Persist();
>   $addressbook->AddAddress($address);
(Continue reading)


Gmane