Thom McGrath wrote: > Just curious, why is this considered a warning? Is there some kind of > overhead that I missed, or is it just messy code.
Tim Jones wrote: > But ... Brendan's check is for ANY block of code. I very oftne place > DIM's inside of If - Then blocks as they are not needed if the If > goes one way rather than another. This is a very valid use and does > not incur the issue you mention of DIMing within a loop. Thom McGrath then wrote: > I get the point now. I'm so used to optimizing my loops that I didn't > consider somebody would actually put a dim inside a for-next loop. > > So really, this should be checking for dims inside loops, rather than > every block. This whole discussion misses the point. Maintenance of the code "trumps" all the merits of putting DIM statements in any other place but the top of the method since putting DIM statements within the code are negligible at best. If you scatter your DIM statements within your code you make your code harder to read. Which is more important, your time as a developer or some negligible benefit? If your time is only worth $1 an hour, then have at it an write unmaintainable code, but the professional developers typically earns $50 or more an hour and making your code harder to read is rather short sighted. RB Code Reports is about enforcing the process of creating maintainable code. RB Code Reports is not for you if you intend to be a cowboy programmer. Some of you may take offense at that statement thinking I am dumping on your poor coding practices you consider just fine, but you need to recognize the reality of what you are doing. As I look out over the the code put out by the RB community, very little of it could be considered maintainable. To be blunt, a lot of it is crap. This in not a unique characteristic of the RB community itself, but programmers in general. There is a blatant disregard to make code maintainable because it takes more effort to do so and it is a choice made out a lack of attention to detail. There are decades of common experience of dealing with unmaintainable code and people continue to choose to repeat the same mistakes over and over in spite of knowing the cost they will pay down the road. Is this not the definition of stupidity? _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
