PDA

Click to See Complete Forum and Search --> : [2.0] Efficient or not efficient, what do you think?


ThisIsMyUserName
Jun 8th, 2006, 09:26 AM
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?

ComputerJy
Jun 8th, 2006, 07:02 PM
In computers business we have a saying:
"If it works, don't mess with it"

JPicasso
Jun 9th, 2006, 07:04 AM
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.

mendhak
Jun 9th, 2006, 10:00 AM
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.