Hi Guilherme,
this is good starting point.
I have some small experiences with data validation and I must agree
with you. I think that object should be able to be in non-valid state,
so validation should be explicit, not implicit.
My second idea is, that validation is usually done in control itself
or more complex validation is done by server, so implementing
validation in properties is, I think, bad step. Example can be
situation that something is wrong in the server and you want to fix
it. If validation is in properties and server replies you bad value,
you can't instantiate the model object.
I'm implementing validation by this way:
- I have object that I need to validate
- I will create validation schema (this can be json schema, or some
kind of schema with instantiated objects describing each fields)
- Currently my schema uses also widgets, so for example I have
TextField, FloatField, ImageField, etc classes that I can instantiate
and add all together to some form (not ui object). And finally I can
call, form.validate() or validate() on individual items
So, validation in models/objects itself will be always limiting factor
in some situations that will always happen and extending this can be
nightmare for people that wants more control or different approach.
Why not to model validation like this ?:
Instantiated object or dict {} that holds the data (valid or invalid,
don't care)
|
Validator based on validation schemas
|
Input/Output
And finally user interface can be like this:
Instantiated object or dict {} that holds the data (valid or invalid,
don't care)
|
User Interface (usually some kind of form), fields based on
validations schemas, field layout based on different ones (grouping,
or hand written - more control)
Cheers and sorry for my limited English here
- Petr
2008/12/1 Guilherme Aiolfi <[EMAIL PROTECTED]>:
> Hi Martin,
>
> I would like to ask 2 questions about validation:
>
> 1) As it is now, I can't have a initial state different of a valid state or
> can I? Let's say I want the initial value of a properties to be "" (empty)
> and validate it accepting just strings with more than 2 letters. In this
> case, is the initial value validated and would throw an error or the initial
> state is treated differently?
>
> 2) Let's say my object has 20 properties, I would have to have 20 blocks of
> try catch to highlighted all errors at once?
>
> I'm trying to get as close as I can of data binding functionalities without
> implementing it. I guess you already have a idea of how data binding should
> be implemented in qooxdoo. Do you mind sharing these ideas with us? I'm sure
> a lot of people are interested. I'm not talking about API or so. Just some
> general thoughts of how integrate it in qooxdoo. I'm sure others are
> interested as well.
>
>
> Thanks,
>
> Guilherme
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel