Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hate Nested IFs? Consider this...
Message
From
13/01/2006 10:47:36
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01086217
Message ID:
01086542
Views:
20
>>So, if I read that properly. You are saying that one HAS to be DRUNK AND TIRED to drive the car??? No wonder there are so many accidents on the road... ;)
>>
>>Chad
>
>Wow, you're right! And all the others haven't noticed that before! We must be really lousy reviewers. :)

Right - and this actually proves Jim's assertion that this can be hard to read, and my assertion that the names of methods have to be meaningful. The .drunk() and .tired(), .tank.empty() methods have completely wrong names. In a context of the example, they have to have positive names:
lCanDrive=.f.
do case
   case not this.HaveCar()
   case not this.HaveLicense()
   case not this.sober()
   case not this.rested()
   case not this.car.GotGas()
   ...
   otherwise
   lCanDrive=.t.
endcase
>>>
>>>So, if someone doesn't have a car or a license, we don't care whether he has had a drink or two, and we surely won't check the tank in a car he doesn't have.
>>>
>>>I don't see anything wrong with this approach, on the condition that the method names are meaningful.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform