Results 1 to 4 of 4

Thread: [2.0] Efficient or not efficient, what do you think?

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2006
    Posts
    56

    [2.0] Efficient or not efficient, what do you think?

    Here's the setup.

    1) Main Form
    2) Options Form
    3) Seperate class which handles effecting the main form's status based on the options that were changed.

    The idea behind the code was to have 1 property that I could call, rather than writing duplicate code.

    For example...

    When I change an option in the options form, the main form will have changes that take effect (like the context menu showing the shortcut keys or not, etc.).

    Now... the main form also needs to get that option when the initial main form loads (without modifying the options).

    It's working fine, but it feels wrong to pass the main form directly to the class...

    I wonder if it's more efficient to duplicate the code or continue with this class setup where I pass it the actual main form in addition to any other params?

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [2.0] Efficient or not efficient, what do you think?

    In computers business we have a saying:
    "If it works, don't mess with it"
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3
    Fanatic Member JPicasso's Avatar
    Join Date
    Aug 2001
    Location
    Kalamazoo, MI
    Posts
    843

    Re: [2.0] Efficient or not efficient, what do you think?

    If it ain't broke, don't fix it.


    However, I'd probably do that by creating an option class, then give the main form a public method to recieve (receive?) that option class and make changes to itself. That way the main form takes care of handling the options for itself, and no other class needs to know specifics about the main form. (Note: I have no idea what kind options you are talking about... data? UI setup?) If you ever wanted to use that option class for a different or similar form, it may or may not want to use the selected options differently.

    MHO.
    Merry Christmas

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2.0] Efficient or not efficient, what do you think?

    Quote Originally Posted by JPicasso
    If it ain't broke, don't fix it.


    However, I'd probably do that by creating an option class, then give the main form a public method to recieve (receive?) that option class and make changes to itself. That way the main form takes care of handling the options for itself, and no other class needs to know specifics about the main form. (Note: I have no idea what kind options you are talking about... data? UI setup?) If you ever wanted to use that option class for a different or similar form, it may or may not want to use the selected options differently.

    MHO.
    MEO.

    I'd do something like that too.

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