Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
To iif or not to iif = .t.
Message
De
08/06/2001 09:48:44
James Beerbower
James Beerbower Enterprises
Hochheim Am Main, Allemagne
 
 
À
07/06/2001 10:15:35
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00513276
Message ID:
00516870
Vues:
20
>>
>>if  vartype(tMan) <> “C”
>>	Return this.throwerror(“Bad Man”)
>>else
>>	if vartype(tPhilosopher)<>”C”
>>		Return this.throwerror(“Bad Philosopher”)
>Ahem... Return this.throwerror(“Philosopher wihout character”) or Return this.throwerror(“Philosopher's character not variable”)?

Yes. Or better still:
this.throwerror(Program()+PARAMETER_ERR,lineno(),program()) Though "Philosopher without Character" sounds better. "Bad Philosopher!" only makes sense if "Philosopher" is your dogs name.

I've been trying to get away from the soft landing concept with error handling; or rather I want the error documented as soon as it occurs and then allow the calling object to handle the landing.

I really don't like
if  vartype(tMan) <> “C”
   * error
   return .f.
endif
Because
1. The program knows that there is an error that is just as serious as a syntax error.
2. and if the program does crash later then it will be much harder to track the error down.
3. If it doesn't crash then one could have a worse situation: bad data in the data base or incorrect results from the users point of view. I would rather see a hard crash than ship a 20,000$ chunk of metal to somebody who didn't ask for it.

ASSERT really doesn't help at all for this situation if you ask me. Its good in debugging but not once a bug has made it into production. Has anyone considered forcing foxpro errors at that point with the error() command or is that simply too ludicrous. From an OO point of view the method that identifies the error flag a property that identifies the area etc but I feel that if someone misuses the object interface there is a good chance that they won't check to see whether the object has an error. Maybe the strategy is to persuade the developers using my objects to check the error property of the object before major decision points?

Thanks for putting up with my rambling!
James Beerbower
James Beerbower Enterprises
Frankfurt, Deutschland
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform