Results 1 to 5 of 5

Thread: I'm not sure the best way to do this.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    I've been asked to review and modify some code from an onld employee. He never commented anything which is always nice. The prog I'm supposed to remake will be called by another one. It needs to run different routines depending on what is sent in as Command Line args. This is fine, I can do that no prob. The question I have is this. He designed it with about a million Global variables. Ok, maybe not that many but alot. Now alot of these globals are only used by 1 function and that's it. plus he's jumbled alot of functions together into a handful of modules. He also repeats a few functions. NOw, I can't remember whether the modules code and globals are only loaded when you call it or if they all get loaded at once.
    Also, would it be better mememory-wise, to set some of the globals to locals or similar? There is really only 1 or 2 forms that the user will see from my prog and one is just a Splash screen.
    I know forms are only loaded when you want them to, but I can't remember with modules. Basically, what I'd like to do is have only the code that is needed loaded into memory and nothing else. I have, more or less, complete control over how I code this, whether to have several different splash screens for each different type of function. And load the currently global variables as locals or something from these forms. I appreciate any help I can get. I'm still pretty new to tryin to optimise my code and working in the corporate structure. Most of my coding has been for me or small apps where this stuff didin't matter. Thanks.

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    Post

    Any code in standard modules is loaded into memory when the program launches. So I would suggest to spend some time in reorganising the lot.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    yeah, I've spent the last couple weeks just trying to understand it! I think I'll just end up redoing the whole thing.. probably faster. Thanks

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,175

    Post

    Keep in mind that if you move code from modules to forms, that you pay for it in longer form load times. If you are looking to keep size down, look for fixed size arrays that could be dynamically sized. You can also store message strings and the like in a res file rather than in code.

    ------------------
    Marty

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    I will keep that in mind, thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width