Walter Meester
HoogkarspelPays-Bas
Information générale
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Network:
Windows 2003 Server
>I'm 100% with John and Craig on this. As John pointed out your parameter statement is crying out for a structure to be passed in rather than that xml stuff. A strong-typed object will ensure your param is correct and your method can do the (single) task it should be doing.
Static typed objects (note that VFP is strong typed too) only ensure that the type is according to the signature of the methods. It however says noting about whether the values of the parameters are valid.
>Also agree about the exit point. You are using return as a way of breaking out of a process when you hit a certain point. Not a good idea. Much better to set variables at each stage ( if you are checking for bad conditions there may be more than one. Even in testing it would be good to find out about all of them on one pass)
I tend to agree. Only in very exceptional circumstances (e.g. performance) I might opt for a single early bailout. IMO, its good practise to have a single return.
If find myself using the DO CASE structure a lot to avoid deep nested IFs and keep the code readable.
Walter,
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement