[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Date/time class changes to handle extended date ranges
From:       Guillaume Laurent <glaurent () telegraph-road ! org>
Date:       2006-02-20 10:29:20
Message-ID: 43F99A00.9030604 () telegraph-road ! org
[Download RAW message or body]

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.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic