At 09:08 AM 5/2/2007, you wrote:

>If you are defining variables and not initializing them at the same
>time, you are asking -- no begging -- for problems later down the
>road.  That is because you are separating related sections of your code.

Totally agree. I do them separate to maintain compatibility with my 
Visual Basic code. That's one of VB's lacks, the Dim line can't 
initialize the variable to a non-default value on the same line. So I 
don't do it in RB even though I can.

>You don't want to know how many times that I've seen people "reuse"
>variables because they were declared and initialized at the top of a
>routine.  I can't count the times where someone has reused a variable
>in newly-inserted code and destroyed the initial value, which caused
>problems in the original code.

This doesn't happen if you name variables with a specific purpose. I 
can't use the variable IceCreamConesEaten for counting how many 
elephant dungs I have in my back yard, for instance. When I name my 
variables appropriately, I can't use them outside their intended 
purpose without being pangs of guilt. =)

Again, the main point is what you think the smallest "block of code" 
you want to deal with. To me, a For-Next or If-Then block of code 
shouldn't be it's own universe, it should be dependant within the 
routine, because it's doing a job for that routine. If I even need to 
copy that block to another routine I'm writing, that just tells me it 
should be it's own routine and not a block of code in a routine.

And again, if my routines are getting too large that I reuse 
variables easily (because they are so far from the top, or are 
distant away from their first usage), I need to conceptually split the routine.

Sort of like an "inefficiency" that keeps the important concepts in 
line. Check and balance.

So, dimming things at the top just reinforces my concept of the 
smallest universe being the routine, not a block of code within that 
routine. Others my think different and that's OK; like Brandon said, 
"whatever works."

But your point is well taken.

* * * * * * * * * * * * * * * * * * * * * * * * * * *
| Garth Hjelte                                      |
| Customer Service Representative, President        |
| Chicken Systems, Inc, Rubber Chicken Software Co. |
| 714 5th Street SE                                 |
| Willmar, MN 56201 USA                             |
|                                                   |
| 800-8-PRO-EPS    Toll Free Order Line (US Only)   |
| 320-235-9798     Tech Support, Sampler Questions  |
|                  International Line               |
| 360-838-7689     Fax                              |
| Product Sales:   [EMAIL PROTECTED]             |
| Product Support: [EMAIL PROTECTED]           |
| Sampler Q+A:     [EMAIL PROTECTED]                |
| Web Page:        www.chickensys.com               |
* * * * * * * * * * * * * * * * * * * * * * * * * * *

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to