[Kourse 3] Fixing krazy2 issues

Aaron J. Seigo aseigo at kde.org
Thu Jan 15 17:39:09 CET 2009


On Thursday 15 January 2009, Philipp Klaffert wrote:
> thanks for your reply and for the link. For fixing the krazy2 issues
> correctly I changed QString to QLatin1String. I understand your point of
> view with "readability" but I won't decide which way is better. I think the
> explicit conversion of these Strings makes the understanding of the code
> not so much harder...

what jumps out at me is that we have duplications of strings. not fun. if the 
string is changed in one place, it ends up needing to be changed everywhere. 
oh nos!

so ... my suggestion is this:

create as set of static const QString's in the TwitterEngine class and 
initialize them to the values... e.g.:

const QString TwitterEngine::profilePrefix("Profile:");

then the calls become:

name.startsWith(profilePrefix);

no more duplicated strings and no more crazy issues. huzzah!

thanks for working on these, btw =)

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Software

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090115/9ae20832/attachment.sig 


More information about the Plasma-devel mailing list