Re: Poor VB Programming

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Randy Birch (rgb_removethis_at_mvps.org)
Date: 09/24/04


Date: Thu, 23 Sep 2004 20:17:07 -0400

I had a question once from a programmer that couldn't understand why his
results were not as expected. Seems he subscribed not only to the
Use-Hungarian-Notation-At-All-Costs movement, but also had a scope issue ...
he had defined a variable something like Global glob_mod_var_int_i in a bas
module, then used that as the counter in all his for next loops throughout
his app. Needless to say the counters were getting a tad out of whack.

-- 
Randy Birch
MS MVP Visual Basic
http://vbnet.mvps.org/
"Stephanie Stowe" <NoSpam@IWishICould.com> wrote in message
news:%23F6yr8YoEHA.1152@TK2MSFTNGP11.phx.gbl...
:
: "AustinMN" <tacooperX@Xatt.net> wrote in message
: news:M5q4d.622044$Gx4.68540@bgtnsc04-news.ops.worldnet.att.net...
: > Jeff Johnson wrote:
: > <snip>
: > > -------------------
: > > Subject: JimmyCode of the day
: > >
: > > As part of a function call:
: > >
: > >     <SomeFunction> <param1>, <param2>, CDate(Now), ...
: > >
: > > So how the #$^! did you think Now() would be interpreted, huh?
Dumbass.
: > > --------------------
: >
: > Yup, some people just love to program in the worst possible way.
: >
:
:
: It reminds me of a guy that I used to work with who told me that he always
: declared variables globally because he could not understand scope.
:
:
: This guy was making a living as a programmer. Can't understand scope. Used
: to give me the shivers.
:
: > I had to deal with a SP that was called SP_FundPerfromance.  It
calculated
: > fund performance.  Of course, the original programmer could have fixed
the
: > spelling error right away, but he didn't.  Instead, he made sure it was
: > called by 20-30 other SP's and a host of VB aplications.  Then I got to
: > inherit it.
: >
: > > Of course then there's passing global variables to functions, and some
: of
: > > the most fragmented code in the world. I mean functions placed in
: standard
: > > modules that were never called by more than one form and were never
: > intended
: > > to be. I could go on, but it starts to make my head hurt.
: >
: > This used to be necessary in VB3, because sometimes form modules would
: crash
: > if they went over 64K in length.  It was standard procedure to have a
: module
: > to go with every form of any significant size.  All you saw was a
leftover
: > habit.
: >
: > Austin
: > --
: > You programmed with 1s and 0s? We only had 0s!
: > There are no X characters in my address
: >
:
:


Relevant Pages

  • Re: Aggregation vs composition
    ... which is indeed something a programmer has to be aware of. ... >> with a dead reference. ... > That is where the true lifetime responsibility lies... ... and there is no risk of B going out of scope before C wants this to happen. ...
    (comp.object)
  • Re: I thought this was the one that worked?
    ... With static scoping, a variable always refers to its nearest ... dynamic scope forces the programmer to anticipate ... the term "closure" in computer science is derived from the ...
    (comp.lang.ruby)
  • Re: Poor VB Programming
    ... I had a question once from a programmer that couldn't understand why his ... but also had a scope issue ... ... "AustinMN" wrote in message ...
    (microsoft.public.vb.general.discussion)
  • Re: Poor VB Programming
    ... I had a question once from a programmer that couldn't understand why his ... but also had a scope issue ... ... "AustinMN" wrote in message ...
    (microsoft.public.vb.database)
  • Re: Poor VB Programming
    ... I had a question once from a programmer that couldn't understand why his ... but also had a scope issue ... ... "AustinMN" wrote in message ...
    (microsoft.public.vb.database.ado)