Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting null value on Integer
Message
De
31/01/2016 14:36:40
 
 
À
31/01/2016 04:41:39
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01630133
Message ID:
01630458
Vues:
53
>I think it's just a matter of preference. I'd find my code more readable than yours :-}

I don't understand anything in that code. lol

>FWIW, here's what 'Code Complete' says on the subject:
>
>(a) Minimize the number of returns in each routine. It's harder to understand a routine if, reading it at the bottom, you're unaware of the possibility that it returned somewhere above.
>
>(b) Use a return when it enhances readability. In certain routines, once you know the answer, you want to return it to the calling routine immediately. If the routine is defined in such a way that it doesn't require any cleanup, not returning immediately means that you have to write more code.

The thing is about that is that on some specific methods, you have cleanup code. And, that goes usually at the end, before the Return. What if you return higher? You would then end up in moving the cleanup code into a private method and call that method from various exit points. But, then again, you would need to call it from various exit points instead of just having one pre Return lines to do it.

It is true I have seen some weird code on the Internet where a line contained about 8 calculations, thus 8 potential lines into one, and then, wow, try to fix something in that line, understand it or make it evolve. I guess this is mostly what I am targeting at.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform