Date/time class changes to handle extended date ranges

Guillaume Laurent glaurent at telegraph-road.org
Mon Feb 20 10:29:20 GMT 2006


R.F. Pels wrote:
> On Monday 20 February 2006 10.36, Guillaume Laurent wrote:
>
>   
>> I agree that breaking the Liskov Substitution Principle is a bad thing,
>> but I don't think it applies here. 
>>     
>
> I think it does apply - especially if the class is meant as a drop in 
> replacement.
So far I don't see how KDate doesn't work as a QDate drop in replacement.

>
> That makes it even worse :-(
>
> 	if (kdate.isValid() == true)
> 	{
> 	  qdate = kdate.convertToQDate();
> 	  if (qdate.isValid == true)
> 	  {
> 	    // Alrightie! I survived :-)
>   
Oh come on, what kind of hair-splitting is that ? Just call 
convertToQDate() directly and check if the result is valid. An invalid 
KDate will obviously convert to an invalid QDate, so the first check is 
pointless. And in practice just how often will you need to convert a 
KDate to a QDate anyway.






More information about the kde-core-devel mailing list