[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: Thiago Macieira <thiago () kde ! org>
Date: 2008-08-27 10:25:32
Message-ID: 200808271225.40412.thiago () kde ! org
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
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
["signature.asc" (application/pgp-signature)]
>> 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