[Kourse 3] Fixing krazy2 issues

Philipp Klaffert pklaffert at googlemail.com
Thu Jan 15 21:34:42 CET 2009


Am 15. Januar 2009 17:39 schrieb Aaron J. Seigo <aseigo at kde.org>:

> 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
>
>
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>
>

Thanks for your advice. After reading your mail I asked myself why I got
that idea not in first place :)
I've now swapped all the Strings with constants and so, just 3 objects an no
more krazy complaining for at least these issues.

Regards
Philipp Klaffert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/plasma-devel/attachments/20090115/3b030494/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 7163 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20090115/3b030494/attachment-0001.bin 


More information about the Plasma-devel mailing list