POV-Ray : Newsgroups : povray.off-topic : Smart little programming tricks, where to find ? : Re: Smart little programming tricks, where to find ? Server Time
10 Oct 2024 23:17:15 EDT (-0400)
  Re: Smart little programming tricks, where to find ?  
From: Darren New
Date: 21 Mar 2008 11:46:07
Message: <47e3e64f$1@news.povray.org>
Darren New wrote:
> Warp wrote:
>> if(10 < money*money && money*12 < 100)
>>
>>   Now it becomes much harder to understand quickly what's going on.
> 
> If money squared is more than ten or money times twelve is less than a 
> hundred.  Makes sense to me. :-)  But then, I'm used to it.

To be clear, I think it's harder to understand because it's nonsensical, 
not because the comparisons are in the wrong order. Is it any harder to 
understand that than

    if(money*money > 10 && money*12 < 100)

??  I'd say the failure here is naming the "money" variable incorrectly 
and not abstracting out the meaning.
   interest_basis = money * money;
   total_interest = money * 12;
   if (10 < interest_basis && total_interest < 100) ...


-- 
   Darren New / San Diego, CA, USA (PST)
     "That's pretty. Where's that?"
          "It's the Age of Channelwood."
     "We should go there on vacation some time."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.