Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP's With...EndWith equivalent in C# ?
Message
De
23/04/2007 14:48:41
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01216132
Message ID:
01219050
Vues:
11
>One could argue that if you can not see the begin of the with block, it is clear that your method needs refactoring for it is too long <g>

I certainly agree. I strive to keep my methods under 60-80 lines of code (which counts blank lines and curly braces...). :)
but my main point is that it affects readability, since the developer has to have his eyers moving from the member to the with block too often in order to follow the code.

>For example, you talk about the visibility of the with, but, isn't it worse with Using?

I see your point. I'm all about readability: if it does make the code more readable, I'll fuly-qualify a type, otherwise, I won't. :)

>I know that you guys would preferr to just assign a variable and then go from there, but... if you do not like the "with" structure, then you should be punished and suffer writing all the code, as simple as that <g>.

hmmm, I don't know what you're talking about. I use CodeRush, and one of its featues allows me to hit shift+Enter, which copies the current line and pastes it on the next line. So I don't really do much typing for something like that. :)

>> Seriously, assigning a variable to do the job is trading run time resources (Memory and Execution Time) for nothing (well, you could argue about legibility, but as with the case of the with structure, legibility is in the eye of the programmer, so some may not like to see the same variable written all over 10 lines).

I don't know, man... I agree with Scott Belware (http://codebetter.com/blogs/scott.bellware/archive/2007/04/07/161406.aspx) when he says "Code should be written to be optimally read by other people, not compilers".

also, there's a great free book on Code Reviews (http://smartbearsoftware.com/codecollab-code-review-book.php), with great essays explaining how to do a more effective code review, and why it's important to avoid the reviewer to be going back and forth in code (for instance, to see where a variable has been declared, or where a "with" block started, and on what object.member).
Claudio Lassala
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform