[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: which module would be most appropriate for my library?
From:       "Ben Cooksley" <sourtooth () gmail ! com>
Date:       2008-08-27 20:06:47
Message-ID: b366d7a00808271306p71971a5cibd76cd37450e0327 () mail ! gmail ! com
[Download RAW message or body]

On 8/27/08, Thiago Macieira <thiago@kde.org> wrote:
> On Quarta 27 Agosto 2008 11:54:16 Ben Cooksley wrote:
>> the setters are now void, changed with commit #853130.
>> they were originally bool as it was designed to indicate whether the
>> operation succeeded or not. now its up to the application developer to
>> double check with the appropriate get method, which shouldn't even be
>> needed ( unless they are paranoid, or like being very safe :) )
>> the includes are also fixed with #853131 as per the library code policy.
>
> Setters shouldn't be allowed to fail if the input is valid. I mean, there's
> a
> set of valid values that can be set and those should always work. If you
> pass
> an invalid value to a setter, the behaviour is undefined.
>
> So double-checking with the getter should never be needed.
>
> However, if the operation is allowed to fail, then you don't have a setter
> ("set" + noun), but an operation (verb in imperative). Compare, for
> instance,
> QFile::open to QFile::setFileName.
>
> --
>   Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
>     PGP/GPG: 0x6EF45358; fingerprint:
>     E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
>
>

sorry about the misunderstanding,
none of my setters are designed to fail at all, they perform a certain
action if the data provided is not valid. in all cases they hide the
relevant element when invalid data is passed ( ie: setProgress hides
the progress bar ). the only exception to this is setPosition() which
just silently aborts if the data is invalid ( then they should read
the api docs which tells them a range between 0-19 is what is required
). none of them will fail for any other reason, apart from invalid
data.

bcooksley
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic