Date/time class changes to handle extended date ranges
Thiago Macieira
thiago at kde.org
Sun Feb 19 20:17:28 GMT 2006
R.F. Pels wrote:
>> The convention is really "a K* class is a Q* class with some
>> modification/extension".
>
>... to be able to use it in the KDE framework in a way that makes sense.
>
>> KDateTime is exactly like QDateTime with the difference of the range;
>
>... which is why it should NOT BE FOLLOWING the same naming strategy.
> Naming the classes KDate and KDateTime creates expectations that cannot
> be made true.
I'm sorry, I'm not following.
If there is a KFoo class that extends a QFoo class, it is obvious that it
extends *something*. If it followed the exact same API and same contract,
there wouldn't be any need for a new class: you'd just use the QFoo one.
So I fail to see how extending the range is breaking the contract.
However, when one class extends another, it should properly document what
it is extending.
>Hah. In that case I would be very much opposed to adding conversions
> from KDate to QDate if there is the possibility that one creates an
> invalid QDate without being able to detect that in an easy way.
That is very much true. If conversion from type A to type B may lose
information, it should never be silent. The user has to knowingly do that
or get a compiler warning (which is not possible in this case).
It's like converting a "long long" to "char": the compiler may let you,
but it'll print a warning. If you want it to shut up because you know
better, you have to explicitly cast.
This is what classes should do too.
>My conclusion is that there is a disconnect between KDate and KDateTime
> on one side and QDate and QDateTime on the other side. This disconnect
> should be reflected in the names of the K-classes and that is why KDate
> and KDateTime are not the right names for those classes.
I don't agree. So there should be no KApplication because it may register
with DCOP while QApplication does not? Or no KMenuBar because it may show
at the top of the screen and is styled?
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
4. And æfter se scieppend ingelogode, he wrát "cenn", ac eala! se
rihtendgesamnung andswarode "cenn: ne wát hú cennan 'eall'. Ástynt."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060219/c6fe516b/attachment.sig>
More information about the kde-core-devel
mailing list