Glenn L. Austin wrote:
> That is absolutely and patently incorrect for proper maintenance of
> code -- putting the declarations of variables as close as possible to
> their use is one of the basic tenets of good software design.  If you
> can scope the variables inside of a block so that they aren't
> available outside of the scope of the block is even better.

That is your opinion and not necessarily a tenet of good software
design.

Reading code is similar to reading a book. If you bury your DIM
statements, you make it harder to read. Knowing where your
declarations are makes it easier to understand the code. If a book
had its table of contents randomly spread throughout the chapters,
the result would be confusion. If your eye has to scan the code to
find the declaration, you have wasted your time. Knowing where
your DIM statements are speeds your comprehension rate up.

The big problem is programmers are selfish. This means they write
code that looks good to them for their own consumption and not for
other people to read. They are not thinking of how it will read to
others. Scattering your DIMs is not doing others who read your
code a favor. The number one time waster is trying to understand
code that someone else has written. This FAR outweighs the the
refactoring argument you use. Readability means the code is
understood faster which makes it easier to refactor!

Gathering all your DIMs in one spot is just one way to make your
code more readable, but there are even bigger fish to fry in
the maintenance of code. Far better is to thoroughly comment your
code which tells the reader what it does. Having to expend time to
figure out what each line of code does, is a huge waste of time.
Most likely, if you are a person who scatters your DIM statements,
then you probably don't comment your code which speaks to the lack
of attention to detail which I mentioned earlier and this is
selfishness (you are not considering others who will use your
code).

_______________________________________________
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