Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
My most favorite code sample
Message
De
16/01/2014 05:49:41
 
 
À
14/01/2014 15:33:31
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01591669
Message ID:
01591983
Vues:
36
Such code is only manually hard to debug as entering a specific function is problematic.
But IF the called functions are nothing but a sequence of functions depending on errorless call of previous like executors of a template pattern
local llOk
llOk = FirstFunc()
llOk = m.llOk + NextFunc()
.
.
llOk = m.llOk + LastFunc()
is IMO better - and if a specific action needs to be done sometimes after error I might use case !Function() as a fall-through structure to reach the Otherwise - but with a little comment added preventing that pattern being abused... 3 lines for each func is wasteful if trying to adhere to 1 screenful of lines >>> 1 method if you sometimes need to code on laptop screens ;-)

>IF ThisFunction() or ThatFunction or TheOtherFunction()
> .
>
>


>IMHO, code like that is a nightmare to debug. I hate code like this:
>
>
>IF ThisFunction() or ThatFunction or TheOtherFunction()
> .
>
>
>Much easier to debug if written like this:
>
>
>llRetVal = ThisFunction()
>IF llRetVal
>  llRetVal = ThatFunction()
>ENDIF 
>IF llRetVal
>  llRetVal = OtherFunction()
>ENDIF 
>
>
>At least if there is a bug in the code you can easily determine which one of the functions is causing the problem.
>
>Just my 2 cents...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform