SetMethod // Binding to Edit fields

Ruslan Zasukhin sunshine at public.kherson.ua
Thu Jun 17 17:12:08 CDT 2004


On 6/17/04 3:22 PM, "jda" <jda at his.com> wrote:

>> I think more important now get your response on overall new design:
>>     new classes
>>     new constant names
>>     new constant access (via module Valentina name)
> 
> So far, they seem reasonable.
> 
> The one thing I don't really care for is the new exception mechanism,
> which is inconsistent even in the new release.
> 
> There are many operations that you *expect* will fail from time to
> time, and having to create exceptions for them is a pain (especially
> when converting older code).

> I know you can put in try/catch blocks
> if you want to preserve a loop, but to do that for every instance is
> a nuisance. One example I've mentioned before is AddRecord or
> UpdateRecord where a field must be unique. It's going to fail
> occasionally if you are assigning values yourself, and I rely on
> Valentina to catch the error so I can generate another unique value.

Not so simple Jon.

Yes, pain is --> write more code. We have the same in C++, Java, C#.

But in general such loop

    loop
    {
        try
        { 
            action
        }
        catch
        {
            do something
        }
    }

Can be more effective than


    loop
    {
        action

        if( error ) << executed on each iteration
        {
            do something
        }
    }

> Another example would be a warning if you try to open a Valentina 1.x
> database with 2.x. There are undoubtedly dozens more.

> As I said, even Valentina 2.0 uses the method of assigning a return
> value to indicate success or not with such things as result =
> curs.nextRecord. Imagine having to use exceptions to deal with that!

Again not so easy.

Yes, NextRecord() return you bool value.
If all right, then we expect to get true or false.
This is logical result for this function.

BUT! NextRecord() is not simple function:
    - it access many disk files in db to read field values.
        
May happens that something wrong is in DEEP.
Then this function will throw Exception.

So both -> return and exception are legal for this function,
    and can happens.

Just on exception we put something what happens very rare.


> Anyway, this is my initial impression. I know that you will have a
> command Valentina.doNotThrow, and I plan on using that a lot.

You will need call it just once. And disable exceptions at all.
This is for fast upgrade of existed projects.

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina-beta mailing list